CBPComponent

class lsst.ts.cbp.CBPComponent(csc, log=None)

Bases: object

This class is for implementing the CBP component.

The component implements a python wrapper over DMC code written by DFM Manufacturing. The following API exposes commands that move the motors of the CBP, sets the focus and selects the mask.

Parameters:
cscCBPCSC

The running CSC for the CBP.

logNone or logging.Logger

Optionally, the DDS logger can be passed to this class to publish log messages over DDS.

Attributes:
cscCBPCSC
loglogging.Logger
readerasyncio.StreamReader or None
writerasyncio.StreamWriter or None
lockasyncio.Lock
timeoutint
long_timeoutint
hoststr
portint
connectedbool
error_tolerancefloat
focus_crosstalkfloat

Notes

The class uses the python socket module to build TCP/IP connections to the Galil controller for the CBP. The underlying API is built on DMC.

Attributes Summary

auto_parked

Return autoparked value.

azimuth

Return azimuth value.

connected

elevation

Return elevation value.

focus

Return focus value.

in_position

Return inPosition event data.

mask

Return mask value.

mask_rotation

Return mask rotation value.

parked

Return parked value.

status

Return status telemetry data.

target

Return target event data.

Methods Summary

assert_in_range(name, value, min_value, ...)

Raise ValueError if a value is out of range.

change_focus(position)

Change focus.

check_cbp_status()

Read and record the status of the encoders.

check_park()

Get the park variable from CBP.

configure(config)

Configure the CBP.

connect()

Create a socket and connect to the CBP's static address and designated port.

disconnect()

Disconnect from the tcp socket.

generate_mask_info()

Generate initial mask info.

get_azimuth()

Get the azimuth value.

get_cbp_telemetry()

Get the position data of the CBP.

get_elevation()

Read and record the mount elevation encoder, in degrees.

get_focus()

Get the focus value.

get_mask()

Get mask and mask rotation value.

move_azimuth(position)

Move the azimuth encoder.

move_elevation(position)

Move the elevation encoder.

send_command(msg[, log, await_reply, ...])

Send the encoded command and read the reply.

set_mask(mask)

Set the mask value

set_mask_rotation(mask_rotation)

Set the mask rotation

set_park()

Park the CBP.

set_unpark()

Unpark the CBP.

update_in_position()

Update the in position status of each actuator, based on the most recently read encoder data.

update_status()

Update the status.

Attributes Documentation

auto_parked

Return autoparked value.

azimuth

Return azimuth value.

connected
elevation

Return elevation value.

focus

Return focus value.

in_position

Return inPosition event data.

mask

Return mask value.

mask_rotation

Return mask rotation value.

parked

Return parked value.

status

Return status telemetry data.

target

Return target event data.

Methods Documentation

assert_in_range(name, value, min_value, max_value)

Raise ValueError if a value is out of range.

Parameters:
namestr

The name of the parameter.

valuefloat

The received value.

min_valuefloat

The minimum accepted value.

max_valuefloat

The maximum accepted value.

Raises:
ValueError

Raised when a value is outside of the given range.

async change_focus(position: int)

Change focus.

Parameters:
positionint

The value of the new focus (microns).

Raises:
ValueError

Raised when the new value falls outside the accepted range.

async check_cbp_status()

Read and record the status of the encoders.

async check_park()

Get the park variable from CBP.

configure(config)

Configure the CBP.

Parameters:
configtypes.SimpleNamespace
async connect()

Create a socket and connect to the CBP’s static address and designated port.

async disconnect()

Disconnect from the tcp socket.

Safe to call even if already disconnected.

generate_mask_info()

Generate initial mask info.

async get_azimuth()

Get the azimuth value.

async get_cbp_telemetry()

Get the position data of the CBP.

async get_elevation()

Read and record the mount elevation encoder, in degrees.

Note that the low-level controller calls this axis “altitude”.

async get_focus()

Get the focus value.

async get_mask()

Get mask and mask rotation value.

async move_azimuth(position: float)

Move the azimuth encoder.

Parameters:
positionfloat

The desired azimuth (degrees).

Raises:
ValueError

Raised when the new value falls outside the accepted range.

async move_elevation(position: float)

Move the elevation encoder.

Parameters:
positionfloat

The desired elevation (degrees)

Raises:
ValueError

Raised when the new value falls outside the accepted range.

async send_command(msg, log=True, await_reply=True, await_terminator=True)

Send the encoded command and read the reply.

Parameters:
msgstr

The string command to be sent.

logbool

Call with False to suppress log messages. Useful for debugging purposes to limit output.

await_replybool

If false, don’t wait for reply else wait for reply.

await_terminatorbool

If false, reply has no terminator else reply has expected terminator.

Returns:
replystr

The reply to the command sent.

async set_mask(mask: str)

Set the mask value

Parameters:
maskstr

This is the name of the mask which is converted to an int using a dictionary.

Raises:
KeyError

Raised when new mask is not a key in the dictionary.

async set_mask_rotation(mask_rotation: float)

Set the mask rotation

Parameters:
mask_rotationfloat

The mask_rotation value that will be sent.

Raises:
ValueError

Raised when the new value falls outside the accepted range.

async set_park()

Park the CBP.

async set_unpark()

Unpark the CBP.

async update_in_position()

Update the in position status of each actuator, based on the most recently read encoder data.

Returns:
did_changebool

True if anything changed (and so the event was published)

async update_status()

Update the status.