slmsuite.hardware.cameraslms.CameraSLM#
- class CameraSLM(cam, slm, mag=1)[source]#
Bases:
_PicklableBase class for an SLM with camera feedback.
- cam#
Instance of
Camerawhich interfaces with a camera. This camera is used to provide closed-loop feedback to an SLM for calibration and holography.- Type:
- name#
Stores
cam.name + '-' + slm.name.- Type:
str
- mag#
Magnification of the camera relative to an experiment plane. For instance,
mag = 10could refer to the use of a 10x objective (with appropriate imaging lensing) between the experiment plane and the camera. In this case, the images apparent on the camera are 10x larger than the true objects at the experiment plane.- Type:
float
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=1)[source]#
Initialize an SLM linked to a camera, with given magnification between the camera and experiment planes.
- Parameters:
cam (Camera) – Instance of
Camerawhich interfaces with a camera. This camera is used to provide closed-loop feedback to an SLM for calibration and holography.slm (SLM) – Instance of
SLMwhich interfaces with a phase display.mag (float) –
Magnification of the camera relative to an experiment plane. For instance,
mag = 10could refer to the use of a 10x objective (with appropriate imaging lensing) between the experiment plane and the camera. In this case, the images apparent on the camera are ten times larger than the true objects at the experiment plane.Note
This magnification is currently isotropic. In the future, anisotropy between the camera and experiment planes could be implemented.
- 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)
- 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.