slmsuite.hardware.cameraslms.NearfieldSLM#
- class NearfieldSLM(cam, slm, mag=None)[source]#
Bases:
CameraSLM(NotImplemented) Class for an SLM which is not nearly in the Fourier domain of a camera.
- Parameters:
mag (number OR None) – Magnification between the plane where the SLM image is created and the camera sensor plane.
Methods
Returns a dictionary containing selected attributes of this class.
Plots the provided phase and image for the child hardware on a pair of subplot axes.
Saves the dictionary returned from
pickle()to a file like"path/name_id.h5".- __init__(cam, slm, mag=None)[source]#
See
CameraSLM.__init__().
- pickle(attributes=True, metadata=True)[source]#
Returns a dictionary containing selected attributes of this class.
- Parameters:
attributes (bool OR list of str) – If
False, pickles only baseline attributes, usually single floats. IfTrue, also pickles ‘heavy’ attributes such as large images and calibrations. Iflist of str, pickles the keys in the given list. By default, the chosen attributes should be things that can be written to .h5 files: scalars and lists of scalars.metadata (bool) – If
True, package the dictionary as the"__meta__"value of a superdictionary which also contains:"__version__", the current slmsuite version,"__time__", the time formatted as a date string, and"__timestamp__", the time formatting as a floating point timestamp. This information is used as standard metadata for calibrations and saving.
- plot(phase=None, image=None, slm_limits=None, cam_limits=None, title='', axs=None, cbar=True, **kwargs)[source]#
Plots the provided phase and image for the child hardware on a pair of subplot axes.
- Parameters:
phase (ndarray OR None) –
Phase to be plotted. If
None, grabs the last writtenphasefrom the SLM.Important
Writes this
phaseto the SLM ifimageisNone.image (ndarray OR None) – Image to be plotted. If
None, grabs an image from the camera.slm_limits (None OR float OR [[float, float], [float, float]]) – Scales the limits by a given factor or uses the passed limits directly.
cam_limits (None OR float OR [[float, float], [float, float]]) – Scales the limits by a given factor or uses the passed limits directly.
title (str) – Super title for the axes.
ax ((matplotlib.pyplot.axis, matplotlib.pyplot.axis) OR None) – Axes to plot upon.
cbar (bool) – Also plot a colorbar.
**kwargs – Passed to
set_phase()
- Returns:
Axes of the plotted phase and image.
- Return type:
(matplotlib.pyplot.axis, matplotlib.pyplot.axis)
- save(path='.', name=None, **kwargs)[source]#
Saves the dictionary returned from
pickle()to a file like"path/name_id.h5".- Parameters:
path (str) – Path to directory to save in. Default is current directory.
name (str OR None) – Name of the save file. If
None, will usename+'-pickle'.**kwargs – Passed to
pickle()to customize how and what data is saved.
- Returns:
The file path that the pickled data was saved to.
- Return type:
str