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

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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].

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.AltAzShadowMaskBasisFunction(nside=32, min_alt=20.0, max_alt=86.5, min_az=0, max_az=360, shadow_minutes=40.0, pad=3.0, scale=1000)[source]

Bases: BaseBasisFunction

Mask out a range of altitudes and azimuths, including

regions which will enter the mask within shadow_minutes.

Masks any alt/az regions as specified by the conditions object in conditions.sky_az_limits and conditions.sky_alt_limits, as well as values as provided by min_alt, max_alt, min_az and max_az.

Parameters:
  • nside (int or None) – 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).

  • min_az (float) – Minimum azimuth value to apply to the mask. Default 0 (degrees). These azimuth values are absolute azimuth, not cumulative. The absolute and cumulative azimuth only diverge if the azimuth range is greater than 360 degrees.

  • max_az (float) – Maximum azimuth value to apply to the mask. Default 360 (degrees).

  • shadow_minutes (float) – How long to extend masked area in longitude. Default 40 (minutes). Choose this value based on the time between when a field might be chosen to be scheduled and when it might be observed. For pairs, the minimum pair time + some buffer is good. For sequences, try the length of the sequence + some buffer. Note that this just sets up the shadow at the shadow_minutes time (and not all times up to shadow_minutes).

  • pad (float) – The value by which to pad the telescope limits, to avoid healpix values mapping into pointings from the field tesselations which are actually out of bounds. This should typically be a bit more than the radius of the fov. (degrees).

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

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.AvoidDirectWind(wind_speed_maximum=20.0, nside=32)[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 uses set_default_nside().

class rubin_scheduler.scheduler.basis_functions.AvoidFastRevisitsBasisFunction(filtername='r', nside=32, 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.AzModuloBasisFunction(nside=32, 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 of float pairs (None)) – The azimuth limits (degrees) to use.

class rubin_scheduler.scheduler.basis_functions.AzimuthBasisFunction(nside=32)[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=32)[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=32, 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 observation

  • indx (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.ObservationArray). 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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

label()[source]

Create a label for this basis function.

Returns:

label – A string suitable for labeling the basis function in a plot or table.

Return type:

str

class rubin_scheduler.scheduler.basis_functions.CadenceEnhanceBasisFunction(filtername='gri', nside=32, 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 together

  • supress_window (list of float) – 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 cadence drive 0. Probably works as a bool array too.

class rubin_scheduler.scheduler.basis_functions.CadenceEnhanceTrapezoidBasisFunction(filtername='gri', nside=32, 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 together

  • string! (XXX--fill out doc)

class rubin_scheduler.scheduler.basis_functions.CadenceInSeasonBasisFunction(drive_map, filtername='griz', season_span=2.5, cadence=2.5, nside=32)[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 within time_to_12deg of -12 degree twilight, and there is at least time_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 execute

  • max_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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.CloudedOutBasisFunction(cloud_limit=0.7)[source]

Bases: BaseBasisFunction

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.ConstantBasisFunction(nside=32, filtername=None, **kwargs)[source]

Bases: BaseBasisFunction

Just add a constant

class rubin_scheduler.scheduler.basis_functions.DecModuloBasisFunction(nside=32, dec_limits=None, out_of_bounds_val=-1.0)[source]

Bases: BaseBasisFunction

Emphasize dec bands on a nightly varying basis

Parameters:

dec_limits (list of float 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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.EclipticBasisFunction(nside=32, 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

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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 or list [ str ]) – The filternames that need to be mounted to execute.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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 uses set_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 set up 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.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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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 survey

  • 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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.GoodSeeingBasisFunction(nside=32, 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]]

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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)

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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=32)[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 uses set_default_nside().

class rubin_scheduler.scheduler.basis_functions.MapCloudBasisFunction(nside=32, 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.MoonAvoidanceBasisFunction(nside=32, moon_distance=30.0)[source]

Bases: BaseBasisFunction

Avoid observing within moon_distance of the moon.

Parameters:

moon_distance (float (30.)) – Minimum allowed moon distance. (degrees)

Notes

As the current specified requirements for the observatory are “observe more than 30 degrees from the moon”, this basis function simply does that at present. This includes times the moon is below the horizon or if the moon close to new. Most likely, this avoidance region should depend on lunar phase, the filter used for observations, and whether the moon is above or below the horizon.

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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.MoonDownBasisFunction(nside=32, filtername=None, **kwargs)[source]

Bases: BaseBasisFunction

Demand the moon is down

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.NGoodSeeingBasisFunction(filtername='r', nside=32, 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 uses set_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 uses rubin_scheduler.utils.SURVEY_START_MJD.

  • footprint (np.array, (N,)) – Only use area where footprint > 0. Should be a HEALpix map. Default None calls get_current_footprint().

class rubin_scheduler.scheduler.basis_functions.NObsHighAmBasisFunction(nside=32, 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.

add_observation(observation, indx=None)[source]
Parameters:
  • observation (np.array) – An array with information about the input observation

  • indx (np.array) – The indices of the healpix map that the observation overlaps with

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.NObsPerYearBasisFunction(filtername='r', nside=32, 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 track

  • footprint (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 demand

  • season (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=32, 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, uses set_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.NightModuloBasisFunction(pattern=None)[source]

Bases: BaseBasisFunction

Only return true on certain nights

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.NotTwilightBasisFunction(sun_alt_limit=-18)[source]

Bases: BaseBasisFunction

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.PlanetMaskBasisFunction(mask_radius=3.5, planets=None, nside=32, 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 slowly 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=32)[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=32)[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 or np.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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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)

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.SeasonCoverageBasisFunction(filtername='r', nside=32, 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 call get_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 uses rubin_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.SlewtimeBasisFunction(max_time=135.0, filtername='r', nside=32)[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 use set_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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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=32, 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 includes note_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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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)

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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).

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

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.

check_feasibility(conditions)[source]

If there is logic to decide if something is feasible (e.g., only if moon is down), it can be calculated here.

Helps prevent full __call__ from being called more than needed.

class rubin_scheduler.scheduler.basis_functions.VisitRepeatBasisFunction(gap_min=25.0, gap_max=45.0, filtername='r', nside=32, 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 gap

  • filtername (str (‘r’)) – The filter(s) to count with pairs

  • npairs (int (1)) – The number of pairs of observations to attempt to gather