MockController

class lsst.ts.atmonochromator.MockController

Bases: object

Mock Monochromator low-level controller that talks over TCP/IP.

The Monochromator TCP Protocol is specified here: https://confluence.lsstcorp.org/display/LTS/Monochromator+TCP+Protocol

Attributes Summary

busy

entrance_slit_range

exit_slit_range

invalid

ok

our

rejected

wavelength_range

Methods Summary

cmd_loop(reader, writer)

Execute the server control loop.

get_ens(args)

Return parsed string with current entrance slit position.

get_exs(args)

Return parsed string with current exit slit position.

get_gr(args)

Return parsed string with current grating.

get_swst(args)

Query Software status

get_wl(args)

Return parsed string with current wavelength.

set_clw(args)

Calibrate the wavelength with the current value.

set_ens(args)

Select entrance slit width.

set_exs(args)

Select exit slit width.

set_gr(args)

Select grating.

set_rst(args)

Reset device and go to initial state.

set_set(args)

Set all parameters.

set_wl(args)

Set wavelength, range.

start()

Start the TCP/IP server, set start_task Done and start the command loop.

stop([timeout])

Stop the TCP/IP server.

Attributes Documentation

busy
entrance_slit_range
exit_slit_range
invalid
ok
our
rejected
wavelength_range

Methods Documentation

async cmd_loop(reader: StreamReader, writer: StreamWriter) None

Execute the server control loop.

Parameters:
readerasyncio.StreamReader

Server stream reader.

writerasyncio.StreamWrite

Server stream writer.

async get_ens(args: List[str]) str

Return parsed string with current entrance slit position.

Parameters:
args

Not used.

Returns:
retvalstr

A string consisting of “#WL {ens}

async get_exs(args: List[str]) str

Return parsed string with current exit slit position.

Parameters:
args

Not used.

Returns:
retvalstr

A string consisting of “#EXS {exs}

async get_gr(args: List[str]) str

Return parsed string with current grating.

Parameters:
args

Not used.

Returns:
retvalstr

A string consisting of “#WL {grating}

async get_swst(args: List[str]) str

Query Software status

Parameters:
args

Not used.

Returns:
retvalstr

A string consisting of “#SWST {status}

async get_wl(args: List[str]) str

Return parsed string with current wavelength.

Parameters:
args

Not used.

Returns:
retvalstr

A string consisting of “#WL {wavelength}”

async set_clw(args: List[str]) str

Calibrate the wavelength with the current value.

Set the value for wavelength offset.

Parameters:
argsstr

A string of number that can be converted to a float.

Returns:
resultstr
Response to the set command:

#OK - Accepted command #OUR - Out of range ?? - Invalid command #BUSY - Device busy executing another command #RJCT - Rejected

async set_ens(args: List[str]) str

Select entrance slit width.

Parameters:
argsstr

A string of number that can be converted to a float.

Returns:
resultstr
Response to the set command:

#OK - Accepted command #OUR - Out of range ?? - Invalid command #BUSY - Device busy executing another command #RJCT - Rejected

async set_exs(args: List[str]) str

Select exit slit width.

Parameters:
argsstr

A string of number that can be converted to a float.

Returns:
resultstr
Response to the set command:

#OK - Accepted command #OUR - Out of range ?? - Invalid command #BUSY - Device busy executing another command #RJCT - Rejected

async set_gr(args: List[str]) str

Select grating.

Parameters:
argsstr

A string of number that can be converted to an int.

Returns:
resultstr
Response to the set command:

#OK - Accepted command #OUR - Out of range ?? - Invalid command #BUSY - Device busy executing another command #RJCT - Rejected

async set_rst(args: List[str]) str

Reset device and go to initial state.

Parameters:
argsstr

A string of number that can be converted to an int. Must be equal to 1 or it will be rejected.

Returns:
resultstr
Response to the set command:

#OK - Accepted command #OUR - Out of range ?? - Invalid command #BUSY - Device busy executing another command #RJCT - Rejected

async set_set(args: List[str]) str

Set all parameters.

Parameters:
argslist(str)

A list with the following values:

  • wavelength, in nm

  • grating name

  • front entrance slit width, in mm

  • front exit slit width, im mm

Returns:
resultstr

Response to the set command; one of:

  • #OK - Accepted command

  • #OUR - Out of range

  • ?? - Invalid command

  • #BUSY - Device busy executing another command

  • #RJCT - Rejected

async set_wl(args: List[str]) str

Set wavelength, range.

Parameters:
argsstr

A string of number that can be converted to a float.

Returns:
resultstr
Response to the set command:

#OK - Accepted command #OUR - Out of range ?? - Invalid command #BUSY - Device busy executing another command #RJCT - Rejected

async start() None

Start the TCP/IP server, set start_task Done and start the command loop.

async stop(timeout: float = 5.0) None

Stop the TCP/IP server.