Attenuators
An attenuator is a subtype of Attenuator: a device whose transmission is set by a drive voltage. The interface sets and reads the voltage (setdrivevoltage, getdrivevoltage) or the transmission (settransmission, gettransmission), converting between them through a calibration table set with set_calibration!. The LCC1620 takes its drive voltage from a DAC channel of a Triggerscope4 (see Triggerscope), which several attenuators can share.
Attenuator interface
MicroscopeControl.HardwareInterfaces.AttenuatorInterface — Module
This builds a generic interface for optical attenuators, e.g. liquid crystal variable attenuators driven by an analog voltage.
MicroscopeControl.HardwareInterfaces.AttenuatorInterface.Attenuator — Type
Attenuator is an abstract type that defines the interface for an optical attenuator.
MicroscopeControl.HardwareInterfaces.AttenuatorInterface.AttenuatorProperties — Type
AttenuatorPropertiesGeneric properties for an optical attenuator.
Fields
drive_voltage::Float64: The current drive voltage of the attenuator.transmission::Float64: The current transmission (0 to 1),NaNif unknown (no calibration set).min_voltage::Float64: The minimum drive voltage of the attenuator.max_voltage::Float64: The maximum drive voltage of the attenuator.cal_voltages::Vector{Float64}: Calibration lookup table drive voltages (empty if not calibrated).cal_transmissions::Vector{Float64}: Calibration lookup table transmissions (0 to 1), same length ascal_voltages.
MicroscopeControl.HardwareInterfaces.AttenuatorInterface.getdrivevoltage — Method
getdrivevoltage(attenuator::Attenuator)Get the current drive voltage of the attenuator.
Arguments
attenuator::Attenuator: An Attenuator type.
Returns
voltage::Float64: The current drive voltage, unit: volt.
MicroscopeControl.HardwareInterfaces.AttenuatorInterface.gettransmission — Method
gettransmission(attenuator::Attenuator)Get the current transmission of the attenuator (0 to 1), NaN if no calibration has been set.
Arguments
attenuator::Attenuator: An Attenuator type.
Returns
transmission::Float64: The current transmission, between 0 and 1.
MicroscopeControl.HardwareInterfaces.AttenuatorInterface.set_calibration! — Method
set_calibration!(attenuator::Attenuator, voltages::Vector{Float64}, transmissions::Vector{Float64})Store a voltage-to-transmission calibration lookup table, measured externally (e.g. with a photodiode in a characterization script). The table is used by settransmission and gettransmission via linear interpolation.
Arguments
attenuator::Attenuator: An Attenuator type.voltages::Vector{Float64}: Drive voltages, unit: volt.transmissions::Vector{Float64}: Measured transmissions (0 to 1), same length asvoltages.
MicroscopeControl.HardwareInterfaces.AttenuatorInterface.setdrivevoltage — Method
setdrivevoltage(attenuator::Attenuator, voltage::Float64)Set the raw drive voltage of the attenuator.
Arguments
attenuator::Attenuator: An Attenuator type.voltage::Float64: The drive voltage to set, unit: volt.
MicroscopeControl.HardwareInterfaces.AttenuatorInterface.settransmission — Method
settransmission(attenuator::Attenuator, transmission::Float64)Set the transmission of the attenuator (0 to 1) using the stored voltage-to-transmission calibration (see set_calibration!).
Arguments
attenuator::Attenuator: An Attenuator type.transmission::Float64: The transmission to set, between 0 and 1.
MicroscopeControl.gui — Method
gui(attenuator::Attenuator)Create a GUI for the attenuator.
Arguments
attenuator::Attenuator: An Attenuator type.
Thorlabs LCC1620 liquid crystal attenuator
MicroscopeControl.HardwareImplementations.LCC1620Attenuator — Module
LCC1620AttenuatorA Module for controlling a Thorlabs LCC1620/M liquid crystal attenuator through a Triggerscope V4 DAC output. Citation: Ali Kazemi Nasaban Shotorban, Lidke Lab, UNM
MicroscopeControl.HardwareImplementations.LCC1620Attenuator.LCC1620 — Type
`LCC1620` A Thorlabs LCC1620/M liquid crystal attenuator inherited from `Attenuator`,driven through a Triggerscope V4 DAC output channel.
Multiple attenuators can share one Triggerscope4 — construct the scope once and pass it to each LCC1620 with a different dac_channel. The scope's serial-port lifecycle is owned by the caller: initialize(att) opens the port only if it is not already open, and shutdown(att) drives the channel to min_voltage but leaves the port open (another attenuator may still use it).
Fields
unique_id::String: A unique identifier for the attenuator.properties::AttenuatorProperties: The properties of the attenuator.scope::Triggerscope4: The Triggerscope driving the attenuator.dac_channel::Int: The Triggerscope DAC channel wired to the LCC1620 EXT INPUT (1-16).
MicroscopeControl.attenuator_gui — Function
attenuator_gui(attenuator::Attenuator) -> GLMakie.ScreenThe same function as gui for an attenuator, under the name this module exports for the LCC1620. It opens a window with a drive-voltage slider (volts, from properties.min_voltage to properties.max_voltage in 0.01 V steps, starting at properties.drive_voltage) and a text box that moves the slider, prints the attenuator's type to standard output, and returns the Screen. Each change of the slider value, including one made through the text box, calls setdrivevoltage with the new voltage, so the window commands the device as soon as it is used. Needs a display (GLMakie).
MicroscopeControl.export_state — Method
export_state(attenuator::LCC1620)MicroscopeControl.initialize — Method
initialize(attenuator::LCC1620)Open the Triggerscope serial port (if not already open — the scope may be shared with another attenuator), set the DAC channel range to 0-5 V, and drive to min_voltage.
MicroscopeControl.shutdown — Method
shutdown(attenuator::LCC1620)Drive the DAC channel to min_voltage (0 V = full transmission on the LCC1620). The Triggerscope serial port is left open — it may be shared with another attenuator; shut the scope down separately when done with all channels.
Attenuator internals
MicroscopeControl.HardwareImplementations.LCC1620Attenuator.interp1 — Method
interp1(x::Vector{Float64}, y::Vector{Float64}, xq::Float64)Linear interpolation of y over monotonic x at query point xq, clamped to the table endpoints. x may be increasing or decreasing.
MicroscopeControl.HardwareImplementations.LCC1620Attenuator.voltage_to_transmission — Method
voltage_to_transmission(attenuator::LCC1620, voltage::Float64)Look up the transmission for a given drive voltage from the calibration table. Returns NaN if no calibration is set.