CBPComponent

class lsst.ts.cbp.CBPComponent(csc)

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.

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:
csc : CBPCSC
log : logging.Logger
reader : asyncio.StreamReader or None
writer : asyncio.StreamWriter or None
lock : asyncio.Lock
timeout : int
long_timeout : int
host : str
port : int
connected : bool
error_tolerance : float

Attributes Summary

auto_parked Return autoparked value.
azimuth Return azimuth value.
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) 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.

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:
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.

change_focus(position: int)

Change focus.

Parameters:
position : int

The value of the new focus (microns).

Raises:
ValueError

Raised when the new value falls outside the accepted range.

check_cbp_status()

Read and record the status of the encoders.

check_park()

Get the park variable from CBP.

configure(config)

Configure the CBP.

Parameters:
config : types.SimpleNamespace
connect()

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

disconnect()

Disconnect from the tcp socket.

Safe to call even if already disconnected.

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.

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

get_focus()

Get the focus value.

get_mask()

Get mask and mask rotation value.

move_azimuth(position: float)

Move the azimuth encoder.

Parameters:
position : float

The desired azimuth (degrees).

Raises:
ValueError

Raised when the new value falls outside the accepted range.

move_elevation(position: float)

Move the elevation encoder.

Parameters:
position : float

The desired elevation (degrees)

Raises:
ValueError

Raised when the new value falls outside the accepted range.

send_command(msg)

Send the encoded command and read the reply.

Parameters:
msg : str

The string command to be sent.

Returns:
reply : str

The reply to the command sent.

set_mask(mask: str)

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.

set_mask_rotation(mask_rotation: float)

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.

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.

Returns:
did_change : bool

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

update_status()

Update the status.