hardware_interfaces.thorlabs_mc2000 module

class ChopperController(port: str, name: str = 'Chopper')[source]

Bases: object

Initializes a serial connection with the chopper controller.

For completeness, this class contains all commands which are provided in the MC2000B Manual.

Parameters
  • port (str) – COM port to which the controller is connected. Please check in the device manager of your operating system.

  • name (str, optional) – Name / Identifier to give to this controller. This is relevant for log statements, especially when there is more than one motor in the setup. Defaults to “Chopper”.

name

Name / Identifier to give to this controller. This is relevant for log statements, especially when there is more than one motor in the setup. Defaults to “Chopper”.

Type

str, optional

ser

Pyserial object which initiates the communication with the Counter.

Type

serial.Serial

blade_type

Identifier of the blade that the chopper thinks is installed

Type

str

frequency

Frequency of chopper in Hz

Type

str

harmonic_divider

Divides the incoming frequency by the which is set via the harmonic divider.

Type

str

phase

Chopper phase in degrees.

Type

str

References

end()[source]
get_blade_type()[source]

Return the blade type (see section 6.4 and 8.2 for more details).

Returns: bytes: Answer to sent command. Typically consists of

command and value.

get_commands()[source]

List the available commands.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_display_intensity()[source]

Returns the Display Intensity.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_enable()[source]

Get Enable.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_frequency()[source]

Returns the internal reference frequency.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_harmonic_divider()[source]

Returns the Harmonic Divider.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_harmonic_multiplier()[source]

Returns the Harmonic Multiplier.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_identification()[source]

Returns the model number and firmware version.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_on_cycle()[source]

Get On Cycle. #! might not work for MC-2000

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_phase()[source]

Returns the Phase adjust.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_ref_out_frequency()[source]

Returns the reference output frequency.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_ref_output()[source]

Returns the output reference mode.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_reference()[source]

Returns the reference mode.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_reference_frequency()[source]

Returns the current supplied external reference frequency.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

get_verbose()[source]

Returns the verbose mode.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

parse_data(command: str, readout: bytes)[source]

Extracts the information from the bytes that is returned from the chopper.

Parameters
  • command (str) – Command that was sent to controller.

  • readout (bytes) – Bytecode that controller returned after sending command.

Returns

Relevant information

Return type

str

read()[source]

Reads out the controllers answer to a sent command.

The byte object is not transformed into a string because problems due to invisible characters arise. It is easy to understands what the controller returns by seeing the command and the value.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

restore()[source]

Restore the factory default parameters.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

send_command(input_command: str)[source]

Creates necessary ascii format of the command which will be send to the controller

Parameters

input_command (str) – Command which should be send to the controller

Returns

Command which is send to card. In ascii format.

Return type

str

set_blade_type(value: int)[source]

Set the blade type (value is number indicated in section 8.2. For explanation look in section 6.4).

  • MC1F2 = 0

  • MC1F10 = 1

  • MC1F15 = 2

  • MC1F30 = 3

  • MC1F60 = 4

  • MC1F100 = 5

  • MC1F10HP = 6

  • MC1F2P10 = 7

  • MC1F6P10 = 8

  • MC1F10A = 9

  • MC2F330 = 10

  • MC2F47 = 11

  • MC2F57B = 12

  • MC2F860 = 13

  • MC2F5360 = 14

Parameters

value (int) – Number which defines the blade type.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_display_intensity(value: int)[source]

Set the Display Intensity (1-10).

Parameters

value (int) – Display intensity (1-10)

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_enable(value: int)[source]

Set Enable (0=disabled, 1=enabled).

Parameters

value (int) – (0=disabled, 1=enabled).

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_frequency(value: int)[source]

Set the desired internal reference frequency.

Parameters

value (int) – Frequency in Herz (Hz).

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_harmonic_divider(value: int)[source]

Set the Harmonic Divider applied to external reference frequency (1-15).

Parameters

value (float) – 1-15.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_harmonic_multiplier(value: int)[source]

Set Harmonic Multiplier applied to external reference frequency (1-15).

Parameters

value (int) – 1-15.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_on_cycle(value: int)[source]

Set On Cycle (1-50%). #! might not work for MC-2000

Parameters

value (int) – Duty cycle 1-50%

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_phase(value: int)[source]

Set the Phase adjust (0-360°).

Parameters

value (int) – Phase in degrees (0-360°).

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_ref_output(value: int)[source]

Set the output reference mode (See blade dependent reference output 8.4)

Parameters

value (int) – Blade Dependent Reference Output.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_reference(value: int)[source]

Set the reference mode (See blade dependent reference input 8.3)

Parameters

value (int) – Blade Dependent Reference Input.

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes

set_verbose(value: int)[source]

When verbose mode is set to 1, status messages are output on the USB.

Parameters

value (int) – Display intensity (1-10)

Returns

Answer to sent command. Typically consists of command

and value.

Return type

bytes