Example Scheduler#
- rubin_scheduler.scheduler.example.example_scheduler(mjd_start=np.float64(60980.5), **kwargs)[source]#
Renamed
- Return type:
- rubin_scheduler.scheduler.example.generate_baseline_coresched(nside=32, survey_start_mjd=np.float64(60980.5), no_too=False)[source]#
Provide an example baseline survey-strategy scheduler.
- Parameters:
nside (
int) – Nside for the scheduler maps and basis functions.survey_start_mjd (
float) – Start date for the survey (MJD).no_too (
bool) – Turn off ToO simulation. Default False.
- Returns:
scheduler – A scheduler set up as the baseline survey strategy.
- Return type:
rubin_scheduler.scheduler.CoreScheduler
- rubin_scheduler.scheduler.example.get_ideal_model_observatory(nside=32, dayobs='2024-09-09', fwhm_500=1.6, wind_speed=5.0, wind_direction=340, tma_percent=70, rotator_percent=100, survey_start=np.float64(60562.5))[source]#
Set up a model observatory with constant seeing and wind speed, running on ‘dayobs’.
Track a constant ‘survey_start’ over different ‘dayobs’ so that the ‘night’ value in the simulation outputs is consistent, and any basis functions which might use ‘season’ values from the conditions have appropriate values.
- Parameters:
nside (
int) – The nside for the model observatory.dayobs (
str) – DAYOBS formatted str (YYYY-MM-DD) for the evening to start up the observatory.fwhm_500 (
float, optional) –- The value to set for atmospheric component of seeing,
constant seeing throughout the night (arcseconds).
Ad-hoc value for start of comcam on-sky operations about 2.0”.
wind_speed (
float, optional) – Set a (constant) wind speed for the night, (m/s). Default of 5.0 is minimal but noticeable.wind_direction (
float, optional) – Set a (constant) wind direction for the night (deg). Default of 340 is midrange between typical wind directions for the site (see SITCOMTN-126).tma_percent (
float, optional) – Set a percent of full-performance for the telescope TMA (0-100). Value of 10(%) is likely for start of comcam on-sky SV surveys.rotator_percent (
float, optional) – Set a percent of full-performance for the rotator. Default of 100% is likely for the start of comcam on-sky SV surveys.survey_start (
float, optional) – MJD of the day of the survey start of operations. This should be kept constant for a given set of simulations, so that the “night” value in the output is consistent. For surveys which use basis functions depending on season, this is also important to be constant.
- Returns:
observatory – A ModelObservatory set up to start operations in the evening of DAYOBS.
- Return type:
Notes
The time for the model observatory will be advanced to the time of
sunset_start_key(default -12 degree sunset) in the model observatory. The bands may not be correct however; useupdate_model_observatory_sunsetto get bands in place.
- rubin_scheduler.scheduler.example.run_sched(scheduler, survey_length=365.25, nside=32, filename=None, verbose=False, extra_info=None, illum_limit=40.0, survey_start_mjd=60796.0, event_table=None, sim_to_o=None, snapshot_dir=None, readtime=3.07, band_changetime=140.0, tma_performance=40.0)[source]#
Run survey
- Parameters:
scheduler (
CoreScheduler)survey_length (
float, default:365.25)nside (
int, default:32)filename (
str|None, default:None)verbose (
bool, default:False)extra_info (
dict|None, default:None)illum_limit (
float, default:40.0)survey_start_mjd (
float, default:60796.0)event_table (
ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]] |None, default:None)snapshot_dir (
str|None, default:None)readtime (
float, default:3.07)band_changetime (
float, default:140.0)tma_performance (
float, default:40.0)
- Return type:
- rubin_scheduler.scheduler.example.set_run_info(dbroot=None, file_end='', out_dir='.')[source]#
Gather versions of software used to record
- Parameters:
dbroot (
str|None, default:None)file_end (
str, default:'')out_dir (
str, default:'.')
- Return type:
tuple[str,dict]
- rubin_scheduler.scheduler.example.simple_field_survey(field_ra_deg, field_dec_deg, field_name, mask_basis_functions=None, reward_basis_functions=None, detailers=None, sequence='ugrizy', nvisits=None, exptimes=None, nexps=None, nside=32, science_program=None)[source]#
Set up a simple field survey.
- Parameters:
field_ra_deg (
float) – The RA (in degrees) of the field.field_dec_deg (
float) – The Dec (in degrees) of the field.field_name (
str) – The name of the field. This is used for the survey_name and transferred to the ‘target’ information in the output observation. Also used in ‘scheduler_note’, which is important for the FieldSurvey to know whether to count particular observations for the Survey.mask_basis_functions (
list[BaseBasisFunction] or None) – List of basis functions to use as masks (with implied weight 0). If None,standard_masksis used with default parameters.reward_basis_functions (
list[BaseBasisFunction] or None) – List of basis functions to use as rewards. If None, a basic set of basis functions useful for long observations of a field within a night will be used (`getdetailers (
listof [detailerobjects]) – Detailers for the survey. Detailers can add information to output observations, including specifying rotator or dither positions. Add a BandSortDetailer or RollBandMatchDetailer to modify sequences.sequence (
strorlist[str]) – The bands (in order?) for the sequence of observations.nvisits (
dict{str:int} | None) – Number of visits per band to program in the sequence. Default of None uses nvisits = {“u”: 20, “g”: 20, “r”: 20, “i”: 20, “z”: 20, “y”: 20}exptimes (
dict{str:float} | None) – Exposure times per band to program in the sequence. Default of None uses exptimes = {“u”: 38, “g”: 30, “r”: 30, “i”: 30, “z”: 30, “y”: 30}nexps (
dict{str:int} | None) – Number of exposures per band to program in the sequence. Default of None uses nexps = {“u”: 1, “g”: 2, “r”: 2, “i”: 2, “z”: 2, “y”: 2}nside (
int, optional) – Nside for the survey. Default DEFAULT_NSIDE.science_program (
str| None) – The science_program key for the FieldSurvey. This maps to the BLOCK andscience_programin the consDB.
- Returns:
field_survey – The configured FieldSurvey.
- Return type:
Notes
The sequences for a given field survey can be set via kwargs, not necessarily easily accessible here. Only portions of the sequence which correspond to mounted bands will be requested by the FieldSurvey.
field_survey.extra_features[‘ObsRecord’] tracks how many observations have been accepted by the Survey (and can be useful for diagnostics).
- rubin_scheduler.scheduler.example.simple_greedy_survey(nside=32, bandname='r', mask_basis_functions=None, reward_basis_functions=None, reward_basis_functions_weights=None, survey_start=np.float64(60980.5), footprints_hp=None, camera_rot_limits=[-80.0, 80.0], exptime=30.0, nexp=1, science_program=None, observation_reason=None, dither='night', camera_dither='night')[source]#
Set up a simple greedy survey to just observe single visits.
- Parameters:
nside (
int, optional) – Nside for the surveys.bandname (
str, optional) – Bandname for the visits.mask_basis_functions (
list[BaseBasisFunction] or None) – List of basis functions to use as masks (with implied weight 0). If None,standard_masksis used with default parameters.reward_basis_functions (
list[BaseBasisFunction] or None) – List of basis functions to use as rewards. If None, a basic set of basis functions will be used.reward_basis_functions_weights (
list[float] or None) – List of values to use as weights for the reward basis functions. If None, default values for the basic set will be used.survey_start (
floator None) – The start of the survey, in MJD. If None,survey_start_mjd()is used. This should be the start of the survey, not the current time.footprints_hp (
np.ndarray(N,) or None) – An array of healpix maps with the target survey area, with dtype like [(bandname, ‘<f8’), (bandname2, ‘<f8’)]. If None,get_current_footprint()will be used, which will cover the expected LSST survey footprint.camera_rot_limits (
list[float]) – The rotator limits to expect for the camera. These should be slightly padded from true limits, to allow for slight delays between requesting observations and acquiring them.exptime (
float) – The on-sky exposure time per visit.nexp (
int) – The number of exposures per visit (exptime * nexp = total on-sky time).science_program (
str| None) – The science_program key for the FieldSurvey. This maps to the BLOCK andscience_programin the consDB.observation_reason (
str| None) – The observation_reason for the Survey. Indicates survey mode, potentially enhanced with particular reason.dither (
str, default:'night')camera_dither (
str, default:'night')
- Returns:
greedy_survey – A greedy survey configured to take the next best (single) visit in bandname.
- Return type:
GreedySurvey
- rubin_scheduler.scheduler.example.simple_pairs_survey(nside=32, bandname='g', bandname2=None, mask_basis_functions=None, reward_basis_functions=None, reward_basis_functions_weights=None, survey_start=np.float64(60980.5), footprints_hp=None, footprint=None, camera_rot_limits=[-80.0, 80.0], pair_time=30.0, exptime=30.0, nexp=1, science_program=None, observation_reason=None, dither='night', camera_dither='night', require_time=False)[source]#
Set up a simple blob survey to acquire pairs of visits.
- Parameters:
nside (
int, optional) – Nside for the surveys.bandname (
str, optional) – Bandname for the first visit of the pair.bandname2 (
stror None, optional) – Bandname for the second visit of the pair. If None, the first band will be used for both visits.mask_basis_functions (
list[BaseBasisFunction] or None) – List of basis functions to use as masks (with implied weight 0). If None,standard_masksis used with default parameters.reward_basis_functions (
list[BaseBasisFunction] or None) – List of basis functions to use as rewards. If None, a basic set of basis functions will be used.reward_basis_functions_weights (
list[float] or None) – List of values to use as weights for the reward basis functions. If None, default values for the basic set will be used.survey_start (
floator None) – The start of the survey, in MJD. If None,survey_start_mjd()is used. This should be the start of the survey, not the current time.footprints_hp (
np.ndarray(N,) or None) – An array of healpix maps with the target survey area, with dtype like [(bandname, ‘<f8’), (bandname2, ‘<f8’)]. If None,get_current_footprint()will be used, which will cover the expected LSST survey footprint.camera_rot_limits (
list[float]) – The rotator limits to expect for the camera. These should be slightly padded from true limits, to allow for slight delays between requesting observations and acquiring them.pair_time (
float) – The ideal time between pairs of visits, in minutes.exptime (
float) – The on-sky exposure time per visit.nexp (
int) – The number of exposures per visit (exptime * nexp = total on-sky time).science_program (
str| None) – The science_program for the Survey. This maps to the BLOCK andscience_programin the consDB.observation_reason (
str| None) – The observation_reason for the Survey. Indicates survey mode, potentially enhanced with particular reason.require_time (
bool) – If True, add a mask basis function that checks there is enough time before twilight to execute the pairs. Default False.footprint (
Footprint|None, default:None)dither (
str, default:'night')camera_dither (
str, default:'night')
- Returns:
pair_survey – A blob survey configured to take pairs at spacing of pair_time, in bandname + bandname2.
- Return type:
BlobSurvey
- rubin_scheduler.scheduler.example.simple_rewards(footprints, bandname, nside=32, m5_weight=6.0, footprint_weight=1.5, slewtime_weight=3.0, stayband_weight=3.0, repeat_weight=-20)[source]#
A simple set of rewards for area-based surveys.
- Parameters:
footprints (
Footprint) – A Footprint class, which takes a target map and adds a time-dependent weighting on top (such as seasonal weighting).bandname (
str) – The bandname active for these rewards.nside (
int, optional) – The nside for the rewards.m5_weight (
float, optional) – The weight to give the M5Diff basis function.footprint_weight (
float, optional) – The weight to give the footprint basis function.slewtime_weight (
float, optional) – The weight to give the slewtime basis function.stayband_weight (
float, optional) – The weight to give the BandChange basis function.repeat_weight (
float, optional) – The weight to give the VisitRepeat basis function. This is negative by default, to avoid revisiting the same part of the sky withingap_max(3 hours) in any band (except in the pairs survey itself).
- Returns:
reward_functions – List of tuples, each tuple is a reward function followed by its respective weight.
- Return type:
list[(BaseBasisFunction,float)]
Notes
Increasing the m5_weight moves visits toward darker skies. Increasing the footprint weight distributes visits more evenly. Increasing the slewtime weight acquires visits with shorter slewtime. The balance in the defaults here has worked reasonably for pair surveys in simulations.
- rubin_scheduler.scheduler.example.simple_rewards_field_survey(scheduler_note, nside=32, sun_alt_limit=-12.0)[source]#
Get some simple rewards to observe a field survey for a long period.
- Parameters:
scheduler_note (
str) – The scheduler note for the field survey. Typically this will be the same as the field name.nside (
int) – The nside value for the healpix grid.sun_alt_limit (
float, optional) – Value for the sun’s altitude at which to allow observations to start (or finish).
- Returns:
bfs
- Return type:
listofBaseBasisFunction
- rubin_scheduler.scheduler.example.standard_masks(nside, moon_distance=30.0, wind_speed_maximum=20.0, min_alt=20, max_alt=86.5, min_az=0, max_az=360, shadow_minutes=30)[source]#
A set of standard mask functions.
Avoids the moon, bright planets, high wind, and areas on the sky out of bounds, using the MoonAvoidanceBasisFunction, PlanetMaskBasisFunction, AvoidDirectWindBasisFunction, and the AltAzShadowMaskBasisFunction.
- Parameters:
nside (
intor None) – The healpix nside to use. Default of None uses rubin_scheduler.utils.get_default_nside.moon_distance (
float, optional) – Moon avoidance distance, in degrees.wind_speed_maximum (
float, optional) – Wind speed maximum to apply to the wind avoidance basis function, in m/s.min_alt (
float, optional) – Minimum altitude (in degrees) to observe.max_alt (
float, optional) – Maximum altitude (in degrees) to observe.min_az (
float, optional) – Minimum azimuth angle (in degrees) to observe.max_az (
float, optional) – Maximum azimuth angle (in degrees) to observe.shadow_minutes (
float, optional) – Avoid inaccessible alt/az regions, as well as parts of the sky which will move into those regions withinshadow_minutes(minutes).
- Returns:
mask_basis_functions – Mask basis functions should always be used with a weight of 0. The masked (np.nan or -np.inf) regions will remain masked, but the basis function values won’t influence the reward.
- Return type:
list[BaseBasisFunction]
- rubin_scheduler.scheduler.example.update_model_observatory_sunset(observatory, band_scheduler, twilight=-12)[source]#
Ensure correct bands are in place according to the band_scheduler.
- Parameters:
observatory (
ModelObservatory) – The ModelObservatory simulating the observatory.band_scheduler (
BandScheduler) – The band scheduler providing appropriate information on the bands that should be in place on the current observatory day.twilight (
intorfloat) – If twilight is -12 or -18, the Almanac -12 or -18 degree twilight times are used to set the current observatory time. If any other value is provided, it is assumed to be a specific MJD to start operating the observatory. Band choices are based on the time after advancing to twilight.
- Returns:
observatory – The ModelObservatory simulating the observatory, updated to the time of ‘twilight’ and with mounted_bands matching the bands chosen by the band_scheduler for the current time at ‘twilight’.
- Return type: