Surveys

class rubin_scheduler.scheduler.surveys.BaseMarkovSurvey(basis_functions, basis_weights, extra_features=None, smoothing_kernel=None, ignore_obs=None, survey_name=None, scheduler_note=None, nside=32, seed=42, dither=True, detailers=None, camera='LSST', fields=None, area_required=None, npositions=7305, target_name=None, science_program=None, observation_reason=None)[source]

Bases: BaseSurvey

A Markov Decision Function survey object. Uses Basis functions to compute a final reward function and decide what to observe based on the reward. Includes methods for dithering and defaults to dithering nightly.

Parameters:
  • basis_function (list of rubin_scheduler.scheduler.basis_function)

  • basis_weights (list of float) – Must be same length as basis_function

  • seed (hashable) – Random number seed, used for randomly orienting sky tessellation.

  • camera (str ('LSST')) – Should be ‘LSST’ or ‘comcam’

  • fields (np.array (None)) – An array of field positions. Should be numpy array with columns of “RA” and “dec” in radians. If none, site_models.read_fields or utils.comcam_tessellate is used to read field positions.

  • area_required (float (None)) – The valid area that should be present in the reward function (square degrees).

  • npositions (int (7305)) – The number of dither positions to pre-compute. Defaults to 7305 (so good for 20 years)

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

generate_observations_rough(conditions)[source]
Returns:

  1. None

  2. A list of observations

Return type:

one of

smooth_reward()[source]

If we want to smooth the reward function.

class rubin_scheduler.scheduler.surveys.BaseSurvey(basis_functions, extra_features=None, extra_basis_functions=None, ignore_obs=None, survey_name=None, scheduler_note=None, nside=32, detailers=None, scheduled_obs=None, target_name=None, science_program=None, observation_reason=None)[source]

Bases: object

A baseclass for survey objects.

Parameters:
  • basis_functions (list) – List of basis_function objects

  • extra_features (list XXX--should this be a dict for clarity?) – List of any additional features the survey may want to use e.g., for computing final dither positions.

  • extra_basis_functions (dict of rubin_scheduler.scheduler.basis_function) – Extra basis function objects. Typically not passed in, but et in the __init__.

  • ignore_obs (list of str (None)) – If an incoming observation has this string in the note, ignore it. Handy if one wants to ignore DD fields or observations requested by self. Take note, if a survey is called ‘mysurvey23’, setting ignore_obs to ‘mysurvey2’ will ignore it because ‘mysurvey2’ is a substring of ‘mysurvey23’.

  • detailers (list of rubin_scheduler.scheduler.detailers objects) – The detailers to apply to the list of observations.

  • scheduled_obs (np.array) – An array of MJD values for when observations should execute.

  • target_name (str) – A target name label. Will be added to a final detailer, so should override any target_name set elsewhere. Default None.

  • science_program (str) – A science program label. Will be added to a final detailer, so should override any science_program set elsewhere. Default None.

  • observation_reason (str) – An observation reason label. Will be added to a final detailer, so should override any observation_reason set elsewhere. Default None.

add_observations_array(observations_array_in, observations_hpid_in)[source]

Add an array of observations rather than one at a time

Parameters:
  • observations_array_in (ObservationArray) – An array of completed observations, rubin_scheduler.scheduler.utils.ObservationArray

  • observations_hpid_in (np.array) – Same as observations_array_in, but larger and with an additional column for HEALpix id. Each observation is listed mulitple times, once for every HEALpix it overlaps.

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

generate_observations_rough(conditions)[source]
Returns:

  1. None

  2. A list of observations

Return type:

one of

make_reward_df(conditions, accum=True)[source]

Create a pandas.DataFrame describing the reward from the survey.

Parameters:
Returns:

reward_df – A table of surveys listing the rewards.

Return type:

pandas.DataFrame

reward_changes(conditions)[source]

List the rewards for each basis function used by the survey.

Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions) – Conditions for which rewards are to be returned

Returns:

rewards – A list of tuples, each with a basis function name and the maximum reward returned by that basis function for the provided conditions.

Return type:

list

class rubin_scheduler.scheduler.surveys.BlobSurvey(basis_functions, basis_weights, filtername1='r', filtername2='g', slew_approx=7.5, filter_change_approx=140.0, read_approx=2.4, exptime=30.0, nexp=2, nexp_dict=None, ideal_pair_time=22.0, flush_time=30.0, smoothing_kernel=None, nside=32, dither=True, seed=42, ignore_obs=None, survey_name=None, detailers=None, camera='LSST', twilight_scale=True, in_twilight=False, check_scheduled=True, min_area=None, grow_blob=True, area_required=None, max_radius_peak=40.0, fields=None, search_radius=None, alt_max=-9999, az_range=-9999, target_name=None, observation_reason=None, science_program=None)[source]

Bases: GreedySurvey

Select observations in large, mostly contiguous, blobs.

Parameters:
  • filtername1 (str) – The filter to observe in.

  • filtername2 (str) – The filter to pair with the first observation. If set to None, no pair will be observed.

  • slew_approx (float) – The approximate slewtime between neerby fields (seconds). Used to calculate how many observations can be taken in the desired time block.

  • filter_change_approx (float) – The approximate time it takes to change filters (seconds).

  • read_approx (float) – The approximate time required to readout the camera (seconds).

  • exptime (float) – The total on-sky exposure time per visit.

  • nexp (int) – The number of exposures to take in a visit.

  • exp_dict (dict) – If set, should have keys of filtername and values of ints that are the nuber of exposures to take per visit. For estimating block time, nexp is still used.

  • ideal_pair_time (float) – The ideal time gap wanted between observations to the same pointing (minutes)

  • flush_time (float) – The time past the final expected exposure to flush the queue. Keeps observations from lingering past when they should be executed. (minutes)

  • twilight_scale (bool) – Scale the block size to fill up to twilight. Set to False if running in twilight

  • in_twilight (bool) – Scale the block size to stay within twilight time.

  • check_scheduled (bool) – Check if there are scheduled observations and scale blob size to match

  • min_area (float) – If set, demand the reward function have an area of so many square degrees before executing

  • grow_blob (bool) – If True, try to grow the blob from the global maximum. Otherwise, just use a simple sort. Simple sort will not constrain the blob to be contiguous.

  • max_radius_peak (float) – The maximum radius to demand things be within the maximum of the reward function. (degrees) Note that traveling salesman solver can have rare failures if this is set too large (probably issue with projection effects or something).

Notes

The scheduler_note for the BlobSurvey will be set from the survey_name. A typical Detailer for the blob survey then adds onto this note to identify the first vs. second visit of the pair. Because the scheduler_note is modified, users do not set scheduler_note directly.

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

generate_observations_rough(conditions)[source]

Find a good block of observations.

simple_order_sort()[source]

Fall back if we can’t link contiguous blobs in the reward map

class rubin_scheduler.scheduler.surveys.DeepDrillingSurvey(basis_functions, RA, dec, sequence='rgizy', nvis=[20, 10, 20, 26, 20], exptime=30.0, u_exptime=30.0, nexp=2, ignore_obs=None, survey_name='DD', reward_value=None, readtime=2.0, filter_change_time=120.0, nside=32, flush_pad=30.0, seed=42, detailers=None)[source]

Bases: BaseSurvey

A survey class for running deep drilling fields.

Parameters:
  • basis_functions (list of rubin_scheduler.scheduler.basis_function) – These should be feasibility basis functions.

  • RA (float) – The RA of the field (degrees)

  • dec (float) – The dec of the field to observe (degrees)

  • sequence (list of observation objects or str (rgizy)) – The sequence of observations to take. Can be a string of list of obs objects.

  • nvis (list of ints) – The number of visits in each filter. Should be same length as sequence.

  • survey_name (str (DD)) – The name to give this survey so it can be tracked

  • reward_value (float (101.)) – The reward value to report if it is able to start (unitless).

  • readtime (float (2.)) – Readout time for computing approximate time of observing the sequence. (seconds)

  • flush_pad (float (30.)) – How long to hold observations in the queue after they were expected to be completed (minutes).

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

check_continue(observation, conditions)[source]

This method enables external calls to check if a given observations that belongs to this survey is feasible or not. This is called once a sequence has started to make sure it can continue.

XXX–TODO: Need to decide if we want to develope check_continue, or instead hold the sequence in the survey, and be able to check it that way.

generate_observations_rough(conditions)[source]
Returns:

  1. None

  2. A list of observations

Return type:

one of

class rubin_scheduler.scheduler.surveys.DescDdf(basis_functions, RA, dec, sequences=None, exptime=30.0, nexp=1, ignore_obs=None, survey_name='DD_DESC', reward_value=101.0, readtime=2.0, filter_change_time=120.0, nside=None, flush_pad=30.0, seed=42, detailers=None)[source]

Bases: BaseSurvey

DDF survey based on Scolnic et al Cadence White Paper.

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

check_continue(observation, conditions)[source]

This method enables external calls to check if a given observations that belongs to this survey is feasible or not. This is called once a sequence has started to make sure it can continue.

XXX–TODO: Need to decide if we want to develope check_continue

or instead hold the sequence in the survey, and be able to check it that way.

generate_observations_rough(conditions)[source]
Returns:

  1. None

  2. A list of observations

Return type:

one of

class rubin_scheduler.scheduler.surveys.FieldAltAzSurvey(basis_functions, az, alt, sequence='ugrizy', nvisits=None, exptimes=None, nexps=None, ignore_obs=None, survey_name=None, target_name=None, science_program=None, observation_reason=None, scheduler_note=None, readtime=2.4, filter_change_time=120.0, nside=32, flush_pad=30.0, detailers=None)[source]

Bases: FieldSurvey

A clone of FieldSurvey that takes alt,az rather than RA,dec.

Parameters:
  • basis_functions (list [rubin_scheduler.scheduler.basis_function]) – List of basis_function objects

  • detailers (list [rubin_scheduler.scheduler.detailer] objects) – The detailers to apply to the list of observations.

  • az (float) – The azimuth of the field (degrees)

  • alt (float) – The altitude of the field to observe (degrees)

  • sequence (list [str]) – The sequence of observations to take. (specify which filters to use).

  • nvisits (dict {str: int}) – Dictionary of the number of visits in each filter. Default of None will use a backup sequence of 20 visits per filter. Must contain all filters in sequence.

  • exptimes (dict {str: float}) – Dictionary of the exposure time for visits in each filter. Default of None will use a backup sequence of 38s in u, and 29.2s in all other bands. Must contain all filters in sequence.

  • nexps (dict` {str: int}) – Dictionary of the number of exposures per visit in each filter. Default of None will use a backup sequence of 1 exposure per visit in u band, 2 in all other bands. Must contain all filters in sequence.

  • ignore_obs (list [str] or None) – Ignore observations with this string in the scheduler_note. Will ignore observations which match subsets of the string, as well as the entire string. Ignoring ‘mysurvey23’ will also ignore ‘mysurvey2’.

  • survey_name (str or None.) – The name to give this survey, for debugging and visualization purposes. Also propagated to the ‘target_name’ in the observation. The default None will construct a name based on the RA/Dec of the field.

  • scheduler_note (str or None) – The value to include in the scheduler note. The scheduler note is for internal, scheduler, use for the purposes of identifying observations to ignore or include for a survey or feature.

  • readtime (float) – Readout time for computing approximate time of observing the sequence. (seconds)

  • filter_change_time (float) – Filter change time, on average. Used for computing approximate time for the observing sequence. (seconds)

  • nside (float or None) – Nside for computing survey basis functions and maps. The default of None will use rubin_scheduler.utils.set_default_nside().

  • flush_pad (float) – How long to hold observations in the queue after they were expected to be completed (minutes).

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

class rubin_scheduler.scheduler.surveys.FieldSurvey(basis_functions, RA, dec, sequence='ugrizy', nvisits=None, exptimes=None, nexps=None, ignore_obs=None, survey_name=None, target_name=None, science_program=None, observation_reason=None, scheduler_note=None, readtime=2.4, filter_change_time=120.0, nside=32, flush_pad=30.0, detailers=None)[source]

Bases: BaseSurvey

A survey class for running field surveys.

Parameters:
  • basis_functions (list [rubin_scheduler.scheduler.basis_function]) – List of basis_function objects

  • detailers (list [rubin_scheduler.scheduler.detailer] objects) – The detailers to apply to the list of observations.

  • RA (float) – The RA of the field (degrees)

  • dec (float) – The dec of the field to observe (degrees)

  • sequence (list [str]) – The sequence of observations to take. (specify which filters to use).

  • nvisits (dict {str: int}) – Dictionary of the number of visits in each filter. Default of None will use a backup sequence of 20 visits per filter. Must contain all filters in sequence.

  • exptimes (dict {str: float}) – Dictionary of the exposure time for visits in each filter. Default of None will use a backup sequence of 38s in u, and 29.2s in all other bands. Must contain all filters in sequence.

  • nexps (dict` {str: int}) – Dictionary of the number of exposures per visit in each filter. Default of None will use a backup sequence of 1 exposure per visit in u band, 2 in all other bands. Must contain all filters in sequence.

  • ignore_obs (list [str] or None) – Ignore observations with this string in the scheduler_note. Will ignore observations which match subsets of the string, as well as the entire string. Ignoring ‘mysurvey23’ will also ignore ‘mysurvey2’.

  • survey_name (str or None.) – The name to give this survey, for debugging and visualization purposes. Also propagated to the ‘target_name’ in the observation. The default None will construct a name based on the RA/Dec of the field.

  • scheduler_note (str or None) – The value to include in the scheduler note. The scheduler note is for internal, scheduler, use for the purposes of identifying observations to ignore or include for a survey or feature.

  • readtime (float) – Readout time for computing approximate time of observing the sequence. (seconds)

  • filter_change_time (float) – Filter change time, on average. Used for computing approximate time for the observing sequence. (seconds)

  • nside (float or None) – Nside for computing survey basis functions and maps. The default of None will use rubin_scheduler.utils.set_default_nside().

  • flush_pad (float) – How long to hold observations in the queue after they were expected to be completed (minutes).

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

check_continue(observation, conditions)[source]

This method enables external calls to check if a given observations that belongs to this survey is feasible or not. This is called once a sequence has started to make sure it can continue.

XXX–TODO: Need to decide if we want to develop check_continue, or instead hold the sequence in the survey, and be able to check it that way. (note that this may depend a lot on how the SchedulerCSC works)

generate_observations_rough(conditions)[source]
Returns:

  1. None

  2. A list of observations

Return type:

one of

class rubin_scheduler.scheduler.surveys.GreedySurvey(basis_functions, basis_weights, filtername='r', block_size=1, smoothing_kernel=None, nside=32, dither=True, seed=42, ignore_obs=None, survey_name=None, scheduler_note=None, nexp=2, exptime=30.0, detailers=None, camera='LSST', area_required=None, fields=None, **kwargs)[source]

Bases: BaseMarkovSurvey

Select pointings in a greedy way using a Markov Decision Process.

generate_observations_rough(conditions)[source]

Just point at the highest reward healpix

class rubin_scheduler.scheduler.surveys.LongGapSurvey(blob_survey, scripted_survey, gap_range=[2, 10], long_name='long', scripted_tol=2.0, alt_min=20, alt_max=80.0, ha_min=24, ha_max=0.0, sun_alt_max=-18.0, flush_time=2.0, dist_tol=1.0, block_length=33.0, reverse=True, seed=42, night_max=50000, avoid_zenith=True, site=None, hour_step=0.5, survey_name=None)[source]

Bases: BaseSurvey

Parameters:
  • blob_survey (rubin_scheduler.scheduler.surveys.BlobSurvey) – A survey object that we will want to take repeat measurments of sometime later in the evening

  • scripted_survey (rubin_scheduler.scheduler.surveys.ScriptedSurvey) – A scripted survey object that will have a queue updated with objects to observe later.

  • range (gap) – The desired gap range (hours)

  • long_name (str) – The string to put in the observation ‘note’ for the scripted observations

  • scripted_tol (float) – The tolerance for when scripted observations can execute (hours)

  • after_meridian (bool (False)) – If True, force the scripted obsrevations to happen after they pass through the meridian. This can help make sure we don’t hit the zenith exclusion zone.

  • hour_step (float (0.5)) – The amount of time to step scheduled observations forward if they could try to execute in the zenith avoidance area (hours). Only used if avoid_zenith is True.

  • ha_min(_max) (float (0,24)) – Trying to set so they don’t acctually get used.

add_observations_array(observations_array_in, observations_hpid_in)[source]

Add an array of observations rather than one at a time

Parameters:
  • observations_array_in (ObservationArray) – An array of completed observations, rubin_scheduler.scheduler.utils.ObservationArray

  • observations_hpid_in (np.array) – Same as observations_array_in, but larger and with an additional column for HEALpix id. Each observation is listed mulitple times, once for every HEALpix it overlaps.

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

make_reward_df(conditions, accum=True)[source]

Create a pandas.DataFrame describing the reward from the survey.

Parameters:
Returns:

reward_df – A table of surveys listing the rewards.

Return type:

pandas.DataFrame

class rubin_scheduler.scheduler.surveys.PlanAheadSurvey(basis_functions, basis_weights, delta_mjd_tol=0.012499999999999999, minimum_sky_area=200.0, track_filters='g', in_season=2.5, cadence=9, **kwargs)[source]

Bases: BlobSurvey

Have a survey object that can plan ahead if it will want to observer a blob later in the night

Parameters:
  • delta_mjd_tol (float) – The tolerance to alow on when to execute scheduled observations (days)

  • minimum_sky_area (float) – The minimum sky area to demand before making a scheduled observation (square degrees)

  • track_filters (str) – The filter name we want to prevent long gaps on

  • in_season (float) – The distance in RA from the meridian at midnight to consider (hours). This is the half-width

  • cadence (float) – Ignore gaps below this length (days)

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

class rubin_scheduler.scheduler.surveys.PointingsSurvey(observations, gap_min=25.0, moon_dist_limit=30.0, weights=None, alt_max=85.0, alt_min=20.0, detailers=None, ha_max=4, ha_min=-4, wind_speed_maximum=100, fiducial_FWHMEff=0.7, sun_alt_limit=-12.0, track_notes_ngoal=None)[source]

Bases: BaseSurvey

Survey object for managing a set list of potential pointings without specified observing times. Does not follow the usual Survey class API by not using BasisFunction objects.

Parameters:
  • observations (np.array) – An array of observations, from e.g., rubin_scheduler.scheduler.utils.ObservationArray expect “RA”, “dec”, and “note” to be filled, other columns ignored.

  • gap_min (float) – The minimum gap to force between observations of the same spot (minutes)

  • alt_min (float) – Altitude limit of the telescope (degrees). Default 20.

  • alt_max (float) – Altitude limit of the telescope (degrees). Default 85.

  • ha_max (float (4,-4)) – hour angle limits (hours). Applied to all observations. Default 4,-4.

  • ha_min (float (4,-4)) – hour angle limits (hours). Applied to all observations. Default 4,-4.

  • weights (dict) –

    Dictionary with keys of method names and values of floats. Default of None uses {“visit_gap”: 1.0, “balance_revisit”: 1.0,

    ”m5diff”: 1.0, “wind_limit”: 1.0, “slew_time”: -1.0, “ha_limit”: 0, “alt_limit”: 0, “moon_limit”: 0}

  • wind_speed_maximum (float) – The maximum wind (m/s), mask any targets that would take more wind than that. Default 100 m/s.

  • fiducial_FWHMEff (float) – A fiducial seeing value to use when computing dark sky depth. Default 0.7 arcsec.

  • sun_alt_limit (float) – Have survey as infeasible when sun altitude is above the limit. Default -12 (degrees).

  • track_notes_ngoal (dict) – If there are observations that should be tracked together (e.g., a sequence that should be observed together). Dict with keys of str and values of int.

add_observation(observation, indx=None)[source]

Let survey know about a completed observation.

add_observations_array(observations_array_in, observations_hpid_in)[source]

Like add_observation, but for a large array of completed observations.

alt_limit(conditions)[source]

Apply altitude limits.

balance_revisit(conditions)[source]

Code to balance revisiting different targets.

calc_reward_function(conditions)[source]

Compute reward function using methods set by weights dict on init.

generate_observations_rough(conditions)[source]

Calculate reward function and highest reward observation. This is usually called by generate_observations which will take the result and then apply detailers to them.

ha_limit(conditions)[source]

Apply hour angle limits.

m5diff(conditions)[source]

Compute difference between current 5-sigma limiting depth and the depth at the same coordinates in “ideal” conditions.

make_reward_df(conditions, accum=True)[source]

Create a pandas.DataFrame describing the reward from the survey.

moon_limit(conditions)[source]

Apply moon distanve limit.

reward_changes(conditions)[source]

List the rewards for each basis function used by the survey.

sequence_boost(conditions)[source]

Boost the reward if a sequence is incomplete.

visit_gap(conditions)[source]

Enforce a minimum visit gap.

wind_limit(conditions)[source]

Apply the wind limit.

class rubin_scheduler.scheduler.surveys.ScriptedSurvey(basis_functions, basis_weights=None, reward=1000000.0, ignore_obs=None, nside=32, detailers=None, id_start=1, return_n_limit=10, survey_name=None, before_twi_check=True, filter_change_time=120)[source]

Bases: BaseSurvey

Take a set of scheduled observations and serve them up.

Parameters:
  • basis_functions (list of rubin_scheduler.scheduler.BasisFunction) – Basis functions to use. These are only used for computing survey feasibility. They do not contribute to the logic of how observations are selected. Basis functions that return HEALpix maps are ignored. Spatial masking is instead done with the _check_alts_ha method.

  • id_start (int (1)) – The integer to start the “scripted id” field with. Bad things could happen if you have multiple scripted survey objects with the same scripted IDs.

  • return_n_limit (int (10)) – The maximum number of observations to return. Set to high and your block of scheduled observations can run into twilight time.

  • before_twi_check (bool) – Check if the returned observations have enough time to complete before twilight starts. (default True)

  • filter_change_time (float) – The time needed to change filters. Default 120 seconds. Only used if before_twi_check is True.

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

Check if observation matches a scripted observation

add_observations_array(observations_array_in, observations_hpid_in)[source]

Add an array of observations rather than one at a time

Parameters:
  • observations_array_in (ObservationArray) – An array of completed observations, rubin_scheduler.scheduler.utils.ObservationArray

  • observations_hpid_in (np.array) – Same as observations_array_in, but larger and with an additional column for HEALpix id. Each observation is listed mulitple times, once for every HEALpix it overlaps.

calc_reward_function(conditions)[source]

If there is an observation ready to go, execute it, otherwise, -inf

clear_script()[source]

set an empty list to serve up

generate_observations_rough(conditions)[source]
Returns:

  1. None

  2. A list of observations

Return type:

one of

set_script(obs_wanted)[source]
Parameters:
  • obs_wanted (np.array) – The observations that should be executed. Needs to have columns with dtype names: Should be from lsst.sim.scheduler.utils.scheduled_observation

  • mjds (np.array) – The MJDs for the observaitons, should be same length as obs_list

  • mjd_tol (float (15.)) – The tolerance to consider an observation as still good to observe (min)

class rubin_scheduler.scheduler.surveys.ToOScriptedSurvey(basis_functions, followup_footprint=None, nside=32, reward_val=1000000.0, times=[1, 2, 4, 24, 48], filters_at_times=['gz', 'gz', 'gz', 'gz', 'gz', 'gz'], nvis=[1, 1, 1, 1, 6, 6], exptimes=[29.2, 29.2, 29.2, 29.2, 29.2, 29.2], camera='LSST', survey_name='ToO', target_name_base='ToO', flushtime=2.0, mjd_tol=0.041666666666666664, dist_tol=0.5, alt_min=25.0, alt_max=85.0, HA_min=5, HA_max=19, ignore_obs=None, dither=True, seed=42, npositions=20000, n_snaps=2, n_usnaps=1, id_start=1, detailers=None, too_types_to_follow=[''], split_long=False, split_long_max=30.0, split_long_div=60.0)[source]

Bases: ScriptedSurvey, BaseMarkovSurvey

If there is a new ToO event, generate a set of scripted observations to try and follow it up.

Parameters:
  • times (list of floats) – The times after the detection that observations should be attempted (hours). Default [1, 2, 4, 24, 48]

  • filters_at_times (list of str) – The filters that should be observed at each time in times. Default [“gz”, “gz”, “gz”, “gz”, “gz”, “gz”]

  • nvis (list of int) – The number of visits per filter at each time in times. Default [1, 1, 1, 1, 6, 6]

  • exptimes (list of floats) – The exposure times to use for each time in times. Default [DEFAULT_EXP_TIME]*5,

  • alt_min (float) – Do not attempt observations below this limit (degrees). Note the telescope alt limit is 20 degrees, however, slew and filter change time means alt_min here should be set higher (otherwise, target will pass altitude check, but then fail to observe by the time the telescope gets there).

  • target_name_base (str) – String to use as the base of the target name. Will be appended with an integer for the object id.

  • split_long (bool) – Should long exposure times be split into multiple snaps. Default False.

  • split_long_max (float) – Maximum exposure time to allow before splitting into multiple snaps if split_long is True. Default 30s.

  • split_long_div (float) – Time to divide the exposure time by to decide how many snaps to use. Default 60s.

calc_reward_function(conditions)[source]

If there is an observation ready to go, execute it, otherwise, -inf

flush_script(conditions)[source]

Remove things from the script that aren’t needed anymore

set_script(obs_wanted, append=True)[source]
Parameters:
class rubin_scheduler.scheduler.surveys.TooMaster(example__to_o_survey)[source]

Bases: BaseSurvey

A target of opportunity class. Every time a new ToO comes in, it will spawn a new sub-survey.

Parameters:

example__to_o_survey (rubin_scheduler.scheduler.surveys.ToO_survey) – A survey object that will be coppied and have a new target map set for each incoming ToO.

calc_reward_function(conditions)[source]
Parameters:

conditions (rubin_scheduler.scheduler.features.Conditions object)

Returns:

reward

Return type:

float (or array)

class rubin_scheduler.scheduler.surveys.TooSurvey(basis_functions, basis_weights, filtername1='r', filtername2=None, slew_approx=7.5, filter_change_approx=140.0, read_approx=2.4, exptime=30.0, nexp=2, ideal_pair_time=22.0, min_pair_time=15.0, search_radius=30.0, alt_max=85.0, az_range=180.0, flush_time=30.0, smoothing_kernel=None, nside=None, dither=True, seed=42, ignore_obs=None, scheduler_note='ToO', detailers=None, camera='LSST', too_id=None, survey_name=None)[source]

Bases: BlobSurvey

Survey class to catch incoming target of opportunity anouncements and try to observe them.

The idea is that we can dynamically update the target footprint basis function, and add new features as more ToOs come in.

Parameters:

too_id (int (None)) – A unique integer ID for the ToO getting observed

generate_observations_rough(conditions)[source]

Find a good block of observations.

set_id(newid)[source]

Set the id

set_target_map(newmap)[source]

Expect one of the basis functions to be Footprint_nvis_basis_function

rubin_scheduler.scheduler.surveys.dd_bfs(RA, dec, survey_name, ha_limits, frac_total=0.00925, aggressive_frac=0.0055, delays=[0.0, 0.5, 1.5], time_needed=62.0, wind_speed_maximum=20.0, nside=None)[source]

Convienence function to generate all the feasibility basis functions

rubin_scheduler.scheduler.surveys.gen_roman_off_season(nside=32, camera_ddf_rot_limit=75.0, exptime=30.0, nexp=2)[source]

Generate a ddf-like survey object to observe the roman field every ~3 days in the off-season

rubin_scheduler.scheduler.surveys.gen_roman_on_season(nside=32, camera_ddf_rot_limit=75.0, exptime=30.0, nexp=2)[source]

Generate a survey object for observing the Roman field(s) in an on season

rubin_scheduler.scheduler.surveys.generate_dd_surveys(nside=None, nexp=2, detailers=None, euclid_detailers=None, reward_value=100, frac_total=0.00925, aggressive_frac=0.0055, exptime=30, u_exptime=30, nvis_master=[8, 20, 10, 20, 26, 20], delays=[0.0, 0.5, 1.5])[source]

Utility to return a list of standard deep drilling field surveys.

XXX-Someone double check that I got the coordinates right!

rubin_scheduler.scheduler.surveys.generate_ddf_grid(verbose=True, mjd0=59560.2, delta_t=15.0, survey_length=40.0, sun_limit=-12, nominal_expt=30.0)[source]

Pre-compute conditions for DDF locations over survey

Parameters:
  • mjd0 (float) – The start MJD of the grid

  • delta_t (float) – Spacing of time steps in minutes. Default 15

  • survey_length (float) – Full span of DDF grid (years). Default 40.

  • sun_limit (float) – Ignore times with sun above sun limit in degrees. Default -12.

  • nominal_expt (float) – Nominal exposure time in seconds to use for depth visits. Default 30

rubin_scheduler.scheduler.surveys.generate_ddf_scheduled_obs(data_file=None, flush_length=2, mjd_tol=15, expt=30.0, alt_min=25, alt_max=85, HA_min=21.0, HA_max=3.0, sun_alt_max=-18, moon_min_distance=25.0, dist_tol=3.0, nvis_master=[8, 10, 20, 20, 24, 18], filters='ugrizy', nsnaps=[1, 2, 2, 2, 2, 2], mjd_start=60796.0, survey_length=10.0, sequence_time=60.0, season_unobs_frac=0.2, low_season_frac=0, low_season_rate=0.3)[source]
Parameters:
  • data_file (path (None)) – The data file to use for DDF airmass, m5, etc. Defaults to using whatever is in rubin_sim_data/scheduler directory.

  • flush_length (float (2)) – How long to keep a scheduled observation around before it is considered failed and flushed (days).

  • mjd_tol (float (15)) – How close an observation must be in time to be considered matching a scheduled observation (minutes).

  • expt (float (30)) – Total exposure time per visit (seconds).

  • alt_min/max (float (25, 85)) – The minimum and maximum altitudes to permit observations to happen (degrees).

  • HA_min/max (float (21, 3)) – The hour angle limits to permit observations to happen (hours).

  • moon_min_distance (float) – The minimum distance to demand from the moon (degrees).

  • dist_tol (float (3)) – The distance tolerance for a visit to be considered matching a scheduled observation (degrees).

  • nvis_master (list of ints ([8, 10, 20, 20, 24, 18])) – The number of visits to make per filter

  • filters (str (ugrizy)) – The filter names.

  • nsnaps (list of ints ([1, 2, 2, 2, 2, 2])) – The number of snaps to use per filter

  • mjd_start (float) – Starting MJD of the survey. Default None, which calls rubin_sim.utils.SURVEY_START_MJD

  • survey_length (float) – Length of survey (years). Default 10.

  • sequence_time (float, optional) – Expected time for each DDF sequence, used to avoid hitting the sun_limit (running DDF visits into twilight). In minutes.

  • season_unobs_frac (float, optional) – Defines the end of the range of the prescheduled observing season. season runs from 0 (sun’s apparent position is at the RA of the DDF) to 1 (sun returns to an apparent position in the RA of the DDF). The scheduled season runs from: season_unobs_frac < season < (1-season_unobs_fract)

  • low_season_frac (float, optional) – Defines the end of the range of the “low cadence” prescheduled observing season. The “standard cadence” season runs from: low_season_frac < season < (1 - low_season_frac) For an ‘accordian’ style DDF with fewer observations near the ends of the season, set this to a value larger than season_unobs_frac. Values smaller than season_unobs_frac will result in DDFs with a constant rate throughout the season.

  • low_season_rate (float, optional) – Defines the rate to use within the low cadence portion of the season. During the standard season, the ‘rate’ is 1. This is used in ddf_slopes to define the desired number of cumulative observations for each DDF over time.