imsave_field

hcipy.plotting.imsave_field(filename, field, grid=None, vmin=None, vmax=None, norm=None, mask=None, mask_color='k', cmap=None)

Save a two-dimensional field as an image.

Parameters:
filenamestr

The path to the file in which to save the field.

fieldField or ndarray

The field that we want to display. If this is an ndarray, then the parameter grid needs to be supplied. If the field is complex, then it will be automatically fed into complex_field_to_rgb(). If the field is a vector field with length 3 or 4, these will be interpreted as an RGB or RGBA field.

gridGrid or None

If a grid is supplied, it will be used instead of the grid of field.

vminscalar

The minimum value on the colorbar. If it is not given, then the minimum value of the field will be used.

vmaxscalar

The maximum value on the colorbar. If it is not given, then the maximum value of the field will be used.

normNormalize

A Normalize instance is used to scale the input to the (0, 1) range for input to the cmap. If it is not given, a linear scale will be used.

maskfield or ndarray

If part of the image needs to be masked, this mask is overlayed on top of the image. This is for example useful when plotting a phase pattern on a certain aperture, which has no meaning outside of the aperture. Masks can be partially translucent, and will be automatically scaled between (0, 1). Zero means invisible, one means visible.

mask_colorColor

The color of the mask, if it is used.

cmapColormap or None

The colormap with which to plot the image. It is ignored if a complex field or a vector field is supplied.