Schedulers¶
- class rubin_scheduler.scheduler.schedulers.ComCamFilterSched(loaded_filter_groups=(('u', 'g', 'r'), ('g', 'r', 'i'), ('r', 'i', 'z'), ('i', 'z', 'y')), illum_bins=array([0, 25, 50, 75, 100]))[source]¶
Bases:
FilterSwapScheduler
ComCam can only hold 3 filters at a time.
Pretend we will cycle from ugr, gri, riz, izy depending on lunar phase.
- Parameters:
loaded_filter_groups (
tuple
(tuple
)) – Groups of 3 filters, to be loaded at the same time. Multiple groups can be specified, to be swapped between at the boundaries ofillum_bins
in lunar phase.illum_bins (
np.ndarray
, (N,)) – Lunar illumination boundaries to define when to swap between different groups of filters within theloaded_filter_groups
. Lunar illumination ranges from 0 to 100.
Notes
If illum_bins = np.array([0, 50, 100]), then there should be two groups of filters to use – one for use between 0 and 50 percent illumination, and another for use between 50 and 100 percent illumination.
- class rubin_scheduler.scheduler.schedulers.CoreScheduler(surveys, nside=32, camera='LSST', log=None, keep_rewards=False, telescope='rubin')[source]¶
Bases:
object
Core scheduler that takes requests observations, reports observatory status and provides completed observations.
- Parameters:
surveys (list (or list of lists) of rubin_scheduler.scheduler.survey) – A list of surveys to consider. If multiple surveys return the same highest reward value, the survey at the earliest position in the list will be selected. Can also be a list of lists to make heirarchical priorities (‘tiers’).
nside (
int
) – A HEALpix nside value.camera (
str
) – Which camera to use to compute the correspondence between visits and HEALpixels when recording observations. Can be ‘LSST’ or ‘comcam’.log (
logging.Logger
) – If None, a new logger is created.keep_rewards (
bool
) – Flag whether to record the rewards and basis function values (this can be useful for schedview).telescope (
str
) – Which telescope model to use for rotTelPos/rotSkyPos conversions. Default “rubin”.
- add_observation(observation)[source]¶
Record a completed observation and update features accordingly.
- Parameters:
observation (dict-like) – An object that contains the relevant information about a completed observation (e.g., mjd, ra, dec, filter, rotation angle, etc)
- add_observations_array(obs)[source]¶
Like add_observation, but for passing many observations at once.
Assigns overlapping HEALpix IDs to each observation, then passes the observation array and constructed observations + healpix id to each survey.
- get_basis_functions(survey_index=None, conditions=None)[source]¶
Get the basis functions for a specific survey, in provided conditions.
- Parameters:
survey_index (
List
[int
]) – A list with two elements: the survey list and the element within that survey list for which the basis function should be retrieved. IfNone
, use the latest survey to make an addition to the queue.conditions (
rubin_scheduler.scheduler.features.conditions.Conditions
) – The conditions for which to return the basis functions. IfNone
, use the conditions associated with this scheduler.
- Returns:
basis_funcs (
OrderedDict
[‘str`,)Base_basis_function
] – A dictionary of the basis functions, where the keys are names for the basis functions and the values are the functions themselves.
- get_healpix_maps(survey_index=None, conditions=None)[source]¶
Get the healpix maps for a specific survey, in provided conditions.
- Parameters:
survey_index (
List
[int
], opt) – A list with two elements: the survey list and the element within that survey list for which the maps that should be retrieved. IfNone
, use the latest survey which added to the queue.conditions (
Conditions
, opt) – The conditions for the maps to be returned. IfNone
, use the conditions associated with this sceduler. By default None.
- Returns:
basis_funcs – A dictionary of the maps, where the keys are names for the maps and values are the numpy arrays as used by
healpy
.- Return type:
OrderedDict
[‘str`,numpy.ndarray
]
- make_reward_df(conditions=None, accum=True)[source]¶
Create a pandas.DataFrame describing rewards from contained surveys.
- Parameters:
conditions (
rubin_scheduler.scheduler.features.Conditions
) – Conditions for which rewards are to be returnedaccum (
bool
) – Include accumulated rewards (defaults to True)
- Returns:
reward_df – A table of surveys listing the rewards.
- Return type:
pandas.DataFrame
- request_observation(mjd=None, whole_queue=False)[source]¶
Ask the scheduler what it wants to observe next
- Parameters:
mjd (
float
) – The Modified Julian Date. If None, it uses the MJD from the conditions from the last conditions update.whole_queue (
bool
) – Return the entire list of observations in the queue (True), or just a single observation (False). Default False
- Returns:
observation – Returns ~.scheduler.utils.ObservationArray if whole_queue is False Returns None if the queue fails to fill Returns list of ObservationArray if whole_queue is True
- Return type:
list
[ObservationArray
]
Notes
Calling request_observation repeatedly, even without updating the time or conditions, can return different requested observations. This is because the internal queue is filled when it becomes empty, and then subsequent calls to request_observation will pop successive visits from this queue, until the queue is empty or is flushed.
- property survey_labels¶
Provide a list of labels for surveys
- Returns:
label_lists – A list, or list of lists, of labels corresponding to self.survey_lists
- Return type:
list
- surveys_df(tier)[source]¶
Create a pandas.DataFrame describing rewards from surveys.
- Parameters:
conditions (
rubin_scheduler.scheduler.features.Conditions
) – Conditions for which rewards are to be returned.tier (
int
) – The level of the list of survey lists for which to return values.
- Returns:
reward_df – A table of surveys listing the rewards.
- Return type:
pandas.DataFrame
- class rubin_scheduler.scheduler.schedulers.FilterSchedUzy(illum_limit=10.0)[source]¶
Bases:
FilterSwapScheduler
remove u in bright time. Alternate between removing z and y in dark time.
Note, this might not work properly if we need to restart a bunch. So a more robust way of scheduling filter loading might be in order.
- class rubin_scheduler.scheduler.schedulers.FilterSwapScheduler[source]¶
Bases:
object
A simple way to schedule what filter to load
- class rubin_scheduler.scheduler.schedulers.SimpleFilterSched(illum_limit=10.0)[source]¶
Bases:
FilterSwapScheduler