LCC25 (thorlabs) driver

This controller supplies one class with several functions to communicate with the thorlabs LCC25 liquid crystal controller.

Note that this controller also implements units.

copyright:2020by Hyperion Authors, see AUTHORS for more details.
license:BSD, see LICENSE for more details.
class hyperion.controller.thorlabs.lcc25.Lcc(settings)

This class is to controls the LCC25 thorlabs driver for a liquid crystal variable waveplate.

finalize()

Closes the connection to the device

freq

Modulation frequency when the operation mode is ‘modulation’ (mode = 0)

: getter : Asks for the current frequency

Returns:The frequency value
Return type:pint quantity

: setter :

Parameters:F (pint Quantity) – frequency in Hz. It can be any value between 0.5 and 150Hz.
get_commands()

Gives a list of all the commands available :return: list with the commands available :rtype: str

get_voltage(Ch=1)

Gets the voltage value for VoltageCh where Ch = 1 or 2 for Voltage1 or Voltage2

Parameters:Ch (int) – The channel to use, can be 1 or 2
Returns:The method returns the voltage value present in the device in volts.
Return type:pint quantity
idn()

Gets the identification for the device

Returns:answer
Return type:string
initialize()

Initialize the device

mode
Operation mode
The possible modes are:
1 = ‘Voltage1’ : sends a 2kHz sin wave with RMS value set by voltage 1
2 = ‘Voltage2’ : sends a 2kHz sin wave with RMS value set by voltage 2
0 = ‘Modulation’: sends a 2kHz sin wave modulated with a square wave where voltage 1 is one limit and voltage 2 is the second.
The modulation frequency can be changed with the command ‘freq’ in the 0.5-150 Hz range.

: getter : Gets the current mode : setter : Sets the mode

Parameters:mode (int) – type of operation.
output

Tells if the output is enabled or not.

Getter:
Returns:output state
Return type:logical
Setter:
Parameters:state (logical) – value for the amplitude to set in Volts
query(message)

Writes in the buffer and Reads the response.

Parameters:message (str) – command to send to the device
Returns:response from the device
Return type:str
read()

Reads message from the device

Returns:answer from the device (one line)
Type:str
read_serial_buffer_in()
Reads everything the device has sent. By default it waits until a line is terminated by a termination character (

or

), but that check can

be disabled using the input parameter.

param untill_at_least_one_termination_char:
 defaults to True
type untill_at_least_one_termination_char:
 bool
return:complete serial buffer from the device
rtype:bytes
set_voltage(Ch, V)

Sets the voltage value for Ch where Ch = 1 or 2 for Voltage1 or Voltage2

Parameters:
  • Ch (int) – channel to use (default =1)
  • V (pint quantity) – voltage to set in Volts
write(message)

Sends the message to the device.

Parameters:message (string) – the message to write into the device buffer
class hyperion.controller.thorlabs.lcc25.LccDummy(settings)

This is the dummy controller for the LCC25. The idea is to load this class instead of the real one to do testing of higher level functions without the need of the real device to be connected or working.

The logic is that this dummy device will respond as the real device would, with the correct type and size of information is expected.

This class inherits from the real device and the idea is to re-write only the init, the write and the read, so all the other functions remain the same and functioning.

The specific way to achieve this will be different for every device, so it has to be done separately.

To do so, we use a yaml file that tells the dummy class what are the properties of the device. For example, one property for the LCC25 is voltage1, which is the voltage for channel 1. Then from this you can build 2 commands: voltage1? to ask what is the value and voltage1=1 to set it to the value 1. So we build a command list using the CHAR ? and = for each of this properties.

Parameters:
  • port (str) – fake port name
  • dummy (logical) – indicates the dummy mode. keept for compatibility
load_properties()

This method loads a yaml file with a dictionary with the available properties for the LCC25 and some defaults values. This dictionary is saved in properties and will be modified when a variable is writen, so the dummy device will respond with the previously set value.

query(message)

Writes in the buffer and Reads the response.

Parameters:message (str) – command to send to the device
Returns:response from the device
Return type:str
read()

Dummy read. Reads the response buffer

write(msg)

Dummy write. It will compare the msg with the COMMANDS

Parameters:msg (str) – Message to write