The Guider Class

guider.py

This is the DESI Guider application.

This application contains all guiding algorithm functionalities.

The configuration variable controller_type selects between these options.

The following commands are implmented:

configure to configure the application and the controller get to read status and configuration information set to update select variables at run time

TBD

Several shared variables published by this application:
STATUS reflects the application’s status

Version History 01/06/2016 SS Initial prototype 07/18/2016 KH DOS integration, Python3 08/30/2006 SS/KH New interface structure, align algorithm fixes, condition SV

class Guider.guider.Guider(device_mode=False, noSVE=None, **extra_args)
init()

Initialization code for the guider class. Default constants and runtime variables are initialized.

monitor_callback(state)

Callback function for component monitor.

configure(*args, **kwargs)

Configure guider application

prepare_for_exposure(expid, **options)

Called at the start of an exposure (but not for every frame)

get(what)

return runtime and configuration variable

set(**kwargs)

Set parameters dynamically. Options include:

Public command to request the guider to analyze a full GFA image to select the best guide star positions Allowed if guider is any state but ERROR, INITIALIZED :param image_set: List of ROI images in DOS image format. :return: Ordered list of best guide star positions [(x1, y1), (x2, y2),… ]

start_alignment(gfa_list)

Public command to request the guider to initialize the alignment process.

Parameters:gfa_list – Dictionary of GFA ROIs with x/y expected position of guide star

and target position where the guider needs to drift. Format should be like {‘GFAXX_ROIYY’:

{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,
‘x_target’: xx.xxx, ‘y_target’: yy.yyy},
‘GFAXX_ROIYY’:
{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,
‘x_target’: xx.xxx, ‘y_target’: yy.yyy},

…}

start_guiding(gfa_list=None)

Public command to request the guider to initialize the guiding process.

Parameters:gfa_list – Dictionary of GFA ROIs with x/y expected position of guide star.

This parameter is optional if alignment has already loaded this information. Format should be like {‘GFAnG_m’:

{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,
‘GFAnG_l’:
{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,

…}

Naming convention: n = GFA number, m = ROI index

next_image(image_set)

Public method to be called when a new guiding OR align image is available. It will process the image and return the correction to stay at the original expected position. It will also indicate whether the guider is active with guiding stars.

Parameters:image_set – List of ROI images in DOS image format.
Returns:centroid_dictionary, guide_status

centroid_dictionary contains ‘x’ and ‘y’ keywords. guide_status is True only when active guiding stars are tracked.

next_postage_stamps(stamps)

Public method to be called when a new guiding OR align postage stamps available. It will process the image and return the correction to stay at the original expected position. It will also indicate whether the guider is active with guiding stars.

Parameters:image_set – List of ROI images in DOS image format.
Returns:centroid_dictionary, guide_status

centroid_dictionary contains ‘x’ and ‘y’ keywords. guide_status is True only when active guiding stars are tracked.

stop(what=None)

Public method to stop the guider or alignment process and set the guider back to READY status.

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

main()

Main routine of the Guider Application. Wait for shutdown flag. No telemetry loop

class Guider.guider.Guider(device_mode=False, noSVE=None, **extra_args)
init()

Initialization code for the guider class. Default constants and runtime variables are initialized.

monitor_callback(state)

Callback function for component monitor.

configure(*args, **kwargs)

Configure guider application

prepare_for_exposure(expid, **options)

Called at the start of an exposure (but not for every frame)

get(what)

return runtime and configuration variable

set(**kwargs)

Set parameters dynamically. Options include:

self_search(image_set)

Public command to request the guider to analyze a full GFA image to select the best guide star positions Allowed if guider is any state but ERROR, INITIALIZED :param image_set: List of ROI images in DOS image format. :return: Ordered list of best guide star positions [(x1, y1), (x2, y2),… ]

start_alignment(gfa_list)

Public command to request the guider to initialize the alignment process.

Parameters:gfa_list – Dictionary of GFA ROIs with x/y expected position of guide star

and target position where the guider needs to drift. Format should be like {‘GFAXX_ROIYY’:

{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,
‘x_target’: xx.xxx, ‘y_target’: yy.yyy},
‘GFAXX_ROIYY’:
{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,
‘x_target’: xx.xxx, ‘y_target’: yy.yyy},

…}

start_guiding(gfa_list=None)

Public command to request the guider to initialize the guiding process.

Parameters:gfa_list – Dictionary of GFA ROIs with x/y expected position of guide star.

This parameter is optional if alignment has already loaded this information. Format should be like {‘GFAnG_m’:

{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,
‘GFAnG_l’:
{‘x_expected’: xx.xxx, ‘y_expected’: yy.yyy,

…}

Naming convention: n = GFA number, m = ROI index

next_image(image_set)

Public method to be called when a new guiding OR align image is available. It will process the image and return the correction to stay at the original expected position. It will also indicate whether the guider is active with guiding stars.

Parameters:image_set – List of ROI images in DOS image format.
Returns:centroid_dictionary, guide_status

centroid_dictionary contains ‘x’ and ‘y’ keywords. guide_status is True only when active guiding stars are tracked.

next_postage_stamps(stamps)

Public method to be called when a new guiding OR align postage stamps available. It will process the image and return the correction to stay at the original expected position. It will also indicate whether the guider is active with guiding stars.

Parameters:image_set – List of ROI images in DOS image format.
Returns:centroid_dictionary, guide_status

centroid_dictionary contains ‘x’ and ‘y’ keywords. guide_status is True only when active guiding stars are tracked.

stop(what=None)

Public method to stop the guider or alignment process and set the guider back to READY status.

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

main()

Main routine of the Guider Application. Wait for shutdown flag. No telemetry loop