pyoptics.plot_tools¶
Plot helpers: intensities, complex fields (amplitude and phase) and image stacks through focus. Importing this module sets matplotlib’s font size and family.
Functions
Plot a complex field. |
|
Plot an image stack. |
|
Plot an image stack. |
|
Plot an intensity image. |
- pyoptics.plot_tools.plot_intensity(psi, x, y, xlabel=None, ylabel=None, title=None, colorbar=True, use_intensity=False, n=1.0, ax=None, **kwargs)[source]¶
Plot an intensity image.
- Parameters:
- psiarray
Complex field or intensity image. psi is considered to be an intensity already is if is of complex type, otherwise it’s considered to be an in intensity.
- x, yarrays
Linear coordinate arrays the image is sampled on.
- xlabel, ylabel, titlestrings, optional
Matplotlib options.
- colorbarboolean, optional
If True, a colorbar is added.
- use_intensityboolean, optional
If True, use physical intensity for the plot. Otherwise, use abs(psi)**2 [default].
- ndouble, optional
Refractive index of embedding medium. Defaults to n=1.0. Used if psi is complex.
- axmatplotlib axes, optional
If given, use this axes to plot to.
- **kwargskeyword arguments
Propagated to matplotlib imshow() call.
- pyoptics.plot_tools.plot_field(field, x, y, xlabel=None, ylabel=None, title=None, colorbar=True, use_intensity=False, amp_title=None, phase_title=None, horizontal_layout=True, use_rad=False, n=1.0, **kwargs)[source]¶
Plot a complex field.
- Parameters:
- psiarray
Complex field.
- x, yarrays
Linear coordinate arrays the field is sampled on.
- xlabel, ylabel, titlestrings, optional
Matplotlib options.
- colorbarboolean, optional
If True, a colorbar is added.
- use_intensityboolean, optional
If True, use intensity for the amplitude plot. Otherwise, use abs(psi) [default].
- ndouble, optional
Refractive index of embedding medium. Defaults to n=1.0. Used if psi is complex.
- **kwargskeyword arguments
Propagated to matplotlib imshow() call. If given, phase_cmap is mapped to cmap for the phase plot.
- pyoptics.plot_tools.plot_imstack_alternative(imstack, x, y, z_vals, cmap=<matplotlib.colors.LinearSegmentedColormap object>, normalize=False)[source]¶
Plot an image stack.
- Parameters:
- imstackarray
Array of dimension (Nz, Nx, Ny).
- x, yarrays
Linear or 2d coordinate arrays.
- z_valsarray
- cmapMPL colormap, optional
Colormap to use. Defaults to cm.Blues.
- normalizeboolean, optional
If True, normalize each image slice individually to [0, 1]. Use this if the individual images differ a lot in maximum intensity. Defaults to False.
- pyoptics.plot_tools.plot_imstack(imstack, x, y, z_vals, cmap=<matplotlib.colors.LinearSegmentedColormap object>, normalize=False, alpha=0.5)[source]¶
Plot an image stack.
- Parameters:
- imstackarray
Array of dimension (Nz, Nx, Ny).
- x, yarrays
Linear or 2d coordinate arrays.
- z_valsarray
- cmapMPL colormap, optional
Colormap to use. Defaults to cm.Blues.
- normalizeboolean, optional
If True, normalize each image slice individually to [0, 1]. Use this if the individual images differ a lot in maximum intensity. Defaults to False.
- alphafloat, optional