herosdevices.hardware.santec.slm200¶
HERO driver and functions to control a Santec SLM.
Module Contents¶
- herosdevices.hardware.santec.slm200.msg = Multiline-String¶
Show Value
"""Missing ftd3xx python module. Get it from: https://www.ftdichip.com/Support/SoftwareExamples/FT60X.htm and install it. Make sure to also install D3XX driver for your platform. Find it here: https://www.ftdichip.com/Drivers/D3XX.htm """
- herosdevices.hardware.santec.slm200.WORD_LENGTH = 4¶
- herosdevices.hardware.santec.slm200.IMAGESIZE = (1200, 1920)¶
- herosdevices.hardware.santec.slm200.fpga_status¶
- herosdevices.hardware.santec.slm200.video_mode¶
- herosdevices.hardware.santec.slm200.cmd_control¶
- herosdevices.hardware.santec.slm200.cmd_statusrequest¶
- herosdevices.hardware.santec.slm200.cmd_statusresponse¶
- herosdevices.hardware.santec.slm200.cmd_imagedata¶
- class herosdevices.hardware.santec.slm200.SLM200(serialnumber: str, channel: int = 0, streaming_mode: bool = False, request_sleep: float = 0.015)¶
Bases:
herosdevices.hardware.santec.template.SantecSLMTemplate
Driver for a Santec SLM200 spatial light modulator.
The images can be transferred to the SLM200 via USB or DVI. This driver, however, only supports communication via USB. Since image upload via USB takes roughly 150ms, this driver is limited to around 6Hz of refresh rate. Precise and externally synchronized timing is only possible in USB mode.
In USB mode (also called memory mode) images can be pushed via USB and stored in one of 128 memory slots. The image slot displayed on the SLM can be set randomly by the driver or an advance from one slot to the next can be triggered by a software trigger, and internal timer, or a logic signal (Trigger IN SMB jack).
The SLM contains an FPGA that the computer communicates with by writing to an output FIFO/pipe and reading from an input FIFO/pipe. These two FIFOs are transparently accessed through the FTDI driver (D3xx) which provides methods to read and write these FIFOs/pipes.
This driver is reverse engineered by looking at the data the vendor software sends via USB. This was achieved by looking at the API calls to the functions FT_WritePipe and FT_ReadPipe in the D3XX.dll which handles the communication with the FTDI USB3.0 chip (FT601).
- firmware_versions = ['2018021001', '2018021101', '2018020001', '2017080002', '2015010001']¶
- trigger_functions¶
- serialnumber¶
- channel = 0¶
- bStreamingMode = False¶
- request_sleep = 0.015¶
- trigger_mode = 'none'¶
- d3xx = None¶
- write_command(cmd_dict: dict, payload: bytes, seq_id: int = 0) None ¶
Send a command to the SLM.
- read_command(length: int) dict ¶
Read a command response from the SLM.
- Parameters:
length – Length of the response to read in byte.
- status() str ¶
Get the current status of the SLM.
- Returns:
Status string.
- request(cmd_dict: dict, payload: bytes, buffer: bytes | None = None, trials: int = 100, request_sleep: float | None = None) str ¶
Send a request to the SLM and wait for a response.
- Parameters:
cmd_dict – Dictionary containing command metadata.
payload – Payload to send. Unused when buffer is used
buffer – Pre-assembled buffer to send.
trials – Number of trials to attempt.
request_sleep – Sleep time between retries.
- Returns:
Status string.
- write(buffer: bytes) None ¶
Stream buffered data to the SLM.
- read(length: int) bytes ¶
Read length bytes from the device.
- firmware_serialnumber() str ¶
Get the serial number of the santec firmware running on the SLM.
This not the same as the serial number used to identify the FTDI chip.
- Returns:
Serial number.
- video_mode(mode: int = 0) str ¶
Query or set the video source the SLM draws the images from.
- Parameters:
mode – Video source. 0 = USB/Memory, 1 = DVI.
- Returns:
Status of the operation.
- display_slot(slot: int = 1) str ¶
Set the memory slot to display on the SLM.
- Parameters:
slot – Slot number. The lowest slot number is 1.
- Returns:
Status of the operation.
- contrast_level(value: int) str ¶
Set the contrast/gamma level of the LCOS.
- Parameters:
value – Value between 0 and 1023.
- Returns:
Status of the operation.
- trigger_output(on: bool | None = None) str ¶
Activate the trigger output of the SLM.
This is especially useful in DVI mode orwhen software/automatic triggers are used.
- Parameters:
on – Determines whether the trigger output should be activated. If not set the current status is returned.
- Returns:
tatus of the operation.
- trigger_software_fire() str ¶
Fire a software trigger. Only works if the trigger mode was set to manual before.
- Returns:
Status of the operation.
- trigger(mode: str | None = None) str ¶
Set or query the trigger mode.
Hint
- The SLM can be triggered from four different sources:
none : The image selected by
display_slot()
is displayed continuously and no trigger changes this.manual : The image in the next slot is displayed when the software trigger
trigger_software_fire()
is called.auto : The change to the next image is periodically triggered by an internal timer.
external : The change to the next image happens when a logic pulse on the trigger in SMB-connector is received.
- Parameters:
mode – Name of the trigger mode to set. If no argument is given, the current trigger mode is returned.
- Returns:
The trigger mode.
- phase_calibration(wavelength: int, max_phase: int = 2) str ¶
Calibrate the change of the lights phase as function of the bit value of each pixel.
This can be used to adapt for different wavelength of the light and to change the maximum phase change for the maximum pixel value of 1023 (10bit).
Attention
This command takes some minutes to finish!
- Parameters:
wavelength – Wavelength of the indicent light in nm.
max_phase – Maximum phase change in units of pi.
- Returns:
Status of the operation.
- push_image(slot: int, image: numpy.typing.NDArray[numpy.uint16]) str ¶
Upload an image into a specified memory slot.
- Parameters:
slot – Slot number. Slot numbers range from 1 to 128.
image – The image. Dimension must be (1200, 1920). Dtype must be ‘u2’ (unit16), otherwise is it casted to ‘u2’ which might have unpredictable results.
- Returns:
Status of the operation
- herosdevices.hardware.santec.slm200.logger¶