The CameraMan Class

class CameraMan.CameraMan.CameraMan(device_mode=False, noSVE=None, **extra_args)

Bases: DOSlib.application.Application

Camera Manager acts as fanout between the OCS/observer and a set of DESI cameras (CI, FOCUS, GUIDE, SKYCAMERA) It runs the exposure loop and collects and builds images

commands = ['configure', 'get', 'set', 'send_camera_cmd', 'send_fiducials_cmd', 'expose', 'built_callback', 'prepare_for_exposure', 'start_sequence', 'stop_sequence', 'finalize_exposure', 'archive_exposure', 'take_exposure', 'start_loop', 'stop_loop', 'accept_image', 'clear_image', 'send_image', 'get_image', 'write_image', 'update_wcs']

PML accessible commands

defaults = {'alarm_email': False, 'alarm_logbook': False, 'associated_ibs': None, 'cameras': 'auto', 'compress': False, 'constants_version': 'DEFAULT', 'device_mode': False, 'exposure_frequency': 0.1, 'fiducials_control': False, 'fiducials_controller': 'simulator', 'fiducials_defaults': None, 'fiducials_device': None, 'fiducials_ids': None, 'local_copy': False, 'mode': None, 'seek_service': 'CameraControl', 'seek_timeout': 5.0, 'use_ib': True}

Default configuration paramters

init()

The init function for the CameraMan application. It waits until all requested cameras have been found or a timeout occurs.

configure(*a, **kw)

Configure the CameraMan application First argument in args list must be constants version

prepare_for_exposure(expid, flavor=None, **options)

Prepare participating cameras for the next exposure Arguments

expid Exposure number (int, required)
Can be set to next in test/debug mode

flavor Exposure type (zero, dark etc) (required)

Optional

cameras List of participating cameras exptime Exposure time in seconds details A dictionary with additional exposure info (for example tel_ra, tel_dec for the CI WCS) Simulation mode only: fixed_positions If true, simulated positions of stars in roi list (if given) vary around

roi_list position

fixed_positions_deviation Mean jitter (in pixels (before binning)) if fixed_positions is True

If expid already exists in Exposures() the next frame is prepared

expose(expid, **options)

Instruct participating cameras to expose Send an expose command to the cameras The cameras generate header information and store it together with image data in the exposures structure Optionally, the data can be written by the cameras to local FITS files Prepare for exposure must have been called before calling expose The exposure time must be given in options if not previously set by prepare_for_exposure() To simplifly the work flow, if the exposures structure indicates that this exposure is in use but that the new frame has not been prepared, prepare_for_exposure is called. exptime and flavor are taken from the last frame that was taken for this exposure id. expose() will use the frame indicated by the prepare_for dictionay in self.exposures[expid] dictionaries on the cameras

Positional arguments
expid exposure number (required, int or ‘next’)
Named arguments):

cameras List of participating cameras use_ib Trigger the associated Image Builder to collect the data

The complete options dictionary will be forwarded to the trigger_ib function
Named arguments (forwarded to the cameras):

local_copy write a local copy in FITS format if True mem_purge delete old image data in memory file_purge delete old image data on disk if local_copy is true send_to pml proxy or pml interface/command tuples (or a list of these)

command: function to be called on receiver If not given or set to None, the image data is not sent

send_command Command to be used when sending image (send_to and send_command are both required) extra_headers Dictionary with extra header keywords/values that will be added to the image header bias_subtract Subtract bias frame for local_copy or send option dark_subtract Subtract dark frame for local_copy or send option exptime Exposure time in seconds (overwrites prepare_for_exposure value) flavor Exposure type (overwrites prepare_for_exposure value) compress Save images rice-compressed

Options for IB
ib_compress ib_local_copy ib_send_to ib_extras ib_guidestars
trigger_ib(expid, frame, **ib_args)

Trigger associated IBs to collect image data ib_args is a dictionary with these keys: exp_info, local_copy, send_to, sources, extras

built_callback(*args, **kwargs)

Image builder callback

archive_exposure(expid)

Instruct IB to archive exposure

finalize_exposure(expid)

Instruct IB to finalize exposure

take_exposure(expid, frame=None, exptime=None, flavor=None, **options)

take a single exposure - same as start_loop with count == 1

start_loop(expid, frame=None, exptime=None, flavor=None, **options)

Start exposure loop. This is meant to run for one exposure (multiple frames). stop_loop will be called when the exposure is complete and _exploop is restarted for the next exposure via a call to start_loop Arguments: expid = exposure id (required) frame = starting frame number (if next, the next available frame will be used) exptime = exposure time in seconds flavor = (camera) exposure type

Options arguments (passed in options) cameras = list of participating cameras count = Number of exposures (frames) to be taken frequency = to set the speed of the exposure loop local_copy = controls if local copy is written by cameras compress = local images are rice-compressed if True add_on = addition to image filename add_frame = force/suppress frame number in filename extra_headers = extra fits header keywords for cameras send_to = passed to cameras to send image to a list of receives send_command = passed to cameras to be used with send_to use_ib = call one of the associated IBs when the image is exposed ib_local_copy, ib_extras, ib_send_to, ib_compress = updated instructions for the IB archive = trigger IB to archive exposure when count expires archive_compress = write archive rice-compressed if True

stop_loop(*args, **kwargs)

Stop exposure loop Optional arguments: archive True/False -> instruct IB to archive current loop exposure compress True/False -> save archive rice-compressed

start_sequence(*args, **kwargs)

Instruct participating cameras to start sequence

stop_sequence(*args, **kwargs)

Instruct participating cameras to stop sequence

clear_image(*args, **kwargs)

Instruct participating cameras to clear selected images

get_image(*args, **kwargs)

Instruct participating cameras to get image

send_image(*args, **kwargs)

Instruct participating cameras to send image

write_image(*args, **kwargs)

Instruct participating cameras to write_image

update_wcs(wcs_dict)

update WCS for participating cameras wcs_dict is a dictionary of dictionaries with the camera’s unit as key (== GFA_LOC for DESI)

get(parameter, *arguments, **options)
returns current value of parameter
myURI cameras participating_cameras seek_timeout seek_service times device_mode alarm_email alarm_logbook looping, information, status,connected, OCSMessage, use_ib, ibs, ib_instructions, frequency, mode last_expid last_frame current_expid current_frame, send_to, send_command, interlock (parameter = (list, monitored, enabled, is_set, broken, name), cond = Name of condition (== SV name)), monitor (status, list, undiscovered, disconnected, monitored), device/role with option: key = field, fiducials control variables (fiducials_control, fiducials_ids, fiducials_defaults)
set(**kwargs)

set a parameter value The cameras keyword is used to set participating_cameras to set the default list of cameras to participate in calls Other options:

myURI seek_timeout seek_service times device_mode alarm_email alarm_logbook, frquency use_ib, add_IB, remove_ib, ib_add_send_to, ib_remove_send_to, ib_local_copy, send_to, send_command, (last_expid last_frame current_expid current_frame for debugging only) fiducials_defaults = single value or listwith a value per fiducial to set the default duty cycle (brightness)
accept_image(*args, **kwargs)
send_fiducials_cmd(cmd, *args, **kwargs)

execute a fiducials control command

send_camera_cmd(command, *args, cameras=None, **kwargs)

execute command for all connected cameras

main()
about_to_connect_to_instance(*args, **kwargs)

To be overridden by the user so that any actions can be taken when the device application is about to connect to an instance

did_connect_to_instance(*args, **kwargs)

To be overridden by the user so that any actions can be taken when the device application connects to an instance

about_to_disconnect_from_instance(*args, **kwargs)

To be overridden by the user so that any actions can be taken when the device application is about to disconnect from an instance

did_disconnect_from_instance(*args, **kwargs)

To be overridden by the user so that any actions can be taken when the device application disconnects from an instance