Basis Functions¶
- class rubin_scheduler.scheduler.basis_functions.AfterEveningTwiBasisFunction(time_after=30.0, alt_limit=18)[source]¶
Bases:
BaseBasisFunction
Only execute right after evening twilight
- class rubin_scheduler.scheduler.basis_functions.AggressiveSlewtimeBasisFunction(max_time=135.0, order=1.0, hard_max=None, filtername='r', nside=None)[source]¶
Bases:
BaseBasisFunction
Reward slews that take little time
XXX–not sure how this is different from SlewtimeBasisFunction? Looks like it’s checking the slewtime to the field position rather than the healpix maybe?
- class rubin_scheduler.scheduler.basis_functions.AirmassPointRangeBasisFunction(ra, dec, airmass_range=[1.05, 2.7], nside=32)[source]¶
Bases:
BaseBasisFunction
Set an airmass limit for a single point Maps the point to the nearest HEALpixel and uses the Conditions airmass map, so precision of the airmass limit that is applied is limited by the HEALpix resolution.
- Parameters:
ra (
float
) – The RA of the point (degrees)dec (
float
) – The Dec of the point (degrees)airmass_range (
list
) – The valid airmass range, default [1.05, 2.7].
- class rubin_scheduler.scheduler.basis_functions.AltAzShadowMaskBasisFunction(nside=None, min_alt=20.0, max_alt=82.0, shadow_minutes=40.0)[source]¶
Bases:
BaseBasisFunction
Mask out range altitudes and azimuths, then extend the mask so if observations are taken in pairs, the second in the pair will not have moved into a masked region.
Masks any alt/az regions as specified by the conditions object, then applies any additional altitude masking as suppied by the kwargs. This mask is then extended using
shadow minutes
.- Parameters:
nside (
int
) – HEALpix nside. Default None will look up the package-wide default.min_alt (
float
) – Minimum altitude to apply to the mask. Default 20 (degrees).max_alt (
float
) – Maximum altitude to allow. Default 82 (degrees).shadow_minutes (
float
) – How long to extend masked area in longitude. Default 40 (minutes).
- class rubin_scheduler.scheduler.basis_functions.AreaCheckMaskBasisFunction(bf_list, nside=32, min_area=1000.0)[source]¶
Bases:
BaseBasisFunction
Take a list of other mask basis functions, and do an additional check for area available
- class rubin_scheduler.scheduler.basis_functions.AvoidDirectWind(wind_speed_maximum=20.0, nside=None)[source]¶
Bases:
BaseBasisFunction
Mask the sky where the wind pressure exceeds
wind_speed_maximum
.- Parameters:
wind_speed_maximum (
float
, optional) – Wind speed to mark regions as unobservable (in m/s).nside (
int
, optional) – The nside for the basis function. Default None usesset_default_nside()
.
- class rubin_scheduler.scheduler.basis_functions.AvoidFastRevisitsBasisFunction(filtername='r', nside=None, gap_min=25.0, penalty_val=nan)[source]¶
Bases:
BaseBasisFunction
Marks targets as unseen if they are in a specified time window in order to avoid fast revisits.
- Parameters:
filtername (
str
or None) – The name of the filter for this target map. Using None will match visits in any filter.gap_min (
float
) – Minimum time for the gap (minutes).nside (
int
or None) – The healpix resolution.penalty_val (
float
) – The reward value to use for regions to penalize. Will be masked if set to np.nan (default).
- class rubin_scheduler.scheduler.basis_functions.AvoidLongGapsBasisFunction(filtername=None, nside=None, footprint=None, min_gap=4.0, max_gap=40.0, ha_limit=3.5)[source]¶
Bases:
BaseBasisFunction
Boost the reward on parts of the survey that haven’t been observed for a while.
- Parameters:
filtername (
str
, optional) – The filter to consider when tracking visits.nside (
int
, optional) – The nside to use for the basis function. Default None usesset_default_nside()
.footprint (
np.ndarray
, (N,)) – The footprint to consider when tracking visits. Default None usesget_current_footprint()
.min_gap (
float
, optional) – The minimum gap of time before boosting (in days).max_gap (
float
, optional) – The maximum gap of time before stopping boosting (in days).ha_limit (`float, optional) – Only boost visits at parts of the sky with HA < ha_limit (in hours).
- class rubin_scheduler.scheduler.basis_functions.AzModuloBasisFunction(nside=None, az_limits=None, out_of_bounds_val=-1.0)[source]¶
Bases:
BaseBasisFunction
Try to replicate the Rothchild et al cadence forcing by only observing on limited az ranges per night.
- Parameters:
az_limits (
list
offloat
pairs (None)) – The azimuth limits (degrees) to use.
- class rubin_scheduler.scheduler.basis_functions.AzimuthBasisFunction(nside=None)[source]¶
Bases:
BaseBasisFunction
Reward staying in the same azimuth range. Possibly better than using slewtime, especially when selecting a large area of sky.
- class rubin_scheduler.scheduler.basis_functions.BalanceVisits(nobs_reference, note_survey, note_interest, nside=None)[source]¶
Bases:
BaseBasisFunction
Balance visits across multiple surveys.
- Parameters:
nobs_reference (
int
) – Expected number of observations across all interested surveys.note_survey (
str
) – Note value for the current survey.note_interest (
str
) – Substring with the name of interested surveys to be accounted.nside (
int
) – Healpix map resolution.
Notes
This basis function is designed to balance the reward of a group of surveys, such that the group get a reward boost based on the required collective number of observations.
For example, if you have 3 surveys (e.g. SURVEY_A_REGION_1, SURVEY_A_REGION_2, SURVEY_A_REGION_3), when one of them is observed once (SURVEY_A_REGION_1) they all get a small reward boost proportional to the collective number of observations (
nobs_reference
). Further observations of SURVEY_A_REGION_1 would now cause the other surveys to gain a reward boost in relative to it.
- class rubin_scheduler.scheduler.basis_functions.BaseBasisFunction(nside=None, filtername=None, **kwargs)[source]¶
Bases:
object
Class that takes features and computes a reward function when called.
- __call__(conditions, **kwargs)[source]¶
- Parameters:
conditions (
rubin_scheduler.scheduler.features.conditions
object) – Object that has attributes for all the current conditions.scalar. (Return a reward healpix map or a reward)
- add_observation(observation, indx=None)[source]¶
- Parameters:
observation (
np.array
) – An array with information about the input observationindx (
np.array
) – The indices of the healpix map that the observation overlaps with
- add_observations_array(observations_array, observations_hpid)[source]¶
Similar to add_observation, but for loading a whole array of observations at a time.
- Parameters:
observations_array_in (
np.array
) – An array of completed observations (with columns like rubin_scheduler.scheduler.utils.empty_observation). Should be sorted by MJD.observations_hpid_in (
np.array
) – Same as observations_array_in, but larger and with an additional column for HEALpix id. Each observation is listed multiple times, once for every HEALpix it overlaps.
- class rubin_scheduler.scheduler.basis_functions.CablewrapUnwrapBasisFunction(nside=None, min_az=-270.0, max_az=270.0, min_alt=20.0, max_alt=82.0, activate_tol=20.0, delta_unwrap=1.2, unwrap_until=70.0, max_duration=30.0)[source]¶
Bases:
BaseBasisFunction
- Parameters:
min_az (
float
(20.)) – The minimum azimuth to activate bf (degrees)max_az (
float
(82.)) – The maximum azimuth to activate bf (degrees)unwrap_until (
float
(90.)) – The window in which the bf is activated (degrees)
- class rubin_scheduler.scheduler.basis_functions.CadenceEnhanceBasisFunction(filtername='gri', nside=None, supress_window=[0, 1.8], supress_val=-0.5, enhance_window=[2.1, 3.2], enhance_val=1.0, apply_area=None)[source]¶
Bases:
BaseBasisFunction
Drive a certain cadence
- Parameters:
filtername (
str
(‘gri’)) – The filter(s) that should be grouped togethersupress_window (
list
offloat
) – The start and stop window for when observations should be repressed (days)apply_area (healpix map) – The area over which to try and drive the cadence. Good values as 1, no candece drive 0. Probably works as a bool array too.
- class rubin_scheduler.scheduler.basis_functions.CadenceEnhanceTrapezoidBasisFunction(filtername='gri', nside=None, delay_width=2, delay_slope=2.0, delay_peak=0, delay_amp=0.5, enhance_width=3.0, enhance_slope=2.0, enhance_peak=4.0, enhance_amp=1.0, apply_area=None, season_limit=None)[source]¶
Bases:
BaseBasisFunction
Drive a certain cadence, like CadenceEnhanceBasisFunction but with smooth transitions
- Parameters:
filtername (
str
(‘gri’)) – The filter(s) that should be grouped togetherstring! (XXX--fill out doc)
- class rubin_scheduler.scheduler.basis_functions.CadenceInSeasonBasisFunction(drive_map, filtername='griz', season_span=2.5, cadence=2.5, nside=None)[source]¶
Bases:
BaseBasisFunction
Drive observations at least every N days in a given area
- Parameters:
drive_map (
np.ndarray
, (N,)) – A HEALpix map with values of 1 where the cadence should be driven.filtername (
str
) – The filters that can count.season_span (
float
) – How long to consider a spot “in_season” (hours).cadence (
float
) – How long to wait before activating the basis function (days).
- class rubin_scheduler.scheduler.basis_functions.CloseToTwilightBasisFunction(max_sun_alt_limit=-14.8, max_time_to_12deg=21.0, min_time_remaining=15.0)[source]¶
Bases:
BaseBasisFunction
Only execute if the sun is higher than
sun_alt_limit
, the current time is withintime_to_12deg
of -12 degree twilight, and there is at leasttime_remaining
time left before -12 degree twilight.Is the current time and sun altitude close to twilight, but not too close?
- Parameters:
max_sun_alt_limit (
float
) – The sun altitude limit (degrees). Sun must be higher than this at sunset to executemax_time_to_12deg (
float
) – How much time must be remaining before 12 degree twilight in the morning (minutes)min_time_remaining (
float
) – Minimum about of time that must be available before trying to execute (minutes)
Notes
This is primarily useful for surveys which must execute within close limits of -12 degree twilight.
- class rubin_scheduler.scheduler.basis_functions.CloudedOutBasisFunction(cloud_limit=0.7)[source]¶
Bases:
BaseBasisFunction
- class rubin_scheduler.scheduler.basis_functions.ConstantBasisFunction(nside=None, filtername=None, **kwargs)[source]¶
Bases:
BaseBasisFunction
Just add a constant
- class rubin_scheduler.scheduler.basis_functions.DecModuloBasisFunction(nside=None, dec_limits=None, out_of_bounds_val=-1.0)[source]¶
Bases:
BaseBasisFunction
Emphasize dec bands on a nightly varying basis
- Parameters:
dec_limits (
list
offloat
pairs (None)) – The azimuth limits (degrees) to use.
- class rubin_scheduler.scheduler.basis_functions.DelayStartBasisFunction(nights_delay=1826.25)[source]¶
Bases:
BaseBasisFunction
Force things to not run before a given night.
- Parameters:
nights_delay (
float
, optional) – Return False until conditions.night >= nights_delay.
- class rubin_scheduler.scheduler.basis_functions.EclipticBasisFunction(nside=None, distance_to_eclip=25.0)[source]¶
Bases:
BaseBasisFunction
Mark the area around the ecliptic
- class rubin_scheduler.scheduler.basis_functions.EndOfEveningBasisFunction(time_remaining=30.0, alt_limit=18)[source]¶
Bases:
BaseBasisFunction
Only let observations happen in a limited time before twilight
- class rubin_scheduler.scheduler.basis_functions.FilterChangeBasisFunction(filtername='r')[source]¶
Bases:
BaseBasisFunction
Reward staying in the current filter.
- class rubin_scheduler.scheduler.basis_functions.FilterDistBasisFunction(filtername='r')[source]¶
Bases:
BaseBasisFunction
Track filter distribution, increase reward as fraction of observations in specified filter drops.
- class rubin_scheduler.scheduler.basis_functions.FilterLoadedBasisFunction(filternames='r')[source]¶
Bases:
BaseBasisFunction
Check that the filter(s) needed are loaded.
Are the filters in
filternames
loaded and available?- Parameters:
filternames (
str
orlist
[str
]) – The filternames that need to be mounted to execute.
- class rubin_scheduler.scheduler.basis_functions.FootprintBasisFunction(filtername='r', nside=None, footprint=None, out_of_bounds_val=-10.0)[source]¶
Bases:
BaseBasisFunction
Basis function that tries to maintain a uniformly covered footprint
- Parameters:
filtername (
str
, optional) – The filter for this footprint. Default r.nside (
int
, optional) – The nside for the basis function and features. Default None usesset_default_nside()
footprint (
Footprint
object) – The desired footprint. The default will set this to None, but in general this is really not desirable. In order to make default a kwarg, a current baseline footprint is setup with a Constant footprint (not rolling, not even season aware).out_of_bounds_val (
float
, optional) – The value to set the basis function for regions that are not in the footprint. Default -10, np.nan is another good value to use.
- class rubin_scheduler.scheduler.basis_functions.FootprintNvisBasisFunction(filtername='r', nside=None, footprint=None, nvis=1, out_of_bounds_val=nan)[source]¶
Bases:
BaseBasisFunction
Basis function to drive observations of a given footprint. Good to target of opportunity targets where one might want to observe a region 3 times.
- Parameters:
footprint (
np.array
) – A healpix array (1 for desired, 0 for not desired) of the target footprint.nvis (
int
(1)) – The number of visits to try and gather
- class rubin_scheduler.scheduler.basis_functions.ForceDelayBasisFunction(days_delay=2.0, scheduler_note=None, survey_name=None)[source]¶
Bases:
BaseBasisFunction
Keep a survey from executing too rapidly.
- Parameters:
days_delay (
float
, optional) – The number of days to force a gap on.scheduler_note (
str
or None, optional) – The value of the scheduler_note to count. Default None will not consider scheduler_note.survey_name (
str
or None, optional) – Backwards compatible version of scheduler_note.
- class rubin_scheduler.scheduler.basis_functions.FractionOfObsBasisFunction(frac_total, scheduler_note=None, survey_name=None)[source]¶
Bases:
BaseBasisFunction
Limit the fraction of all observations that can be labelled a certain scheduler note.
Useful for keeping DDFs from exceeding a given fraction of the total survey.
- Parameters:
frac_total (
float
) – The fraction of total observations that can be of this surveyscheduler_note (
str
or None, optional) – The scheduler_note to identify observations from a given survey or survey mode.survey_name (
str
or None, optional) – Deprecated version of scheduler_note. Overriden by scheduler_note if scheduler_note not None.
- class rubin_scheduler.scheduler.basis_functions.GoalStrictFilterBasisFunction(time_lag_min=10.0, time_lag_max=30.0, time_lag_boost=60.0, boost_gain=2.0, unseen_before_lag=False, filtername='r', tag=None, twi_change=-18.0, proportion=1.0, aways_available=False)[source]¶
Bases:
BaseBasisFunction
Remove the bonus for staying in the same filter if certain conditions are met.
If the moon rises/sets or twilight starts/ends, it makes a lot of sense to consider a filter change. This basis function rewards if it matches the current filter, the moon rises or sets, twilight starts or stops, or there has been a large gap since the last observation.
- Parameters:
time_lag_min (
float
) – Minimum time after a filter change for which a new filter change will receive zero reward, or be denied at all (see unseen_before_lag).time_lag_max (
float
) – Time after a filter change where the reward for changing filters achieve its maximum.time_lag_boost (
float
) – Time after a filter change to apply a boost on the reward.boost_gain (
float
) – A multiplier factor for the reward after time_lag_boost.unseen_before_lag (
bool
) – If True will make it impossible to switch filter before time_lag has passed.filtername (
str
) – The filter for which this basis function will be used.tag (
str
or None) – When using filter proportion use only regions with this tag to count for observations.twi_change (
float
) – Switch reward on when twilight changes.proportion (
float
) – The expected filter proportion distribution.aways_available (
bool
) – If this is true the basis function will aways be computed regardless of the feasibility. If False a more detailed feasibility check is performed. When set to False, it may speed up the computation process by avoiding the computation of the reward functions paired with this bf, when observation is not feasible.
- class rubin_scheduler.scheduler.basis_functions.GoodSeeingBasisFunction(nside=None, filtername='r', footprint=None, fwhm_eff_limit=0.8, mag_diff=0.75)[source]¶
Bases:
BaseBasisFunction
Drive observations in good seeing conditions
- class rubin_scheduler.scheduler.basis_functions.HaMaskBasisFunction(ha_min=None, ha_max=None, nside=32)[source]¶
Bases:
BaseBasisFunction
Limit the sky based on hour angle
- Parameters:
ha_min (float (None)) – The minimum hour angle to accept (hours)
ha_max (float (None)) – The maximum hour angle to accept (hours)
- class rubin_scheduler.scheduler.basis_functions.HealpixLimitedBasisFunctionMixin(hpid, *args, **kwargs)[source]¶
Bases:
object
A mixin to limit a basis function to a set of Healpix pixels.
- check_feasibility(conditions)[source]¶
Check the feasibility of the current set of conditions.
- Parameters:
conditions (
rubin_scheduler.scheduler.features.Conditions
) – The conditions for which to test feasibility.- Returns:
feasibility – True if the current set of conditions is feasible, False otherwise.
- Return type:
bool
- class rubin_scheduler.scheduler.basis_functions.HourAngleLimitBasisFunction(RA=0.0, ha_limits=None)[source]¶
Bases:
BaseBasisFunction
Only execute a survey in limited hour angle ranges. Useful for limiting Deep Drilling Fields.
- Parameters:
RA (float (0.)) – RA of the target (degrees).
ha_limits (list of lists) – limits for what hour angles are acceptable (hours). e.g., to give 4 hour window around RA=0, ha_limits=[[22,24], [0,2]]
- class rubin_scheduler.scheduler.basis_functions.InTimeWindowBasisFunction(mjd_windows=[])[source]¶
Bases:
BaseBasisFunction
Only let a survey go if it is in a defined season
- Parameters:
mjd_windows (
list
) – List of mjd pairs. feasability will only pass if the current MJD falls in a viable range, e.g. seaons=[[1,2], [10,13]], means observations can happen on mjd=1,2,10,11,12,13.
- class rubin_scheduler.scheduler.basis_functions.LimitRepeatBasisFunction(nside=None, filtername='r', n_limit=2)[source]¶
Bases:
BaseBasisFunction
Mask out pixels that haven’t been observed in the night.
- Parameters:
nside (
int
or None) – Nside for the basis function values. Default None will use default nside.filtername (
str
or None) – Filter to consider when tracking number of acquired observations.
- class rubin_scheduler.scheduler.basis_functions.LookAheadDdfBasisFunction(frac_total, aggressive_fraction, time_needed=30.0, RA=0.0, ha_limits=None, scheduler_note=None, survey_name=None, time_jump=44.0, sun_alt_limit=-18.0)[source]¶
Bases:
BaseBasisFunction
Look into the future to decide if it’s a good time to observe or block.
- Parameters:
frac_total (float) – The fraction of total observations that can be of this survey
aggressive_fraction (float) – If the fraction of observations drops below ths value, be more aggressive in scheduling. e.g., do not wait for conditions to improve, execute as soon as possible.
time_needed (float (30.)) – Estimate of the amount of time needed to execute DDF sequence (minutes).
RA (float (0.)) – The RA of the DDF
ha_limits (list of lists (None)) – limits for what hour angles are acceptable (hours). e.g., to give 4 hour window around HA=0, ha_limits=[[22,24], [0,2]]
scheduler_note (
str
or None, optional) – The scheduler_note to identify observations from a given survey or survey mode.survey_name (
str
or None, optional) – Deprecated version of scheduler_note. Overriden by scheduler_note if scheduler_note not None.time_jump (float (44.)) – The amount of time to assume will jump ahead if another survey executes (minutes)
sun_alt_limit (float (-18.)) – The limit to assume twilight starts (degrees)
- class rubin_scheduler.scheduler.basis_functions.M5DiffAtHpixBasisFunction(hpid, *args, **kwargs)[source]¶
Bases:
HealpixLimitedBasisFunctionMixin
,M5DiffBasisFunction
- class rubin_scheduler.scheduler.basis_functions.M5DiffBasisFunction(filtername='r', fiducial_FWHMEff=0.7, nside=None)[source]¶
Bases:
BaseBasisFunction
Basis function based on the 5-sigma depth. Look up the best depth a healpixel achieves, and compute the limiting depth difference given current conditions
- Parameters:
filtername (
str
, optional) – The filter to consider for visits.fiducial_FWHMEff (
float
, optional) – The zenith seeing to assume for “good” conditions. While the dark sky depth map simply scales with this value, picking a reasonable fiducial_FWHMEff is important because this effects the overall value and scale of the reward from the basis function.nside (
int
, optional) – The nside for the basis function. Default None usesset_default_nside()
.
- class rubin_scheduler.scheduler.basis_functions.MapCloudBasisFunction(nside=None, max_cloud_map=None, max_val=0.7, out_of_bounds_val=nan)[source]¶
Bases:
BaseBasisFunction
Mark healpixels on a map if their cloud values are greater than the same healpixels on a maximum cloud map. Currently a placeholder for when the telemetry stream can include a full sky cloud map.
- Parameters:
nside (int (default_nside)) – The healpix resolution.
max_cloud_map (numpy array (None)) – A healpix map showing the maximum allowed cloud values for all points on the sky
out_of_bounds_val (float (10.)) – Point value to give regions where there are no observations requested
- class rubin_scheduler.scheduler.basis_functions.MapModuloBasisFunction(inmaps)[source]¶
Bases:
BaseBasisFunction
Similar to Dec_modulo, but now use input masks
- Parameters:
inmaps (
list
of hp arrays)
- class rubin_scheduler.scheduler.basis_functions.MaskAzimuthBasisFunction(nside=None, out_of_bounds_val=nan, az_min=0.0, az_max=180.0)[source]¶
Bases:
BaseBasisFunction
Mask pixels based on azimuth
- class rubin_scheduler.scheduler.basis_functions.MoonAvoidanceBasisFunction(nside=None, moon_distance=30.0)[source]¶
Bases:
BaseBasisFunction
Avoid looking too close to the moon.
- Parameters:
moon_distance (float (30.)) – Minimum allowed moon distance. (degrees)
XXX--TODO (This could be a more complicated function of filter)
phase. (and moon)
- class rubin_scheduler.scheduler.basis_functions.MoonDistPointRangeBasisFunction(ra, dec, moon_limit=15.0)[source]¶
Bases:
BaseBasisFunction
Set a moon distance limit for a single point.
- Parameters:
ra (
float
) – The RA of the point (degrees)dec (
float
) – The Dec of the point (degrees)moon_limit (
float
) – The angular distance to demand from the moon (degrees). Default 15.
- class rubin_scheduler.scheduler.basis_functions.MoonDownBasisFunction(nside=None, filtername=None, **kwargs)[source]¶
Bases:
BaseBasisFunction
Demand the moon is down
- class rubin_scheduler.scheduler.basis_functions.NGoodSeeingBasisFunction(filtername='r', nside=None, seeing_fwhm_max=0.8, m5_penalty_max=0.5, n_obs_desired=3, mjd_start=None, footprint=None)[source]¶
Bases:
BaseBasisFunction
Try to get N “good seeing” images each observing season.
- Parameters:
filtername (
str
) – Bandpass in which to count images. Default r.nside (
int
) – The nside of the map for the basis function. Should match survey and scheduler nside. Default None usesset_default_nside
.seeing_fwhm_max (
float
) – Value to consider as “good” threshold (arcsec). Default of 0.8 arcseconds.m5_penalty_max (
float
) – The maximum depth loss that is considered acceptable (magnitudes), compared to the dark-sky map in this filter. Default 0.5 magnitudes.n_obs_desired (
int
) – Number of good seeing observations to collect per season. Default 3.mjd_start (
float
) – The starting MJD of the survey. Default None usesrubin_scheduler.utils.survey_start_mjd()
.footprint (
np.array
, (N,)) – Only use area where footprint > 0. Should be a HEALpix map. Default None callsget_current_footprint()
.
- class rubin_scheduler.scheduler.basis_functions.NObsHighAmBasisFunction(nside=None, filtername='r', footprint=None, n_obs=3, season=300.0, am_limits=[1.5, 2.2], out_of_bounds_val=nan)[source]¶
Bases:
BaseBasisFunction
Reward only reward/count observations at high airmass.
- class rubin_scheduler.scheduler.basis_functions.NObsPerYearBasisFunction(filtername='r', nside=None, footprint=None, n_obs=3, season=300, season_start_hour=-4.0, season_end_hour=2.0, night_max=365)[source]¶
Bases:
BaseBasisFunction
Reward areas that have not been observed N-times in the last year
- Parameters:
filtername (
str
(‘r’)) – The filter to trackfootprint (
np.array
) – Should be a HEALpix map. Values of 0 or np.nan will be ignored.n_obs (
int
(3)) – The number of observations to demandseason (
float
(300)) – The amount of time to allow pass before marking a region as “behind”. Default 365.25 (days).season_start_hour (
float
(-2)) – When to start the season relative to RA 180 degrees away from the sun (hours)season_end_hour (
float
(2)) – When to consider a season ending, the RA relative to the sun + 180 degrees. (hours)night_max (float (365)) – Set value to zero after night_max is reached (days)
- class rubin_scheduler.scheduler.basis_functions.NearSunHighAirmassBasisFunction(nside=None, max_airmass=2.5, penalty=nan)[source]¶
Bases:
BaseBasisFunction
Reward areas on the sky at high airmass, within 90 degrees azimuth of the Sun, such as suitable for the near-sun twilight microsurvey for near- or interior-to earth asteroids.
- Parameters:
nside (
int
, optional) – Nside for the basis function. If None, usesset_default_nside()
.max_airmass (
float
, oprionl) – The maximum airmass to try and observe (unitless).penalty (
float
, optional) – The value to fill in non-rewarded parts of the sky. Default np.nan, which serves to mask regions exceeding the airmass limit and more than 90 degrees azimuth toward the sun.
- class rubin_scheduler.scheduler.basis_functions.NearSunTwilightBasisFunction(*args, **kwargs)[source]¶
- class rubin_scheduler.scheduler.basis_functions.NightModuloBasisFunction(pattern=None)[source]¶
Bases:
BaseBasisFunction
Only return true on certain nights
- class rubin_scheduler.scheduler.basis_functions.NotTwilightBasisFunction(sun_alt_limit=-18)[source]¶
Bases:
BaseBasisFunction
- class rubin_scheduler.scheduler.basis_functions.ObservedTwiceBasisFunction(nside=None, filtername='r', n_obs_needed=2, n_obs_in_filt_needed=1)[source]¶
Bases:
BaseBasisFunction
Mask out pixels that haven’t been observed in the night
- class rubin_scheduler.scheduler.basis_functions.OnceInNightBasisFunction(notes=[])[source]¶
Bases:
BaseBasisFunction
Stop observing if something has been executed already in the night
- Parameters:
notes (
list
[str
]) – A list of str to check if any observations with a matching note exist.
- class rubin_scheduler.scheduler.basis_functions.PlanetMaskBasisFunction(mask_radius=3.5, planets=None, nside=None, scale=100000.0)[source]¶
Bases:
BaseBasisFunction
Mask the bright planets
- Parameters:
mask_radius (float (3.5)) – The radius to mask around a planet (degrees).
planets (list of str (None)) – A list of planet names to mask. Defaults to [‘venus’, ‘mars’, ‘jupiter’]. Not including Saturn because it moves really slow and has average apparent mag of ~0.4, so fainter than Vega.
- class rubin_scheduler.scheduler.basis_functions.RewardNObsSequence(n_obs_survey, note_survey, nside=None)[source]¶
Bases:
BaseBasisFunction
Reward taking a sequence of observations.
- Parameters:
n_obs_survey (
int
) – Number of observations to reward.note_survey (
str
) – The value of the observation note, to take into account.nside (
int
, optional) – Healpix map resolution (ignored).
Notes
This basis function is useful when a survey is composed of more than one observation (e.g. in different filters) and one wants to make sure they are all taken together.
- class rubin_scheduler.scheduler.basis_functions.RewardRisingBasisFunction(slope=0.1, penalty_val=0, nside=None)[source]¶
Bases:
BaseBasisFunction
Reward parts of the sky that are rising. Optionally, mask out parts of the sky that are not rising.
This produces a reward that increases as the field rises toward zenith, then abruptly falls as the field passes zenith. Negative hour angles (or hour angles > 180 degrees) indicate a rising point on the sky.
- Parameters:
slope (
float
) – Sets the ‘slope’ of how fast the basis function value changes with hour angle.penalty_val (
float
ornp.nan
, optional) – Sets the value for the part of the sky which is not rising (hour angle between 0 and 180). Using a value of np.nan will mask this region of sky, a value of 0 will just make this non-rewarding.nside (
int
or None, optional) – Nside for the healpix map, default of None uses scheduler default.
- class rubin_scheduler.scheduler.basis_functions.RisingMoreBasisFunction(RA, pad=30.0)[source]¶
Bases:
BaseBasisFunction
Say a spot is not available if it will rise substantially before twilight.
- Parameters:
RA (float) – The RA of the point in the sky (degrees)
pad (float) – When to start observations if there’s plenty of time before twilight (minutes)
- class rubin_scheduler.scheduler.basis_functions.SeasonCoverageBasisFunction(filtername='r', nside=None, footprint=None, n_per_season=3, mjd_start=None, season_frac_start=0.5)[source]¶
Bases:
BaseBasisFunction
Basis function to encourage N observations per observing season.
- Parameters:
filtername (
str
, optional) – Count observations in this filter. Default ‘r’.nside (
int
, optional) – Nside for the healpix map to use for the feature. This should match the nside of the survey and scheduler.footprint (
np.array
(N,), optional) – Healpix map of the footprint where one should demand coverage every season. Default None will callget_current_footprint()
.n_per_season (
int
, optional) – The number of observations to attempt to gather every season. Default of 3 is suitable for first year template building.mjd_start (
float
, optional) – The mjd of the start of the survey (days). Default None usesrubin_scheduler.utils.survey_start_mjd()
.season_frac_start (
float
) – Only start trying to gather observations after a season is fractionally this far along. Seasons start when the apparent position of sun is at the RA of the pixel (0) and finish when the sun returns again to this RA. The default of 0.5 means that the basis function will not start returning values until the RA reaches the peak of its season.
- class rubin_scheduler.scheduler.basis_functions.SimpleArrayBasisFunction(value, *args, **kwargs)[source]¶
Bases:
BaseBasisFunction
- class rubin_scheduler.scheduler.basis_functions.SkybrightnessLimitAtHpixBasisFunction(hpid, *args, **kwargs)[source]¶
Bases:
HealpixLimitedBasisFunctionMixin
,SkybrightnessLimitBasisFunction
- class rubin_scheduler.scheduler.basis_functions.SkybrightnessLimitBasisFunction(nside=None, filtername='r', sbmin=20.0, sbmax=30.0)[source]¶
Bases:
BaseBasisFunction
Mask regions that are outside a sky brightness limit.
- Parameters:
nside (
int
, optional) – The nside for the basis function. Default None usesset_default_nside()
.filtername (
str
, optional) – The filter to consider for the skybrightness pre values.sbmin (
float
, optional) – The minimum (brightest) skybrightness to consider (mags). Default of 20 will cut out some times of night or parts of the sky.sbmax (
float
, optional) – The maximum (faintest) skybrightness to consider (mags). Default of 30 will pass all skybrightness values.
- class rubin_scheduler.scheduler.basis_functions.SlewtimeBasisFunction(max_time=135.0, filtername='r', nside=None)[source]¶
Bases:
BaseBasisFunction
Reward slews that take little time
- Parameters:
max_time (
float
) – The estimated maximum slewtime (seconds). Used to normalize so the basis function spans ~ -1-0 in reward units. Default 135 seconds corresponds to just slightly less than a filter change.filtername (
str
, optional) – The filter to check for pre-post slewtime estimates. If a slew includes a filter change, other basis functions will decide on the reward, so the result here can be 0.nside (
int
, optional) – Nside for the basis function. Default None will useset_default_nside()
.
- class rubin_scheduler.scheduler.basis_functions.SoftDelayBasisFunction(fractions=[0.0, 0.009, 0.017], delays=[0.0, 0.5, 1.5], scheduler_note=None, survey_name=None)[source]¶
Bases:
BaseBasisFunction
Like Force_delay, but go ahead and let things catch up if they fall far behind.
- Parameters:
fractions (
list
[float
])delays (
list
[float
])scheduler_note (
str
or None, optional) – The scheduler_note to identify observations from a given survey or survey mode.survey_name (
str
or None, optional) – Deprecated version of scheduler_note. Overriden by scheduler_note if not None.
- class rubin_scheduler.scheduler.basis_functions.SolarElongMaskBasisFunction(elong_limit=45.0, nside=32)[source]¶
Bases:
BaseBasisFunction
Mask regions larger than some solar elongation limit
- Parameters:
elong_limit (float (45)) – The limit beyond which to mask (degrees)
- class rubin_scheduler.scheduler.basis_functions.SolarElongationMaskBasisFunction(min_elong=0.0, max_elong=60.0, nside=None, penalty=nan)[source]¶
Bases:
BaseBasisFunction
Mask things at various solar elongations
- Parameters:
min_elong (float (0)) – The minimum solar elongation to consider (degrees).
max_elong (float (60.)) – The maximum solar elongation to consider (degrees).
- class rubin_scheduler.scheduler.basis_functions.StrictFilterBasisFunction(time_lag=10.0, filtername='r', twi_change=-18.0, note_free='DD')[source]¶
Bases:
BaseBasisFunction
Remove the bonus for staying in the same filter if certain conditions are met.
If the moon rises/sets or twilight starts/ends, it makes a lot of sense to consider a filter change. This basis function rewards if it matches the current filter, the moon rises or sets, twilight starts or stops, or there has been a large gap since the last observation.
- Parameters:
time_lag (
float
(10.)) – If there is a gap between observations longer than this, let the filter change (minutes)twi_change (
float
(-18.)) – The sun altitude to consider twilight starting/ending (degrees)note_free (
str
(‘DD’)) – No penalty for changing filters if the last observation note field includesnote_free
string. Useful for giving a free filter change after deep drilling sequence
- class rubin_scheduler.scheduler.basis_functions.SunAltHighLimitBasisFunction(alt_limit=-15.0)[source]¶
Bases:
BaseBasisFunction
Don’t observe unless the sun is above some limit
- Parameters:
alt_limit (float (-15)) – Sun must be above alt_limit (degrees). Default -15.
- class rubin_scheduler.scheduler.basis_functions.SunAltLimitBasisFunction(alt_limit=-12.1)[source]¶
Bases:
BaseBasisFunction
Only observe if the sun is below a given altitude limit.
- Parameters:
alt_limit (
float
) – The maximum altitude for the sun.
- class rubin_scheduler.scheduler.basis_functions.SunHighLimitBasisFunction(sun_alt_limit=-14.8, time_to_12deg=21.0, time_remaining=15.0)[source]¶
Bases:
CloseToTwilightBasisFunction
- class rubin_scheduler.scheduler.basis_functions.TargetMapBasisFunction(filtername='r', nside=None, target_map=None, norm_factor=None, out_of_bounds_val=-10.0)[source]¶
Bases:
BaseBasisFunction
Basis function that tracks number of observations and tries to match a specified spatial distribution.
In general, this is deprecated in favor of
FootprintBasisFunction
.- Parameters:
filtername (
str
(‘r’)) – The name of the filter for this target map.nside (
int
(default_nside)) – The healpix resolution.target_map (
np.array
(None)) – A healpix map showing the ratio of observations desired for all points on the skynorm_factor (
float
(0.00010519)) – for converting target map to number of observations. Should be the area of the camera divided by the area of a healpixel divided by the sum of all your goal maps. Default value assumes LSST foV has 1.75 degree radius and the standard goal maps. If using multiple filters, see rubin_scheduler.utils.calc_norm_factor for a utility that computes norm_factor.out_of_bounds_val (
float
(-10.)) – Reward value to give regions where there are no observations requested (unitless).
- class rubin_scheduler.scheduler.basis_functions.TargetMapModuloBasisFunction(day_offset=None, filtername='r', nside=None, target_maps=None, norm_factor=None, out_of_bounds_val=-10.0, season_modulo=2, max_season=None, season_length=365.25)[source]¶
Bases:
BaseBasisFunction
Basis function that tracks number of observations and tries to match a specified spatial distribution can enter multiple maps that will be used at different times in the survey
- Parameters:
day_offset (np.array) – Healpix map that has the offset to be applied to each pixel when computing what season it is on.
filtername ((string 'r')) – The name of the filter for this target map.
nside (int (default_nside)) – The healpix resolution.
target_maps (list of numpy array (None)) – healpix maps showing the ratio of observations desired for all points on the sky. Last map will be used for season -1. Probably shouldn’t support going to season less than -1.
norm_factor (float (0.00010519)) – for converting target map to number of observations. Should be the area of the camera divided by the area of a healpixel divided by the sum of all your goal maps. Default value assumes LSST foV has 1.75 degree radius and the standard goal maps. If using mulitple filters, see rubin_scheduler.scheduler.utils.calc_norm_factor for a utility that computes norm_factor.
out_of_bounds_val (float (-10.)) – Reward value to give regions where there are no observations requested (unitless).
season_modulo (int (2)) – The value to modulate the season by (years).
max_season (int (None)) – For seasons higher than this value (pre-modulo), the final target map is used.
- class rubin_scheduler.scheduler.basis_functions.TemplateGenerateBasisFunction(nside=None, day_gap=250.0, filtername='r', footprint=None)[source]¶
Bases:
BaseBasisFunction
Emphasize areas that have not been observed in a long time
- Parameters:
nside (
int
, optional) – The nside for the basis function and feature. Default None usesset_default_nside()
.day_gap (
float
, optional) – How long to wait before boosting the reward (days). Default of 250 pushes visits into parts of the sky which missed a significant chunk of a season.filtername (
str
, optional) – The filter to consider when tracking observations.footprint (
np.array
, (N,)) – The indices of the healpixels to apply the boost to. Default None will callget_current_footprint()
.
- class rubin_scheduler.scheduler.basis_functions.ThirdObservationBasisFunction(nside=32, filtername1='r', filtername2='z', gap_min=40.0, gap_max=120.0)[source]¶
Bases:
BaseBasisFunction
If there have been observations in two filters long enough ago, go for a third
- Parameters:
gap_min (
float
(40.)) – The minimum time gap to consider a pixel good (minutes)gap_max (
float
(120)) – The maximum time to consider going for a pair (minutes)
- class rubin_scheduler.scheduler.basis_functions.TimeInTwilightBasisFunction(time_needed=5.0)[source]¶
Bases:
BaseBasisFunction
Make sure there is some time left in twilight.
- Parameters:
time_needed (float (5)) – The time needed remaining in twilight (minutes)
- class rubin_scheduler.scheduler.basis_functions.TimeToScheduledBasisFunction(time_needed=30.0)[source]¶
Bases:
BaseBasisFunction
Make sure there is enough time before next scheduled observation. Useful if you want to check before starting a long sequence of observations.
- Parameters:
time_needed (float (30.)) – The time needed to run a survey (mintues).
- class rubin_scheduler.scheduler.basis_functions.TimeToTwilightBasisFunction(time_needed=30.0, alt_limit=18)[source]¶
Bases:
BaseBasisFunction
Make sure there is enough time before twilight. Useful if you want to check before starting a long sequence of observations.
- Parameters:
time_needed (float (30.)) – The time needed to run a survey (mintues).
alt_limit (int (18)) – The sun altitude limit to use. Must be 12 or 18
- class rubin_scheduler.scheduler.basis_functions.VisitGap(note, filter_names=None, gap_min=25.0, penalty_val=nan)[source]¶
Bases:
BaseBasisFunction
Basis function to create a visit gap based on the survey note field.
- Parameters:
note (str) – Value of the observation “scheduler_note” field to be masked.
filter_names (list [str], optional) – List of filter names that will be considered when evaluating if the gap has passed.
gap_min (float (optional)) – Time gap (default=25, in minutes).
penalty_val (float or np.nan) – Value of the penalty to apply (default is np.nan).
Notes
When a list of filters is provided, all filters must be observed before the gap requirement will be activated, and once activated, only observations in these filters will be evaluated in context of whether the last observation was at least gap in the past.
- class rubin_scheduler.scheduler.basis_functions.VisitRepeatBasisFunction(gap_min=25.0, gap_max=45.0, filtername='r', nside=None, npairs=1)[source]¶
Bases:
BaseBasisFunction
Basis function to reward re-visiting an area on the sky. Looking for Solar System objects.
- Parameters:
gap_min (
float
(15.)) – Minimum time for the gap (minutes)gap_max (
float
(45.)) – Maximum time for a gapfiltername (
str
(‘r’)) – The filter(s) to count with pairsnpairs (
int
(1)) – The number of pairs of observations to attempt to gather
- class rubin_scheduler.scheduler.basis_functions.ZenithMaskBasisFunction(min_alt=20.0, max_alt=82.0, nside=None)[source]¶
Bases:
BaseBasisFunction
Just remove the area near zenith.
- Parameters:
min_alt (float (20.)) – The minimum possible altitude (degrees)
max_alt (float (82.)) – The maximum allowed altitude (degrees)
- class rubin_scheduler.scheduler.basis_functions.ZenithShadowMaskBasisFunction(nside=None, min_alt=20.0, max_alt=82.0, shadow_minutes=40.0, penalty=nan, site='LSST')[source]¶
Bases:
BaseBasisFunction
Mask the zenith, and things that will soon pass near zenith. Useful for making sure observations will not be too close to zenith when they need to be observed again (e.g. for a pair).
- Parameters:
min_alt (float (20.)) – The minimum alititude to alow. Everything lower is masked. (degrees)
max_alt (float (82.)) – The maximum altitude to alow. Everything higher is masked. (degrees)
shadow_minutes (float (40.)) – Mask anything that will pass through the max alt in the next shadow_minutes time. (minutes)