Model

class lsst.ts.atmonochromator.Model(log: Logger)

Bases: object

A model class to represent the connection to the Monochromator. It implements all the available commands from the hardware and ways to select a configuration, connect to the Monochromator and so on.

Attributes Summary

connected

Methods Summary

connect(host, port)

Connect to the monochromator controller's TCP/IP port.

disconnect()

Disconnect from the monochromator controller's TCP/IP port.

get_entrance_slit()

Get current entrance slit position.

get_exit_slit()

Get current exit slit position.

get_grating()

Get current grating.

get_status()

Get controller status.

get_wavelength()

Get current wavelength.

reset_controller()

Reset controller.

send_cmd(cmd[, timeout])

Send a command to the controller and wait for the reply.

set_all(wavelength, grating, entrance_slit, ...)

Set all values at the same time.

set_calibrate_wavelength(wavelength)

Calibrate wavelength.

set_entrance_slit(value)

Set current entrance slit size.

set_exit_slit(value)

Set current exit slit size.

set_grating(value)

Set current grating.

set_wavelength(value)

Set current wavelength.

wait_ready(cmd)

Wait until controller is ready.

Attributes Documentation

connected

Methods Documentation

async connect(host: str, port: str) None

Connect to the monochromator controller’s TCP/IP port.

async disconnect() None

Disconnect from the monochromator controller’s TCP/IP port.

async get_entrance_slit() float

Get current entrance slit position.

Returns:
ensfloat

In mm

async get_exit_slit() float

Get current exit slit position.

Returns:
exsfloat

In mm

async get_grating() int

Get current grating.

Returns:
gratingint
async get_status() Status

Get controller status.

Returns:
statusMonochromatorStatus
async get_wavelength() float

Get current wavelength.

Returns:
wavelengthfloat

In nm.

async reset_controller() ModelReply

Reset controller.

Returns:
replyModelReply
async send_cmd(cmd: str, timeout: float = 2.0) str

Send a command to the controller and wait for the reply.

Return the decoded reply as 0 or more lines of text with the final “>” stripped.

Parameters:
cmdstr

Command to send to the controller.

timeoutfloat

Timeout for the command being executed (in seconds).

Returns:
replystr

Response from controller.

async set_all(wavelength: float, grating: int, entrance_slit: float, exit_slit: float) ModelReply

Set all values at the same time.

Parameters:
wavelengthfloat

In nm.

gratingint

Grating index

entrance_slitfloat

In mm.

exit_slitfloat

In mm.

Returns:
replyModelReply
async set_calibrate_wavelength(wavelength: float) ModelReply

Calibrate wavelength.

Will make the current wavelength match the passed value.

Parameters:
wavelengthfloat
Returns:
replyModelReply
async set_entrance_slit(value: float) ModelReply

Set current entrance slit size.

Parameters:
valuefloat

Size in mm.

Returns:
replyModelReply
async set_exit_slit(value: float) ModelReply

Set current exit slit size.

Parameters:
valuefloat

Size in mm.

Returns:
replyModelReply
async set_grating(value: int) ModelReply

Set current grating.

Parameters:
valueint

Grating index.

Returns:
replyModelReply
async set_wavelength(value: float) ModelReply

Set current wavelength.

Parameters:
valuefloat

Wavelength in nm.

Returns:
replyModelReply
async wait_ready(cmd: str) bool

Wait until controller is ready.

Parameters:
cmdstr

Name of the command being waited on. This is used mostly for logging/reporting purposes.

Returns:
bool

Returns True when the status is ready.

Raises:
TimeoutError

If monochromator status does not transition to READY in the specified timeout.

RuntimeError

If monochromator controller status is FAULT or OFFLINE.