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
Methods Summary
connect
(host, port)Connect to the monochromator controller's TCP/IP port.
Disconnect from the monochromator controller's TCP/IP port.
Get current entrance slit position.
Get current exit slit position.
Get current grating.
Get controller status.
Get current wavelength.
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 get_status() Status ¶
Get controller status.
- Returns:
- statusMonochromatorStatus
- 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.