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:
  • csc (CBPCSC) – The running CSC for the CBP.

  • log (None or logging.Logger) – Optionally, the DDS logger can be passed to this class to publish log messages over DDS.

csc#
Type:

CBPCSC

log#
Type:

logging.Logger

reader#
Type:

asyncio.StreamReader or None

writer#
Type:

asyncio.StreamWriter or None

lock#
Type:

asyncio.Lock

timeout#
Type:

int

long_timeout#
Type:

int

host#
Type:

str

port#
Type:

int

connected#
Type:

bool

error_tolerance#
Type:

float

focus_crosstalk#
Type:

float

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.

should_be_connected

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.

should_be_connected#
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:
  • name (str) – The name of the parameter.

  • value (float) – The received value.

  • min_value (float) – The minimum accepted value.

  • max_value (float) – The maximum accepted value.

Raises:

ValueError – Raised when a value is outside of the given range.

async change_focus(position)#

Change focus.

Parameters:

position (int) – 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:

config (types.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)#

Move the azimuth encoder.

Parameters:

position (float) – The desired azimuth (degrees).

Raises:

ValueError – Raised when the new value falls outside the accepted range.

async move_elevation(position)#

Move the elevation encoder.

Parameters:

position (float) – 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:
  • msg (str) – The string command to be sent.

  • log (bool) – Call with False to suppress log messages. Useful for debugging purposes to limit output.

  • await_reply (bool) – If false, don’t wait for reply else wait for reply.

  • await_terminator (bool) – If false, reply has no terminator else reply has expected terminator.

Returns:

reply – The reply to the command sent.

Return type:

str

async set_mask(mask)#

Set the mask value

Parameters:

mask (str) – 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)#

Set the mask rotation

Parameters:

mask_rotation (float) – 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_change – True if anything changed (and so the event was published)

Return type:

bool

async update_status()#

Update the status.