astra.action_configs

Contents

astra.action_configs#

Classes

AutofocusCalibrationFieldConfig(...)

Configuration for automated autofocus calibration field selection.

AutofocusConfig(exptime, ...)

BaseActionConfig()

Base class for action configurations.

CalibrateGuidingActionConfig([filter, ...])

CalibrationActionConfig(exptime, n, filter, ...)

CloseActionConfig()

CompleteHeadersActionConfig()

CoolCameraActionConfig()

FlatsActionConfig(filter, n, dir, bin, ...)

ObjectActionConfig(object, exptime[, ra, ...])

OpenActionConfig()

PointingModelActionConfig([n, exptime, ...])

SelectionMethod(value)

class astra.action_configs.BaseActionConfig[source]#

Bases: object

Base class for action configurations.

This class serves as a base for specific action configurations, providing validation and dictionary-like access to its fields. It supports type validation, required fields, and merging with default values, centralizing common functionality for all action configurations and ensuring that the action values passed by the user are valid.

Examples

>>> from astra.action_configs import AutofocusConfig
>>> autofocus_config = AutofocusConfig(exptime=3.0)
>>> exptime in autofocus_config
True
>>> autofocus_config['exptime']
3.0
>>> autofocus_config.get('not_available')
classmethod from_dict(config_dict: dict, default_dict: dict = {}, logger=None)[source]#
classmethod defaults_from_observatory_config(device_name: str, device_type: str = 'Camera', observatory_config: object | None = None) dict[source]#

Retrieve default values for this action from the observatory configuration.

Returns a dict suitable for passing as default_dict into from_dict.

validate()[source]#
validate_type(f)[source]#
static format_type_error(f, expected_type, val, specifier=None)[source]#
get(key: str, default=None)[source]#
keys()[source]#
validate_filters(filterwheel_names: dict[str, list[str]]) None[source]#

Validate that filter(s) exist in the available filterwheels.

Parameters:

filterwheel_names – Dict mapping filterwheel device names to lists of filter names. e.g., {“fw1”: [“Clear”, “Red”, “Green”, “Blue”]}

Raises:

ValueError – If a filter is specified but doesn’t exist in any filterwheel.

validate_subframe() None[source]#

Validate subframe parameters.

Raises:

ValueError – If subframe parameters are invalid.

validate_visibility(start_time: Time, end_time: Time, observatory_location: EarthLocation, min_altitude: float = 0.0)[source]#

Validate that the target is visible during the scheduled observation window.

Checks target visibility at the beginning, middle, and end of the planned observation to ensure the target remains observable throughout.

Only implemented for object actions; override in subclasses as needed.

has_subframe() bool[source]#

Check if subframing is enabled.

Returns:

True if subframe_width and subframe_height are specified, False otherwise.

classmethod merge_config_dicts(config_dict: dict, default_dict: dict) dict[source]#

Merge default_dict and config_dict, keeping only keys in dataclass.

to_jsonable()[source]#
class astra.action_configs.OpenActionConfig[source]#

Bases: BaseActionConfig

validate()[source]#
class astra.action_configs.CloseActionConfig[source]#

Bases: BaseActionConfig

validate()[source]#
class astra.action_configs.CompleteHeadersActionConfig[source]#

Bases: BaseActionConfig

validate()[source]#
class astra.action_configs.CoolCameraActionConfig[source]#

Bases: BaseActionConfig

validate()[source]#
class astra.action_configs.ObjectActionConfig(object: str, exptime: float, ra: float | None = None, dec: float | None = None, alt: float | None = None, az: float | None = None, filter: str | None = None, focus_shift: float | None = None, focus_position: float | None = None, n: int | None = None, guiding: bool = False, pointing: bool = False, bin: int = 1, dir: str | None = None, execute_parallel: bool = False, disable_telescope_movement: bool = False, reset_guiding_reference: bool = True, subframe_width: int | None = None, subframe_height: int | None = None, subframe_center_x: float = 0.5, subframe_center_y: float = 0.5)[source]#

Bases: BaseActionConfig

object: str#
exptime: float#
ra: float | None = None#
dec: float | None = None#
alt: float | None = None#
az: float | None = None#
filter: str | None = None#
focus_shift: float | None = None#
focus_position: float | None = None#
n: int | None = None#
guiding: bool = False#
pointing: bool = False#
bin: int = 1#
dir: str | None = None#
execute_parallel: bool = False#
disable_telescope_movement: bool = False#
reset_guiding_reference: bool = True#
subframe_width: int | None = None#
subframe_height: int | None = None#
subframe_center_x: float = 0.5#
subframe_center_y: float = 0.5#
validate()[source]#
validate_visibility(start_time: Time, end_time: Time, observatory_location: EarthLocation, min_altitude: float = 0.0) None[source]#

Validate that the target is visible during the scheduled observation window.

Checks target visibility at the beginning, middle, and end of the planned observation to ensure the target remains observable throughout.

Parameters:
  • start_time – Observation start time as astropy Time object

  • end_time – Observation end time as astropy Time object

  • observatory_location – Observatory location as EarthLocation object

  • min_altitude – Minimum altitude in degrees for target to be considered visible (default: 0°)

Raises:

ValueError – If RA/Dec are not provided or if target is below minimum altitude at any of the three check points (start, middle, end)

Note

Only checks visibility when RA and Dec coordinates are provided. Alt/Az coordinates are not checked as they are position-specific.

class astra.action_configs.CalibrationActionConfig(exptime: List[float] = <factory>, n: List[int] = <factory>, filter: Optional[str] = None, dir: Optional[str] = None, bin: int = 1, execute_parallel: bool = False, subframe_width: Optional[int] = None, subframe_height: Optional[int] = None, subframe_center_x: float = 0.5, subframe_center_y: float = 0.5)[source]#

Bases: BaseActionConfig

exptime: List[float]#
n: List[int]#
filter: str | None = None#
dir: str | None = None#
bin: int = 1#
execute_parallel: bool = False#
subframe_width: int | None = None#
subframe_height: int | None = None#
subframe_center_x: float = 0.5#
subframe_center_y: float = 0.5#
validate()[source]#
class astra.action_configs.FlatsActionConfig(filter: List[str] = <factory>, n: List[int] = <factory>, dir: Optional[str] = None, bin: int = 1, execute_parallel: bool = False, disable_telescope_movement: bool = False, subframe_width: Optional[int] = None, subframe_height: Optional[int] = None, subframe_center_x: float = 0.5, subframe_center_y: float = 0.5)[source]#

Bases: BaseActionConfig

filter: List[str]#
n: List[int]#
dir: str | None = None#
bin: int = 1#
execute_parallel: bool = False#
disable_telescope_movement: bool = False#
subframe_width: int | None = None#
subframe_height: int | None = None#
subframe_center_x: float = 0.5#
subframe_center_y: float = 0.5#
validate()[source]#
class astra.action_configs.CalibrateGuidingActionConfig(filter: str | None = None, pulse_time: float = 5000.0, exptime: float = 5.0, settle_time: float = 10.0, number_of_cycles: int = 10, focus_shift: float | None = None, focus_position: float | None = None, bin: int = 1, subframe_width: int | None = None, subframe_height: int | None = None, subframe_center_x: float = 0.5, subframe_center_y: float = 0.5)[source]#

Bases: BaseActionConfig

filter: str | None = None#
pulse_time: float = 5000.0#
exptime: float = 5.0#
settle_time: float = 10.0#
number_of_cycles: int = 10#
focus_shift: float | None = None#
focus_position: float | None = None#
bin: int = 1#
subframe_width: int | None = None#
subframe_height: int | None = None#
subframe_center_x: float = 0.5#
subframe_center_y: float = 0.5#
validate()[source]#
class astra.action_configs.PointingModelActionConfig(n: int = 100, exptime: float = 1.0, dark_subtraction: bool = False, object: str = 'Pointing Model', ra: float | None = None, dec: float | None = None, filter: str | None = None, focus_shift: float | None = None, focus_position: float | None = None, bin: int = 1, dir: str | None = None, subframe_width: int | None = None, subframe_height: int | None = None, subframe_center_x: float = 0.5, subframe_center_y: float = 0.5)[source]#

Bases: BaseActionConfig

n: int = 100#
exptime: float = 1.0#
dark_subtraction: bool = False#
object: str = 'Pointing Model'#
ra: float | None = None#
dec: float | None = None#
filter: str | None = None#
focus_shift: float | None = None#
focus_position: float | None = None#
bin: int = 1#
dir: str | None = None#
subframe_width: int | None = None#
subframe_height: int | None = None#
subframe_center_x: float = 0.5#
subframe_center_y: float = 0.5#
validate()[source]#
class astra.action_configs.SelectionMethod(value)[source]#

Bases: Enum

SINGLE = 'single'#
MAXIMAL = 'maximal'#
ANY = 'any'#
classmethod from_string(key: str, logger=None) SelectionMethod[source]#
class astra.action_configs.AutofocusCalibrationFieldConfig(maximal_zenith_angle: float | int | ~astropy.coordinates.angles.Angle | None = None, airmass_threshold: float = 1.01, g_mag_range: ~typing.List[float | int] = <factory>, j_mag_range: ~typing.List[float | int] = <factory>, fov_height: float | int = 0, fov_width: float | int = 0, selection_method: ~astra.action_configs.SelectionMethod = SelectionMethod.SINGLE, use_gaia: bool = True, observation_time: ~astropy.time.core.Time | None = None, maximal_number_of_stars: int = 100000, ra: float | int | None = None, dec: float | int | None = None, _coordinates: ~astropy.coordinates.sky_coordinate.SkyCoord | None = None)[source]#

Bases: BaseActionConfig

Configuration for automated autofocus calibration field selection.

maximal_zenith_angle: float | int | Angle | None = None#
airmass_threshold: float = 1.01#
g_mag_range: List[float | int]#
j_mag_range: List[float | int]#
fov_height: float | int = 0#
fov_width: float | int = 0#
selection_method: SelectionMethod = 'single'#
use_gaia: bool = True#
observation_time: Time | None = None#
maximal_number_of_stars: int = 100000#
ra: float | int | None = None#
dec: float | int | None = None#
property coordinates: SkyCoord#
classmethod from_dict(config_dict: dict, logger=None, default_dict: dict = {}) AutofocusCalibrationFieldConfig[source]#
class astra.action_configs.AutofocusConfig(exptime: float | int = 3.0, reduce_exposure_time: bool = False, search_range: Union[List[int], int, NoneType] = None, search_range_is_relative: bool = False, n_steps: List[int] = <factory>, n_exposures: List[int] = <factory>, decrease_search_range: bool = True, star_find_threshold: float | int = 5.0, fwhm: int = 8, percent_to_cut: int = 60, focus_measure_operator: str = 'HFR', save: bool = True, extremum_estimator: str = 'LOWESS', extremum_estimator_kwargs: dict[str, typing.Any] = <factory>, secondary_focus_measure_operators: List[str] = <factory>, calibration_field: astra.action_configs.AutofocusCalibrationFieldConfig = <factory>, save_path: Optional[pathlib.Path] = None, subframe_width: Optional[int] = None, subframe_height: Optional[int] = None, subframe_center_x: float = 0.5, subframe_center_y: float = 0.5)[source]#

Bases: BaseActionConfig

exptime: float | int = 3.0#
reduce_exposure_time: bool = False#
search_range: List[int] | int | None = None#
search_range_is_relative: bool = False#
n_steps: List[int]#
n_exposures: List[int]#
decrease_search_range: bool = True#
star_find_threshold: float | int = 5.0#
fwhm: int = 8#
percent_to_cut: int = 60#
focus_measure_operator: str = 'HFR'#
save: bool = True#
extremum_estimator: str = 'LOWESS'#
extremum_estimator_kwargs: dict[str, Any]#
secondary_focus_measure_operators: List[str]#
calibration_field: AutofocusCalibrationFieldConfig#
save_path: Path | None = None#
subframe_width: int | None = None#
subframe_height: int | None = None#
subframe_center_x: float = 0.5#
subframe_center_y: float = 0.5#
classmethod from_dict(config_dict: dict, logger=None, default_dict: dict = {}) AutofocusConfig[source]#
property focus_measure_operator_kwargs: dict#
property focus_measure_operator_name: str#