panoptes.pocs.scheduler package¶
Subpackages¶
- panoptes.pocs.scheduler.observation package
- Submodules
- panoptes.pocs.scheduler.observation.base module
ExposureObservationObservation.add_to_exposure_list()Observation.current_exp_numObservation.directoryObservation.exposure_listObservation.exptimeObservation.exptimesObservation.first_exposureObservation.from_dict()Observation.get_exposure()Observation.last_exposureObservation.minimum_durationObservation.nameObservation.pointing_imageObservation.pointing_imagesObservation.reset()Observation.seq_timeObservation.set_durationObservation.set_is_finishedObservation.statusObservation.to_dict()
- panoptes.pocs.scheduler.observation.bias module
- panoptes.pocs.scheduler.observation.compound module
- panoptes.pocs.scheduler.observation.dark module
- Module contents
Submodules¶
panoptes.pocs.scheduler.constraint module¶
Scheduler constraints used to score candidate observations.
Defines a small set of scoring constraints (Altitude, Duration, MoonAvoidance, AlreadyVisited, TimeWindow) implementing a common BaseConstraint interface. Each constraint returns a (veto, score) tuple where veto indicates the target should be excluded and score is a normalized [0–1] value multiplied by the constraint weight.
- class panoptes.pocs.scheduler.constraint.AlreadyVisited(*args, **kwargs)[source]¶
Bases:
BaseConstraintSimple Already Visited Constraint
A simple already visited constraint that determines if the given observation has already been visited before. If given observation has already been visited then it will not be considered for a call to become the current observation.
- get_score(time, observer, observation, **kwargs)[source]¶
Veto fields that have already been observed in this run.
- Parameters:
time (astropy.time.Time) – Evaluation time (unused).
observer – Unused for this constraint.
observation – Candidate observation to check.
**kwargs – Should include ‘observed_list’ mapping camera->list of exposures.
- Returns:
(veto, score) where veto=True if the observation’s field appears in the observed_list; score remains default otherwise.
- Return type:
- class panoptes.pocs.scheduler.constraint.Altitude(horizon=None, obstructions=None, *args, **kwargs)[source]¶
Bases:
BaseConstraintImplements altitude constraints for a horizon
- get_score(time, observer, observation, **kwargs)[source]¶
Score whether the target altitude clears the horizon model.
- Parameters:
time (astropy.time.Time) – Evaluation time.
observer – Observer used to compute AltAz for the target.
observation – Observation whose field to evaluate.
- Returns:
(veto, score) where veto=True if below horizon; score=1 when above horizon otherwise default_score.
- Return type:
- class panoptes.pocs.scheduler.constraint.BaseConstraint(weight=1.0, default_score=0.0, *args, **kwargs)[source]¶
Bases:
PanBaseAbstract base class for scheduler constraints.
Subclasses must implement get_score() and return a (veto, score) tuple where veto is a boolean indicating the target should be rejected outright and score is a float typically in [0, 1] that will be multiplied by this constraint’s weight.
- class panoptes.pocs.scheduler.constraint.Duration(horizon=None, *args, **kwargs)[source]¶
Bases:
BaseConstraintConstraint that favors targets with longer remaining observing time.
- get_score(time, observer, observation, **kwargs)[source]¶
Score available observing time until set/flip/end-of-night.
Computes a normalized fraction of remaining time the target can be observed (subject to horizon, meridian flip, and end-of-night). Vetoes if the minimum observation duration cannot be met.
- class panoptes.pocs.scheduler.constraint.MoonAvoidance(separation=<Quantity 15. deg>, *args, **kwargs)[source]¶
Bases:
BaseConstraintConstraint that vetoes/penalizes fields too close to the Moon.
- get_score(time, observer, observation, **kwargs)[source]¶
Score angular separation from the Moon.
- Parameters:
time (astropy.time.Time) – Evaluation time (unused here).
observer – Unused for this constraint.
observation – Observation whose field is evaluated.
**kwargs – Must include ‘moon’ (SkyCoord) giving current Moon position.
- Returns:
(veto, score) where veto=True if separation is below the configured threshold; otherwise score increases with separation and is roughly scaled by 180 degrees.
- Return type:
- class panoptes.pocs.scheduler.constraint.TimeWindow(start_time: str | Time, end_time: str | Time, *args, **kwargs)[source]¶
Bases:
BaseConstraintConstraint that boosts observations within a specific time interval.
panoptes.pocs.scheduler.dispatch module¶
Dispatch-style scheduler implementation.
Implements a simple greedy/dispatch scheduler that evaluates all configured observations against the active constraints and selects the best candidate by weighted score. Favors the current observation when still viable to reduce excessive switching.
- class panoptes.pocs.scheduler.dispatch.Scheduler(*args, **kwargs)[source]¶
Bases:
BaseSchedulerGreedy scheduler that ranks observations by constraint scores.
- get_observation(time=None, show_all=False, constraints=None, read_file=False)[source]¶
Get a valid observation.
- Parameters:
time (astropy.time.Time, optional) – Time at which scheduler applies, defaults to time called
constraints (list of panoptes.pocs.scheduler.constraint.Constraint, optional) – The constraints to check. If None (the default), use the scheduler.constraints.
show_all (bool, optional) – Return all valid observations along with merit value, defaults to False to only get top value
constraints – The constraints to check. If None (the default), use the scheduler.constraints
read_file (bool, optional) – If the fields file should be reread before scheduling occurs, defaults to False.
- Returns:
A tuple (or list of tuples) with name and score of ranked observations
- Return type:
panoptes.pocs.scheduler.field module¶
Field utilities used by the scheduler.
Defines the Field class, a thin wrapper around astroplan.FixedTarget with additional conveniences for naming and construction from AltAz coordinates.
- class panoptes.pocs.scheduler.field.Field(name, position, equinox='J2000', *args, **kwargs)[source]¶
Bases:
FixedTarget,PanBaseRepresents the center of an observing field (target) for scheduling.
- property field_name¶
Flattened field name appropriate for paths
panoptes.pocs.scheduler.scheduler module¶
Base scheduler primitives and common helpers.
Defines BaseScheduler, an abstract class that loads field definitions and manages the list of Observation objects, current selection, and common properties used during scheduling. Concrete schedulers subclass this and implement get_observation().
- class panoptes.pocs.scheduler.scheduler.BaseScheduler(observer, fields_list=None, fields_file=None, constraints=None, *args, **kwargs)[source]¶
Bases:
PanBaseAbstract base class for schedulers.
Loads fields and constraints, manages observations and the current selection, and provides helpers used by concrete schedulers.
- add_observation(observation_config: dict, **kwargs)[source]¶
Adds an Observation to the scheduler.
- Parameters:
observation_config (dict) – Configuration dict for Field and Observation.
- property current_observation¶
The observation that is currently selected by the scheduler
Upon setting a new observation the seq_time is set to the current time and added to the observed_list. An old observation is reset (so that it can be used again - see ~pocs.scheduelr.observation.reset). If the new observation is the same as the old observation, nothing is done. The new observation can also be set to None to specify there is no current observation.
- property fields_file¶
Field configuration file
A YAML list of config items, specifying a minimum of name and position for the ~pocs.scheduler.field.Field. `Observation`s will be built from the list of fields.
A file will be read by ~pocs.scheduler.priority.read_field_list upon being set.
Note
Setting a new fields_file will clear all existing fields
- property fields_list¶
List of field configuration items
A YAML list of config items, specifying a minimum of name and position for the ~pocs.scheduler.field.Field. `Observation`s will be built from the list of fields.
A file will be read by ~pocs.scheduler.priority.read_field_list upon being set.
Note
Setting a new fields_list will clear all existing fields
- property has_valid_observations¶
True if one or more observations are currently available.
- Type:
- observation_available(observation, time)[source]¶
Check if observation is available at given time
- Parameters:
observation (pocs.scheduler.observation) – An Observation object
time (astropy.time.Time) – The time at which to check observation
- property observations¶
Returns a dict of ~pocs.scheduler.observation.Observation objects with ~pocs.scheduler.observation.Observation.field.field_name as the key
Note
read_field_list is called if list is None
- remove_observation(field_name)[source]¶
Removes an Observation from the scheduler
- Parameters:
field_name (str) – Field name corresponding to entry key in observations
Module contents¶
Scheduler package helpers.
Provides factory functions to construct a Scheduler instance and its list of constraints from PANOPTES configuration. The module avoids importing concrete classes directly; instead it dynamically loads the configured scheduler and constraints using panoptes.utils.library.load_module.
- panoptes.pocs.scheduler.create_constraints_from_config(config=None) list[BaseConstraint][source]¶
Build a list of constraint instances from scheduler configuration.
Reads the ‘scheduler.constraints’ list from the provided config (or global config if None), resolves each constraint’s dotted Python path (falling back to panoptes.pocs.scheduler.constraint.<Name> when a short name is given), and instantiates the constraint with any provided options.
- Parameters:
config (dict | None) – Scheduler configuration dict; if None, use get_config(‘scheduler’).
- Returns:
Instantiated constraint objects ready to pass to the Scheduler.
- Return type:
- panoptes.pocs.scheduler.create_scheduler_from_config(config=None, observer=None, iers_url=None, *args, **kwargs)[source]¶
Construct a Scheduler instance based on configuration.
Reads the ‘scheduler’ section from the config, ensures IERS tables are configured, resolves the observing site (Observer), and loads the configured Scheduler class and fields file. Any configured constraints are built via create_constraints_from_config and passed to the Scheduler constructor.
- Parameters:
config (dict | None) – Scheduler configuration; if None, fetched via get_config.
observer (astroplan.Observer | None) – Existing Observer; if None, created from config.
iers_url (str | None) – Optional override for the IERS A table URL.
*args – Additional positional args forwarded to the Scheduler constructor.
**kwargs – Additional keyword args forwarded to the Scheduler constructor.
- Returns:
The constructed Scheduler instance.
- Return type:
- Raises:
panoptes.utils.error.NotFound – If the fields file cannot be located or module not found.