Model

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

Bases: object

ATSpectrogropah Model Class.

This class implements an interface with the ATSpectrograph controller.

Parameters:
loglogging.Logger

Parent logger.

Attributes Summary

connected

reader

writer

Methods Summary

check_return(value)

A utility method to check the return value of a command and return.

connect()

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

disconnect()

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

init_fw([want_connection])

Initialize/home filter wheel

init_gs([want_connection])

initialize grating stage to negative limit/home.

init_gw([want_connection])

initialize/home grating wheel.

load_program_configuration_from(filename[, ...])

Load configuration from file.

move_fw(pos[, want_connection])

move filter wheel to position # (0-3)

move_gs(pos[, want_connection])

move grating stage to # (mm from home position)

move_gw(pos[, want_connection])

move grating wheel to position # (0-3)

query_fw_status([want_connection])

Query status of the filter wheel.

query_fw_step_position([want_connection])

Query filter wheel step position.

query_gs_limit_switches([want_connection])

Query grating stage limit switches.

query_gs_status([want_connection])

Query status of the Grating Linear Stage.

query_gw_status([want_connection])

Query status of the Grating Wheel.

query_gw_step_position([want_connection])

Query grating wheel step position.

reset_reader_writer()

Reset reader and writer.

run_command(cmd[, want_connection])

Send a command to the TCP/IP controller and process its replies.

stop_all_motion([want_connection])

Send command to stop all motions.

Attributes Documentation

connected
reader
writer

Methods Documentation

static check_return(value: str) str

A utility method to check the return value of a command and return.

Parameters:
valuestr

Value to check.

Returns:
str
async connect() None

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

async disconnect() None

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

async init_fw(want_connection: bool = False) str

Initialize/home filter wheel

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
str
async init_gs(want_connection: bool = False) str

initialize grating stage to negative limit/home.

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
str
async init_gw(want_connection: bool = False) str

initialize/home grating wheel.

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be pened in case it is closed.

Returns:
str
async load_program_configuration_from(filename: str, want_connection: bool = False) str

Load configuration from file.

Parameters:
filenamestr

Name of file to load configuration from.

want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
ret_valstr

Response from controller.

Raises:
RuntimeError
async move_fw(pos: int, want_connection: bool = False) str

move filter wheel to position # (0-3)

Parameters:
posint

Filter id (0-3).

want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
str
async move_gs(pos: float, want_connection: bool = False) str

move grating stage to # (mm from home position)

Parameters:
posfloat

Position from home (in mm).

want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
str
async move_gw(pos: int, want_connection: bool = False) str

move grating wheel to position # (0-3)

Parameters:
posint

Grating id (0-3)

want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
str
async query_fw_status(want_connection: bool = False) Tuple[Enum, Any, Enum]

Query status of the filter wheel.

statusstr

I – initializing/homing, M – moving, S – stationary/not moving

positionint

current filter wheel position (0-3)

errorstr

N - none, B - busy, I - not initialized, T - move timed out

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
tuple

(status, position, error)

async query_fw_step_position(want_connection: bool = False) Tuple[Enum, Any]

Query filter wheel step position.

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
statustuple

(status, position)

async query_gs_limit_switches(want_connection: bool = False) int

Query grating stage limit switches.

Returned status:

0 not at a limit, + at the positive limit, - at the negative limit/home

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
int

-1, 0 or +1

async query_gs_status(want_connection: bool = False) Tuple[Enum, Any, Enum]

Query status of the Grating Linear Stage.

statusstr

I – initializing/homing, M – moving, S – stationary/not moving

positionint

current motor step position

errorstr

N - none, B - busy, I - not initialized, T - move timed out

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
statustuple

(status, position, error)

async query_gw_status(want_connection: bool = False) Tuple[Enum, Any, Enum]

Query status of the Grating Wheel.

statusstr

I – initializing/homing, M – moving, S – stationary/not moving

positionint

current grating position (0-3)

errorstr

N - none, B - busy, I - not initialized, T - move timed out

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
statustuple

(status, position, error)

async query_gw_step_position(want_connection: bool = False) Tuple[Enum, Any]

Query grating wheel step position.

Parameters:
want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.

Returns:
statustuple

(status, position)

reset_reader_writer() None

Reset reader and writer.

async run_command(cmd: str, want_connection: bool = False) str

Send a command to the TCP/IP controller and process its replies.

Parameters:
cmdstr

The command to send, e.g. “5.0 MV”, “SO” or “?”.

want_connectionbool

Flag to specify if a connection is to be requested in case it is not connected.

Returns:
read_bytesstr

Response from controller.

async stop_all_motion(want_connection: bool = False) str

Send command to stop all motions.

Returns:
ret_valstr

Response from controller.

want_connectionbool

Boolean to specify if a connection with the controller is to be opened in case it is closed.