MockServer#

class lsst.ts.cbp.MockServer(log=None)#

Bases: OneClientReadLoopServer

Mocks the CBP server.

Parameters:

log (logging.Logger, optional)

host#
Type:

str

port#
Type:

int

timeout#
Type:

int

long_timeout#
Type:

int

azimuth#
Type:

float

altitude#
Type:

float

focus#
Type:

int

mask#
Type:

str

panic_status#
Type:

bool

encoders#
Type:

Encoders

park#
Type:

bool

auto_park#
Type:

bool

masks_rotation#
Type:

dict of str:float

commands#
Type:

tuple of re.Pattern:functools.partial

log#
Type:

logging.Logger

Methods Summary

cmd_loop()

Run the command loop.

do_aastat()

Return the azimuth encoder status.

do_abstat()

Return the altitude encoder status.

do_acstat()

Return the focus encoder status.

do_adstat()

Return the mask selection encoder status.

do_aestat()

Return the mask rotation encoder status.

do_altitude()

Return the altitude position.

do_autopark()

Return the autopark value.

do_azimuth()

Return azimuth position.

do_focus()

Return the focus value.

do_mask()

Return the mask value.

do_new_altitude(altitude)

Set the new altitude position.

do_new_azimuth(azimuth)

Set the new azimuth position.

do_new_focus(focus)

Set the new focus value.

do_new_mask(mask)

Set the new mask value.

do_new_rotation(rotation)

Set the new mask rotation value.

do_panic()

Return the panic status value.

do_park([park])

Park or unpark the CBP.

do_rotation()

Return the mask rotation value.

read_and_dispatch()

Read, parse, and dispatch one item of data.

set_circular_constrained_position(value, ...)

Set actuator to position that is silently constrained to bounds.

set_constrained_position(value, actuator)

Set actuator to position that is silently constrained to bounds.

Methods Documentation

async cmd_loop()#

Run the command loop.

Parameters:
async do_aastat()#

Return the azimuth encoder status.

Return type:

str

async do_abstat()#

Return the altitude encoder status.

Return type:

str

async do_acstat()#

Return the focus encoder status.

Return type:

str

async do_adstat()#

Return the mask selection encoder status.

Return type:

str

async do_aestat()#

Return the mask rotation encoder status.

Return type:

str

async do_altitude()#

Return the altitude position.

Return type:

str

async do_autopark()#

Return the autopark value.

Return type:

str

async do_azimuth()#

Return azimuth position.

Return type:

str

async do_focus()#

Return the focus value.

Return type:

str

async do_mask()#

Return the mask value.

Return type:

str

async do_new_altitude(altitude)#

Set the new altitude position.

Parameters:

altitude (float)

Return type:

str

async do_new_azimuth(azimuth)#

Set the new azimuth position.

Parameters:

azimuth (float)

Return type:

str

async do_new_focus(focus)#

Set the new focus value.

Parameters:

focus

Return type:

str

async do_new_mask(mask)#

Set the new mask value.

Parameters:

mask (str)

Return type:

str

async do_new_rotation(rotation)#

Set the new mask rotation value.

Parameters:

rotation (float)

Return type:

str

async do_panic()#

Return the panic status value.

Return type:

str

async do_park(park='?')#

Park or unpark the CBP.

Parameters:

park (int, optional)

Return type:

str

async do_rotation()#

Return the mask rotation value.

Return type:

str

async read_and_dispatch()#

Read, parse, and dispatch one item of data.

Subclasses need to implement this method such that it reads and parses data and then dispatches handling the data to a method suitable for the subclass. Methods that might be helpful include:

  • read_json to read json-encoded data

  • read_str to read terminated strings

  • read_into to read binary structs

set_circular_constrained_position(value, actuator)#

Set actuator to position that is silently constrained to bounds.

Parameters:
set_constrained_position(value, actuator)#

Set actuator to position that is silently constrained to bounds.

Parameters: