Features

class rubin_scheduler.scheduler.features.BaseFeature(**kwargs)[source]

Bases: object

The base class for features. This defines the standard API: a Feature should include a self.feature attribute, which could be a float, bool, or healpix size numpy array, or numpy masked array, and a __call__ method which returns self.feature.

class rubin_scheduler.scheduler.features.BaseSurveyFeature(**kwargs)[source]

Bases: BaseFeature

Track information relevant to the progress of a survey, using self.feature to hold this information.

Features can track a single piece of information, or keep a map across the sky, or any other piece of information.

Information in self.feature is updated via add_observation or add_observation_array.

add_observation(observation, indx=None, **kwargs)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.CoaddedDepth(filtername='r', nside=None, fwhm_eff_limit=100.0)[source]

Bases: BaseSurveyFeature

Track the co-added depth that has been reached across the sky

Parameters:

fwh_meff_limit (float (100)) – The effective FWHM of the seeing (arcsecond). Images will only be added to the coadded depth if the observation FWHM is less than or equal to the limit. Default 100.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.Conditions(nside=None, site='LSST', exptime=30.0, mjd_start=60796.0, season_map=None, sun_ra_start=None, mjd=None)[source]

Bases: object

Holds telemetry information, keeping calculated values in sync for self.mjd (such as ra/dec mappings to alt/az).

Incoming values have setters to keep values in sync. Healpix maps are set to the expected (self.nside) resolution.

Unless otherwise noted, all values are assumed to be valid at the time given by self.mjd.

Parameters:
  • nside (int, optional) – The healpixel nside to set the resolution of attributes. Default of None will use rubin_scheduler.scheduler.utils.set_default_nside.

  • site (str ('LSST')) – A site name used to create a sims.utils.Site object. For looking up observatory parameters like latitude and longitude.

  • exptime (float, optional) – The exposure time (seconds) to assume when computing the 5-sigma limiting depth maps stored in Conditions. These maps are used by basis functions, but are not used to calculate expected observation m5 values (such as when exposure time varies). Default 30 seconds.

  • mjd_start (float, optional) – The starting MJD of the survey. Default uses rubin_scheduler.utils.survey_start_date().

  • season_map (np.array, (N,), optional) – A HEALpix array that specifies the day offset when computing the season for each HEALpix. Equivalent to season at mjd_start.

  • sun_ra_start (float, optional) – The RA of the sun at the start of the survey (radians)

  • mjd (float, optional) – The current MJD. Default of None is fine on init - will be updated by telemetry stream.

future_alt_az(mjd)[source]

Compute the altitude and azimuth for a future time.

Returns:

  • altitude (np.array) – The altutude of each healpix at MJD (radians)

  • azimuth (: np.array) – The azimuth of each healpix at MJD (radians)

class rubin_scheduler.scheduler.features.LastFilterChange[source]

Bases: BaseSurveyFeature

Record when the filter last changed.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.LastNObsTimes(filtername=None, n_obs=3, nside=None)[source]

Bases: BaseSurveyFeature

Record the last three observations for each healpixel

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.LastObservation(scheduler_note=None, survey_name=None)[source]

Bases: BaseSurveyFeature

Track the last observation. Useful if you want to see when the last time a survey took an observation.

Parameters:
  • scheduler_note (str or None, optional) – Value of the scheduler_note to match, if not None.

  • survey_name (str or None, optional) – Backwards compatible version of scheduler_note. Deprecated.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.LastObserved(filtername='r', nside=None, fill=nan)[source]

Bases: BaseSurveyFeature

Track the MJD when a pixel was last observed. Assumes observations are added in chronological order.

Parameters:
  • filtername (str or None) – Track visits in a particular filter or any filter (None).

  • nside (int or None) – Nside for the healpix map, default of None uses the scheduler default.

  • fill (float) – Fill value to use where no observations have been found.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.LastsequenceObservation(sequence_ids='')[source]

Bases: BaseSurveyFeature

When was the last observation

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.NObsCount(filtername=None, tag=None)[source]

Bases: BaseSurveyFeature

Count the number of observations. Total number, not tracked over sky

Parameters:

filtername (str or None) – The filter to count. Default None, all filters counted.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.NObsCountSeason(season, nside=None, filtername=None, tag=None, season_modulo=2, offset=None, max_season=None, season_length=365.25)[source]

Bases: BaseSurveyFeature

Count the number of observations in a season.

Parameters:

filtername (str (None)) – The filter to count (if None, all filters counted)

Notes

Uses season_calc to calculate season value.

Seems unused - added deprecation warning.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.NObsNight(filtername='r', nside=None)[source]

Bases: BaseSurveyFeature

Track how many times a healpixel has been observed in a night.

Parameters:
  • filtername (str or None) – Filter to track. None tracks observations in any filter.

  • nside (int or None) – Scale of the healpix map. Default of None uses the scheduler default nside.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.NObsSurvey(note=None)[source]

Bases: BaseSurveyFeature

Count the number of observations, whole sky (not per pixel).

Because this feature will belong to a survey, it would count all observations that are counted for that survey.

Parameters:

note (str or None) – Count observations that match str in their scheduler_note field. Note can be a substring of scheduler_note, and will still match.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.NObservations(filtername=None, nside=None, scheduler_note=None, survey_name=None)[source]

Bases: BaseSurveyFeature

Track the number of observations that have been made across the sky.

Parameters:
  • filtername (str or list [str] or None) – String or list that has all the filters that can count. Default None counts all filters.

  • nside (int) – The nside of the healpixel map to use. Default None uses scheduler default.

  • scheduler_note (str or None, optional) – The scheduler_note to match. Scheduler_note values which match this OR which contain this value as a subset of their string will match.

  • survey_name (str or None) – The scheduler_note value to match. Deprecated in favor of scheduler_note, but provided for backward compatibility. Will be removed in the future.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.NObservationsCurrentSeason(filtername=None, nside=None, seeing_fwhm_max=None, m5_penalty_max=None, mjd_start=None)[source]

Bases: BaseSurveyFeature

Count the observations at each healpix, taken in the most recent season, that meet filter, seeing and m5 criteria.

Useful for ensuring that “good quality” observations are acquired in each season at each point in the survey footprint.

Parameters:
  • filtername (str, optional) – If None (default) count observations in any filter. Otherwise, only count observations in the specified filter.

  • nside (int, optional) – If None (default), use default nside for scheduler. Otherwise, set nside for the map to nside.

  • seeing_fwhm_max (float, optional) – If None (default), count observations up to any seeing value. Otherwise, only count observations with better seeing (FWHMeff) than seeing_fwhm_max. In arcseconds.

  • m5_penalty_max (float, optional) – If None (default), count observations with any m5 value. Otherwise, only count observations within this value of the dark sky map at this pixel. Only relevant if filtername is not None.

  • mjd_start (float, optional) – If None, uses default survey_start_mjd for the start of the survey. This defines the starting year for counting seasons, so should be the start of the survey.

add_observation(observation, indx)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

season_update(observation=None, conditions=None)[source]

Update the season_map to the current time.

This assumes time increases monotonically in the conditions or observations objects passed as arguments. Using the ‘mjd’ from the conditions, where parts of the sky have changed season (increasing in the self.season_map + 1) the self.feature is cleared, in order to restart counting observations in the new season.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • conditions (rubin_scheduler.scheduler.Conditions, optional) – A conditions object, containing mjd.

Notes

One of observations or conditions must be passed, but either are options so this can be used with add_observation. Most of the time, the updates will come from conditions.

class rubin_scheduler.scheduler.features.NObservationsSeason(season, filtername=None, nside=None, offset=0, modulo=None, max_season=None, season_length=365.25)[source]

Bases: BaseSurveyFeature

Track the number of observations that have been made across sky

Parameters:
  • season (int) – Only count observations in this season (year).

  • filtername (str (‘r’)) – String or list that has all the filters that can count.

  • nside (int (32)) – The nside of the healpixel map to use

  • offset (int (0)) – The offset to use when computing the season (days)

  • modulo (int (None)) – How to mod the years when computing season

Notes

Uses season_calc to calculate season value.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.NoteInNight(notes=None)[source]

Bases: BaseSurveyFeature

Count appearances of any of scheduler_notes in observation scheduler_note in the current night; note must match one of scheduler_notes exactly.

Useful for keeping track of how many times a survey or other subset of visits has executed in a given night.

Parameters:

notes (list [str], optional) – List of strings to match against observation scheduler_note values. The scheduler_note must match one of the items in notes exactly. Default of None uses [] and will match any note.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.NoteLastObserved(note, filtername=None)[source]

Bases: BaseSurveyFeature

Track the last time an observation with a particular note field was made.

Parameters:

note (str) – Substring to match an observation note field to keep track of.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.PairInNight(filtername='r', nside=None, gap_min=25.0, gap_max=45.0)[source]

Bases: BaseSurveyFeature

Track how many pairs have been observed within a night at a given healpix.

Parameters:
  • gap_min (float (25.)) – The minimum time gap to consider a successful pair in minutes

  • gap_max (float (45.)) – The maximum time gap to consider a successful pair (minutes)

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

add_observations_array(observations_array, observations_hpid)[source]

Update self.feature based on information in observations_array and observations_hpid.

This is a method to more rapidly restore the feature to its expected state, by using an array of all previous observations (observations_array) instead looping over the individual observations, as in self.add_observation. The observations array allows rapid calculation of acceptable observations, without considering factors such as which healpix is relevant.

The observations_hpid is a reorganized version of the observations_array, where the array representing each observation is extended to include hpid and recorded multiple times (for each healpixel). The observations_hpid allows rapid calculation of feature values which depend on hpid.

Links between observations_array and observations_hpid can be made using ID.

class rubin_scheduler.scheduler.features.RotatorAngle(filtername='r', binsize=10.0, nside=None)[source]

Bases: BaseSurveyFeature

Track what rotation angles things are observed with. XXX-under construction

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.

class rubin_scheduler.scheduler.features.SurveyInNight(survey_str='')[source]

Bases: BaseSurveyFeature

Count appearances of survey_str within observation note in the current night; survey_str must be contained in note.

Useful to keep track of how many times a survey has executed in a night.

Parameters:

survey_str (str, optional) – String to search for in observation scheduler_note. Default of “” means any observation will match.

add_observation(observation, indx=None)[source]

Update self.feature based on information in observation. Observations should be ordered in monotonically increasing time.

Parameters:
  • observation (np.array, (1,N)) – Array of observation information, containing mjd for the time. See rubin_scheduler.scheduler.utils.empty_observation.

  • indx (list-like of [int]) – The healpixel indices that the observation overlaps. See rubin_scheduler.utils.HpInLsstFov.