API

Applications

Collect

schedview.collect.get_footprint(nside=32)[source]

Get the survey footprint.

schedview.collect.load_bright_stars(fname=None)[source]

Read the Yale Bright Star Catalog into a pandas.DataFrame.

Parameters:

fname (str, optional) – Name of file from which to load the catalog, by default None

Returns:

bright_stars – The catalog of bright stars.

Return type:

pandas.DataFrame

schedview.collect.read_ddf_visits(opsim_uri, start_time=None, end_time=None, dbcols=['observationId', 'fieldRA', 'fieldDec', 'observationStartMJD', 'flush_by_mjd', 'visitExposureTime', 'filter', 'rotSkyPos', 'rotSkyPos_desired', 'numExposures', 'airmass', 'seeingFwhm500', 'seeingFwhmEff', 'seeingFwhmGeom', 'skyBrightness', 'night', 'slewTime', 'visitTime', 'slewDistance', 'fiveSigmaDepth', 'altitude', 'azimuth', 'paraAngle', 'cloud', 'moonAlt', 'sunAlt', 'note', 'target', 'fieldId', 'proposalId', 'block_id', 'observationStartLST', 'rotTelPos', 'rotTelPos_backup', 'moonAz', 'sunAz', 'sunRA', 'sunDec', 'moonRA', 'moonDec', 'moonDistance', 'solarElong', 'moonPhase', 'cummTelAz', 'scripted_id'], **kwargs)[source]

Read DDF visits from an opsim database.

Parameters:
  • opsim_uri (str) – The uri from which to load visits

  • start_time (str, astropy.time.Time) – The start time for visits to be loaded

  • end_time (str, astropy.time.Time) – The end time for visits ot be loaded

  • dbcols (list [str]) – Columns required from the database.

  • stackers (list [rubin_sim.maf.stackers], optional) – Stackers to be used to generate additional columns.

Returns:

visits – The visits and their parameters.

Return type:

pandas.DataFrame

schedview.collect.read_opsim(opsim_uri, start_time=None, end_time=None, constraint=None, dbcols=['observationId', 'fieldRA', 'fieldDec', 'observationStartMJD', 'flush_by_mjd', 'visitExposureTime', 'filter', 'rotSkyPos', 'rotSkyPos_desired', 'numExposures', 'airmass', 'seeingFwhm500', 'seeingFwhmEff', 'seeingFwhmGeom', 'skyBrightness', 'night', 'slewTime', 'visitTime', 'slewDistance', 'fiveSigmaDepth', 'altitude', 'azimuth', 'paraAngle', 'cloud', 'moonAlt', 'sunAlt', 'note', 'target', 'fieldId', 'proposalId', 'block_id', 'observationStartLST', 'rotTelPos', 'rotTelPos_backup', 'moonAz', 'sunAz', 'sunRA', 'sunDec', 'moonRA', 'moonDec', 'moonDistance', 'solarElong', 'moonPhase', 'cummTelAz', 'scripted_id'], **kwargs)[source]

Read visits from an opsim database.

Parameters:
  • opsim_uri (str) – The uri from which to load visits

  • start_time (str, astropy.time.Time) – The start time for visits to be loaded

  • end_time (str, astropy.time.Time) – The end time for visits ot be loaded

  • constraint (str, None) – Query for which visits to load.

  • dbcols (list [str]) – Columns required from the database.

  • **kwargs – Passed to maf.get_sim_data, if rubin_sim is available.

Returns:

visits – The visits and their parameters.

Return type:

pandas.DataFrame

schedview.collect.read_scheduler(file_name_or_url=None)[source]

Read an instance of a scheduler object from a pickle.

Parameters:

file_name (str) – The name or URL of the pickle file from which to load the scheduler.

Returns:

  • scheduler (rubin_scheduler.scheduler.schedulers.CoreScheduler) – An instance of a rubin_scheduler scheduler object.

  • conditions (rubin_scheduler.scheduler.features.Conditions) – An instance of a rubin_scheduler conditions object.

schedview.collect.sample_pickle(base_fname='sample_scheduler.pickle.xz')[source]

Return the path of the sample pickle

Parameters:

base_fname (str) – The base file name.

Returns:

fname – File name of the sample pickle.

Return type:

str

Compute

class schedview.compute.LsstCameraFootprintPerimeter[source]

Bases: object

Compute vertices surrounding the LSST camera footprint.

__call__(ra, decl, rotation=0)[source]

Compute vertices for a single pair of equatorial coordinates

Parameters:
  • ra (np.ndarray) – The R.A. of pointings (in degrees)

  • decl (np.ndarray) – The declination of pointings (in degrees)

  • rotation (float or np.ndarray) – The camera rotation(s) (in degrees)

Returns:

  • ra (np.ndarray) – An array of the R.A. of the vertices of the polygon surrounding the camera footprints (degrees).

  • decl (np.ndarray) – An array of the declinations of the vertices of the polygon surrounding the camera footprints (degrees).

single_eq_vertices(ra, decl, rotation=0)[source]

Compute vertices for a single pair of equatorial coordinates

Parameters:
  • ra (float) – The R.A. (in degrees)

  • decl (float) – The declination (in degrees)

  • rotation (float) – The camera rotation (in degrees)

Returns:

  • ra (np.ndarray) – An array of the R.A. of the vertices of the polygon surrounding the camera footprint (degrees).

  • decl (np.ndarray) – An array of the declinations of the vertices of the polygon surrounding the camera footprint (degrees).

schedview.compute.compute_hpix_metric_in_bands(visits, metric, constraint='', nside=32)[source]

Compute a MAF metric by visit.

Parameters:
  • visits (pandas.DataFrame) – The DataFrame of visits (with column names matching those of opsim database).

  • metric (rubin_sim.maf.metrics.BaseMetric) – The metric to compute.

  • constraint (str) – The SQL query to filter visits to be used.

  • nside (int) – The healpix nside of the healpix arrays to return.

Returns:

metric_values – A dictionary of healpix arrays, where the keys are the filters with visits in the input visit DataFrame.

Return type:

dict

schedview.compute.compute_maps(survey, conditions, nside=None)[source]

Compute healpix maps associated with a survey under given conditions.

Parameters:
  • survey (rubin_scheduler.scheduler.surveys.BaseSurvey) – The survey to summarize.

  • conditions (rubin_scheduler.scheduler.features.Conditions) – The conditions to use for the summary.

  • nside (int, optional) – The nside to use for the returned healpix maps. If not provided, the nside from the conditions will be used.

Returns:

survey_maps – An ordered dictionary of healpix maps associated with the survey.

Return type:

collections.OrderedDict

schedview.compute.compute_metric_by_visit(visits, metric, constraint='')[source]

Compute a MAF metric by visit.

Parameters:
  • visits (pandas.DataFrame) – The DataFrame of visits (with column names matching those of opsim database).

  • metric (rubin_sim.maf.metrics.BaseMetric) – The metric to compute.

  • constraint (str) – The SQL query to filter visits to be used.

Returns:

values – The metric values.

Return type:

pandas.Series

schedview.compute.convert_evening_date_to_night_of_survey(night_date, timezone='Chile/Continental')[source]

Convert a calendar date in the evening to the night of survey.

Parameters:
  • night_date (datetime.date) – The calendar date in the evening local time.

  • timezone (str) – The string designating the time zone. Defaults to ‘Chile/Continental’

Returns:

night_of_survey – The night of survey, starting from 0.

Return type:

int

schedview.compute.create_example(current_time=None, survey_start='2025-01-01T16:00:00Z', nside=None, simulate=True, scheduler_pickle_fname=None, opsim_db_fname=None, rewards_fname=None)[source]

Create an example scheduler and observatory.

Parameters:
  • current_time (float, str, datetime.datetime, pandas.Timestamp,) – or astropy.time.Time The time to initialize the observatory and conditions to. Floats are interpreted as MJD. Strings are interpreted as UTC. If None, use the current time. Defaults no None.

  • survey_start (float, str, datetime.datetime, pandas.Timestamp,) – or astropy.time.Time The survey start time.

  • nside (int) – The nside to use for the scheduler and observatory. If None, use the default nside for the example scheduler.

  • simulate (bool) – Run a sample simulation from survey_start to current_time

  • scheduler_pickle_fname (str) – The filename to save the scheduler to.

  • opsim_db_fname (str) – The filename to save the opsim database to.

  • rewards_fname (str) – The filename to save the rewards to.

Returns:

  • scheduler (rubin_scheduler.scheduler.schedulers.CoreScheduler) – The scheduler instance.

  • observatory (rubin_scheduler.models.ModelObservatory) – The observatory instance.

  • conditions (rubin_scheduler.scheduler.features.Conditions) – The conditions at the current time.

  • observations (pd.DataFrame) – The observations from the simulation.

schedview.compute.make_scheduler_summary_df(scheduler, conditions, reward_df=None)[source]

Summarize the reward from each scheduler

Parameters:
  • scheduler (rubin_scheduler.scheduler.schedulers.CoreScheduler) – The scheduler instance.

  • conditions (rubin_scheduler.scheduler.features.conditions.Conditions) – The conditions for which to summarize the reward.

  • reward_df (pandas.DataFrame) – The table with rewards for each survey. If None, calculate it.

Returns:

survey_df – A table showing the reword for each feasible survey, and the basis functions that result in it being infeasible for the rest.

Return type:

pandas.DataFrame

schedview.compute.make_survey_reward_df(survey, conditions, reward_df=None)[source]

Make a dataframe summarizing the rewards for a survey.

Parameters:
  • survey (rubin_scheduler.scheduler.surveys.BaseSurvey) – The survey to summarize.

  • conditions (rubin_scheduler.scheduler.features.Conditions) – The conditions to use for the summary.

  • reward_df (pandas.DataFrame, optional) – A dataframe with the columns “basis_function”, “basis_function_class”, “feasible”, “max_basis_reward”, “basis_area”, “basis_weight”, “max_accum_reward”, and “accum_area”. If not provided, this dataframe will be computed from the survey.

Returns:

reward_df – A dataframe with the columns “basis_function”, “basis_function_class”, “feasible”, “max_basis_reward”, “basis_area”, “basis_weight”, “max_accum_reward”, “accum_area”, and “doc_url”.

Return type:

pandas.DataFrame

schedview.compute.make_unique_survey_name(scheduler, survey_index=None)[source]

Make a unique survey name for a given survey index.

Parameters:
  • scheduler (rubin_scheduler.scheduler.schedulers.CoreScheduler) – The scheduler instance.

  • survey_index (list of int) – The index of the survey to name. If None, use the current survey.

Returns:

survey_name – A unique name for the survey.

Return type:

str

schedview.compute.night_events(night_date=None, site=None, timezone='Chile/Continental')[source]

Creata a pandas.DataFrame with astronomical events.

Parameters:
  • night_date (datetime.date) – The calendar date in the evening local time.

  • site (astropy.coordinates.earth.EarthLocation) – The observatory location. Defaults to Rubin observatory.

  • timezone (str) – The timezone name. Defaults to ‘Chile/Continental’

Returns:

events – A DataFrame of night events.

Return type:

pandas.DataFrame

schedview.compute.replay_visits(scheduler, visits)[source]

Update a scheduler instances with a set of visits.

Parameters:
  • scheduler (rubin_scheduler.scheduler.CoreScheduler) – An instance of the scheduler to update

  • visits (pandas.DataFrame) – A table of visits to add.

Plot

exception schedview.plot.BadConditionsError[source]

Bases: Exception

exception schedview.plot.BadSchedulerError[source]

Bases: Exception

schedview.plot.area_timeline_for_tier(rewards_df, tier, day_obs_mjd, show=True, **figure_kwargs)[source]

Plot the feasible area timeline for basis funcs in a specified tier.

Parameters:
  • rewards_df (pandas.DataFrame) – The table of rewards data.

  • tier (int) – The tier index, corresponding to the index of rubin_scheduler.scheduler.schedulers.CoreScheduler.survey_lists.

  • day_obs_mjd (int) – The MJD of the day_obs of the night to plot.

  • show (bool) – Actually show the plot? Defaults to True.

  • **figure_kwargs – Keyword arguments passed to bokeh.plotting.figure.

Returns:

`plot` – The plot that can be shown or saved.

Return type:

bokeh.models.layouts.LayoutDOM

schedview.plot.create_cadence_plot(nightly_totals, start_dayobs_mjd, end_dayobs_mjd, targets=None, cmap=Field(field='filter', transform=CategoricalColorMapper(id='p1002', ...), units=Unspecified), user_plot_kwargs={})[source]

“Create a cadence plot for a set of targets.

Parameters:
  • nightly_totals (pandas.DataFrame) – A DataFrame indexed by "target" (str) and "day_obs_iso8601" (str in YYYY-MM-DD format), filter names as column names (float), with total effective exposure times.

  • start_dayobs_mjd (float) – The dayobs MJD of the first night in the plot.

  • end_dayobs_mjd (float) – The dayobs MJD of the last night in the plot.

  • targets (list (str), optional) – The list of targets for which to make plots. Defaults to the targets included in the nightly_totals DataFrame.

  • cmap (bokeh.core.property.vectorization.Field (optional)) – The bokeh color map as generated by bokeh.transform.factor_cmap. Defaults to schedview.plot.PLOT_FILTER_CMAP.

  • user_plot_kwargs (dict) – Extra arguments to pass to bokeh.plotting.figure.vbar_stack. Defaults to {}.

Returns:

full_cadence_figure – The bokeh plot with cadence plots for all targets.

Return type:

bokeh.models.layouts.LayoutDOM

schedview.plot.create_hpix_visit_map_grid(hpix_maps, visits, conditions, **kwargs)[source]

Create a grid of healpix maps with visits overplotted.

Notes

Additional keyword args are passed to map_visits_over_hpix.

Parameters:
  • map_hpix (numpy.array) – An array of healpix values

  • visits (pd.DataFrame) – The table of visits to plot, with columns matching the opsim database definitions.

  • conditions (rubin_scheduler.scheduler.features.Conditions) – An instance of a rubin_scheduler conditions object.

Returns:

plot – The plot with the map

Return type:

bokeh.models.plots.Plot

schedview.plot.create_overhead_histogram(visits, bins=array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]), plot=None, **kwargs)[source]

Create a histogram of visit overhead times.

Paramaters

visitspandas.DataFrame

The table of visits, with overhead data (see add_overhead)

binsnumpy.ndarray

Bin locations for the histogram.

plotbokeh.models.plots.Plot or None

The figure on which to plot the histogram. None creates a new figure. Defaults to None.

returns:

`plot` – The figure with the histogram.

rtype:

bokeh.models.plots.Plot

schedview.plot.create_overhead_summary_table(overhead_summary, html=True)[source]

Make a formatted table from an overhead summary dictionary

Parameters:
  • overhead_summary (dict) – A dictionary of summary values, as computed by schedview.compute.visits.compute_overhead_summary

  • html (bool) – Format the table with html? Defaults to True

Returns:

`summary` – Formatted summary.

Return type:

str

schedview.plot.create_survey_reward_plot(scheduler, night_date, additional_visits=None, observatory=None, timezone='Chile/Continental')[source]

Build a plot of rewards by survey for a time period.

Parameters:
  • scheduler (rubin_scheduler.scheduler.schedulers.Core_scheduler or str) – The scheduler with the surveys to evaluate, or the name of a file from which such a scheduler should be loaded.

  • night_date (astropy.time.Time) – A time during the night to plot.

  • additional_visits (pandas.DataFrame or str, optional) – Visits to add to the scheduler before reward evaluation, by default None

  • observatory (ModelObservatory, optional) – Provides the location of the observatory, used to compute night start and end times. By default None

  • timezone (str, optional) – Timezone for horizontal axis, by default “Chile/Continental”

Returns:

  • figure (bokeh.plotting.figure) – The figure itself.

  • data (dict) – The arguments used to produce the figure using plot_survey_rewards.

schedview.plot.create_visit_explorer(visits, night_date, observatory=None, timezone='Chile/Continental')[source]

Create an explorer to interactively examine a set of visits.

Parameters:
  • visits (str or pandas.DataFrame) – One row per visit, as created by schedview.collect.opsim.read_opsim, or the name of a file from which such visits should be loaded.

  • night_date (datetime.date) – The calendar date in the evening local time.

  • observatory (ModelObservatory, optional) – Provides the location of the observatory, used to compute night start and end times. By default None.

  • timezone (str, optional) – _description_, by default “Chile/Continental”

Returns:

  • figure (hvplot.ui.hvDataFrameExplorer) – The figure itself.

  • data (dict) – The arguments used to produce the figure using plot_visits.

schedview.plot.create_visit_skymaps(visits, night_date, nside=32, observatory=None, timezone='Chile/Continental', planisphere_only=False)[source]

Create a map of visits on the sky.

Parameters:
  • visits (pandas.DataFrame or str) –

    If a pandas.DataFrame, it needs at least the following columns:

    "fieldRA"

    The visit R.A. in degrees (float).

    "fieldDec"

    The visit declination in degrees (float).

    "observationStartMJD"

    The visit start MJD (float).

    "filter"

    The visit filter (str)

    If a string, the file name of the opsim database from which the visits should be loaded.

  • night_date (datetime.date) – The calendar date of the evening of the night for which to plot the visits.

  • nside (int, optional) – The healpix nside to use for the map.

  • observatory (ModelObservatory, optional) – Provides the location of the observatory, used to compute night start and end times. By default None.

  • timezone (str, optional) – by default “Chile/Continental”

  • planisphere_only (bool) – by default False

Returns:

  • figure (bokeh.models.layouts.LayoutDOM) – The figure itself.

  • data (dict) – The arguments used to produce the figure using plot_visit_skymaps.

schedview.plot.map_survey_healpix(mjd, hpix_data, map_key, nside, map_class=<class 'uranography.horizon.HorizonMap'>, map_kwargs=None, cmap=None, cmap_scale='full', conditions=None, survey=None)[source]

Map a healpix map of a survey at a given MJD.

Parameters:
  • mjd (float) – The MJD at which to map the survey.

  • hpix_data (dict) – A dictionary of healpix maps. The map with map_key will be mapped to pixel color, and others will be shown in the hover tool.

  • map_key (str) – The key in hpix_data corresponding to the healpix map to display.

  • nside (int) – The nside at which to show the healpix maps.

  • map_class (class, optional) – The class of map to use. Defaults to uranography.HorizonMap.

  • map_kwargs (dict, optional) – Keyword arguments to pass to map_class.

  • cmap (bokeh.models.mappers.ColorMapper, optional) – A color mapper to use for the map. Defaults to a linear cmap with the “Inferno256” palette.

  • cmap_scale (str, optional) – The scale to use for the cmap. Defaults to “full”, which uses the full range of values in the healpix map. Alternatively, “zscale” can be used to use a zscale cmap.

  • conditions (rubin_scheduler.scheduler.features.Conditions, optional) – Default is None. The observing conditions at which to map the survey, used to determine telescope pointing. If None, do not mark telescope pointing.

  • survey (rubin_scheduler.scheduler.surveys.BaseSurvey, optional) – Default is None. The survey with fields to mark on the map. If None or an unsuitable survey type, do not mark survey fields.

Returns:

sky_map – The map of the sky.

Return type:

uranography.SphereMap

schedview.plot.map_visits_over_hpix(visits, conditions, map_hpix, plot=None, scale_limits=None, palette=['#f0f0f0', '#eff0f0', '#efeff0', '#eeeff0', '#edeef0', '#eceef0', '#ebedf0', '#ebedf0', '#eaecf0', '#e9ecf0', '#e8ebef', '#e8ebef', '#e7eaef', '#e6eaef', '#e5e9ef', '#e5e9ef', '#e4e9ef', '#e3e8ef', '#e2e8ef', '#e2e7ef', '#e1e7ef', '#e0e6ef', '#dfe6ef', '#dfe5ef', '#dee5ee', '#dde4ee', '#dce4ee', '#dbe3ee', '#dbe3ee', '#dae2ee', '#d9e2ee', '#d8e1ee', '#d8e1ee', '#d7e0ee', '#d6e0ee', '#d5e0ee', '#d5dfed', '#d4dfed', '#d3deed', '#d2deed', '#d2dded', '#d1dded', '#d0dced', '#cfdced', '#cedbed', '#cedbed', '#cddaed', '#ccdaec', '#cbd9ec', '#cbd9ec', '#cad9ec', '#c9d8ec', '#c8d8ec', '#c8d7ec', '#c7d7ec', '#c6d6ec', '#c5d6eb', '#c5d5eb', '#c4d5eb', '#c3d4eb', '#c2d4eb', '#c1d3eb', '#c1d3eb', '#c0d2eb', '#bfd2eb', '#bed2ea', '#bed1ea', '#bdd1ea', '#bcd0ea', '#bbd0ea', '#bbcfea', '#bacfea', '#b9ceea', '#b8cee9', '#b8cde9', '#b7cde9', '#b6cce9', '#b5cce9', '#b5cbe9', '#b4cbe8', '#b3cbe8', '#b2cae8', '#b2cae8', '#b1c9e8', '#b0c9e8', '#afc8e8', '#afc8e7', '#aec7e7', '#adc7e7', '#acc6e7', '#acc6e7', '#abc5e6', '#aac5e6', '#a9c5e6', '#a9c4e6', '#a8c4e6', '#a7c3e5', '#a6c3e5', '#a6c2e5', '#a5c2e5', '#a4c1e5', '#a4c1e4', '#a3c0e4', '#a2c0e4', '#a1bfe4', '#a1bfe3', '#a0bee3', '#9fbee3', '#9fbee3', '#9ebde2', '#9dbde2', '#9dbce2', '#9cbce1', '#9bbbe1', '#9bbbe1', '#9abae0', '#9abae0', '#99b9e0', '#98b9df', '#98b8df', '#97b8df', '#97b7de', '#96b7de', '#95b7de', '#95b6dd', '#94b6dd', '#94b5dc', '#93b5dc', '#92b4dc', '#92b4db', '#91b3db', '#91b3da', '#90b2da', '#8fb2da', '#8fb1d9', '#8eb1d9', '#8eb0d9', '#8db0d8', '#8dafd8', '#8cafd7', '#8bafd7', '#8baed6', '#8aaed6', '#8aadd6', '#89add5', '#89acd5', '#88acd4', '#88abd4', '#87abd4', '#87aad3', '#86aad3', '#86a9d2', '#85a9d2', '#84a8d1', '#84a8d1', '#83a7d0', '#83a7d0', '#82a7cf', '#82a6cf', '#81a6cf', '#81a5ce', '#80a5ce', '#80a4cd', '#7fa4cd', '#7fa3cc', '#7ea3cc', '#7ea2cb', '#7da2cb', '#7da1ca', '#7ca1ca', '#7ca0c9', '#7ca0c9', '#7ba0c8', '#7b9fc8', '#7a9fc7', '#799ec7', '#799ec7', '#789dc6', '#789dc6', '#779cc5', '#779cc5', '#769bc4', '#769bc4', '#759ac4', '#749ac3', '#749ac3', '#7399c3', '#7399c2', '#7298c2', '#7198c2', '#7197c1', '#7097c1', '#7096c1', '#6f96c0', '#6e95c0', '#6e95c0', '#6d95bf', '#6c94bf', '#6c94bf', '#6b93be', '#6a93be', '#6a92be', '#6992bd', '#6891bd', '#6791bd', '#6791bd', '#6690bc', '#6590bc', '#658fbc', '#648fbb', '#638ebb', '#628ebb', '#628dbb', '#618dba', '#608dba', '#5f8cba', '#5f8cba', '#5e8bb9', '#5d8bb9', '#5c8ab9', '#5b8ab9', '#5b8ab8', '#5a89b8', '#5989b8', '#5888b8', '#5788b7', '#5787b7', '#5687b7', '#5586b7', '#5486b7', '#5386b6', '#5285b6', '#5185b6', '#5084b6', '#5084b5', '#4f83b5', '#4e83b5', '#4d83b5', '#4c82b5', '#4b82b4', '#4a81b4', '#4981b4', '#4880b4', '#4780b4', '#4680b3', '#457fb3', '#447fb3', '#437eb3', '#427eb3', '#417eb2', '#407db2', '#3f7db2', '#3e7cb2', '#3c7cb2', '#3b7bb2', '#3a7bb1'], map_class=<class 'uranography.planisphere.Planisphere'>, prerender_hpix=True)[source]

Plot visit locations over a healpix map.

Parameters:
  • visits (pd.DataFrame) – The table of visits to plot, with columns matching the opsim database definitions.

  • conditions (rubin_scheduler.scheduler.features.Conditions) – An instance of a rubin_scheduler conditions object.

  • map_hpix (numpy.array) – An array of healpix values

  • plot (bokeh.models.plots.Plot or None) – The bokeh plot on which to make the plot. None creates a new plot. None by default.

  • scale_limits (list of float or None) – The scale limits for the healpix values. If None, use zscale to set the scale.

  • palette (str) – The bokeh palette to use for the healpix map.

  • map_class (class, optional) – The class of map to use. Defaults to uranography.Planisphere.

  • prerender_hpix (bool, optional) – Pre-render the healpix map? Defaults to True

Returns:

plot – The plot with the map

Return type:

bokeh.models.plots.Plot

schedview.plot.plot_airmass_vs_time(visits, almanac_events, band_colors={'g': '#008060', 'i': '#850000', 'r': '#ff4000', 'u': '#56b4e9', 'y': '#222222', 'z': '#6600cc'}, event_labels={'moonrise': 'moonrise', 'moonset': 'moonset', 'night_middle': None, 'sun_n12_rising': 'sun alt=-12°', 'sun_n12_setting': 'sun alt=-12°', 'sun_n18_rising': 'sun alt=-18°', 'sun_n18_setting': 'sun alt=-18°', 'sunrise': 'sunrise', 'sunset': 'sunset'}, event_colors={'moonrise': 'green', 'moonset': 'green', 'night_middle': None, 'sun_n12_rising': 'blue', 'sun_n12_setting': 'blue', 'sun_n18_rising': 'lightblue', 'sun_n18_setting': 'lightblue', 'sunrise': 'darkblue', 'sunset': 'darkblue'}, figure=None)[source]

Plot airmass vs. time for a set of visits

Parameters:
  • visits (pandas.DataFrame or bokeh.models.ColumnDataSource) – Dataframe or ColumnDataSource containing visit information.

  • almanac_events (pandas.DataFrame) – Dataframe containing almanac events.

  • band_colors (dict) – Mapping of filter names to colors. Default is BAND_COLORS.

  • event_labels (dict) – Mapping of almanac events to labels. Default is DEFAULT_EVENT_LABELS.

  • event_colors (dict) – Mapping of almanac events to colors. Default is DEFAULT_EVENT_COLORS.

  • figure (bokeh.plotting.Figure) – Bokeh figure object to plot on. If None, a new figure will be created.

Returns:

fig – Bokeh figure object

Return type:

bokeh.plotting.Figure

schedview.plot.plot_alt_vs_time(visits, almanac_events, band_shapes={'g': 'diamond', 'i': 'star', 'r': 'square', 'u': 'triangle', 'y': 'circle', 'z': 'hex'}, event_labels={'moonrise': 'moonrise', 'moonset': 'moonset', 'night_middle': None, 'sun_n12_rising': 'sun alt=-12°', 'sun_n12_setting': 'sun alt=-12°', 'sun_n18_rising': 'sun alt=-18°', 'sun_n18_setting': 'sun alt=-18°', 'sunrise': 'sunrise', 'sunset': 'sunset'}, event_colors={'moonrise': 'green', 'moonset': 'green', 'night_middle': None, 'sun_n12_rising': 'blue', 'sun_n12_setting': 'blue', 'sun_n18_rising': 'lightblue', 'sun_n18_setting': 'lightblue', 'sunrise': 'darkblue', 'sunset': 'darkblue'}, figure=None)[source]

Plot airmass vs. time for a set of visits

Parameters:
  • visits (pandas.DataFrame or bokeh.models.ColumnDataSource) – Dataframe or ColumnDataSource containing visit information.

  • almanac_events (pandas.DataFrame) – Dataframe containing almanac events.

  • band_colors (dict) – Mapping of filter names to colors. Default is BAND_COLORS.

  • event_labels (dict) – Mapping of almanac events to labels. Default is DEFAULT_EVENT_LABELS.

  • event_colors (dict) – Mapping of almanac events to colors. Default is DEFAULT_EVENT_COLORS.

  • figure (bokeh.plotting.Figure) – Bokeh figure object to plot on. If None, a new figure will be created.

Returns:

fig – Bokeh figure object

Return type:

bokeh.plotting.Figure

schedview.plot.plot_infeasible(reward_df, tier_label, night, observatory=None, surveys=None, plot_kwargs={})[source]

Create a plot showing infeasible basis functions.

Parameters:
  • reward_df (pandas.DataFrame) – The rewards by survey, as recorded by the scheduler instance when running the simulation.

  • tier_label (str) – The label for the tier to plot.

  • night (astropy.time.Time) – The night to plot.

  • observatory (ModelObservatory) – The model observatory to use.

  • surveys (list [str], optional) – A list of the survey names to plot. Default to all surveys in the tier.

  • plot_kwards (dict) – A dictionary of keyword parameters passed to bokeh.plotting.figure.

Returns:

app – The figure itself.

Return type:

bokeh.plotting.figure

schedview.plot.plot_overhead_vs_slew_distance(visits, plot=None, **kwargs)[source]

Plot visit overhead times.

Paramaters

visitspandas.DataFrame

The table of visits, with overhead data (see add_overhead)

binsnumpy.ndarray

Bin locations for the histogram.

plotbokeh.models.plots.Plot or None

The figure on which to plot the histogram. None creates a new figure. Defaults to None.

returns:

`plot` – The figure with the histogram.

rtype:

bokeh.models.plots.Plot

schedview.plot.plot_polar_alt_az(visits, band_shapes={'g': 'diamond', 'i': 'star', 'r': 'square', 'u': 'triangle', 'y': 'circle', 'z': 'hex'}, figure=None, legend=True)[source]

Plot airmass vs. time for a set of visits

Parameters:
  • visits (pandas.DataFrame or bokeh.models.ColumnDataSource) – Dataframe or ColumnDataSource containing visit information.

  • almanac_events (pandas.DataFrame) – Dataframe containing almanac events.

  • band_colors (dict) – Mapping of filter names to colors. Default is BAND_COLORS.

  • figure (bokeh.plotting.Figure) – Bokeh figure object to plot on. If None, a new figure will be created.

  • legend (bool) – Generate a legend. Default is True.

Returns:

fig – Bokeh figure object

Return type:

bokeh.plotting.Figure

schedview.plot.plot_rewards(reward_df, tier_label, night, observatory=None, obs_rewards=None, surveys=None, basis_function='Total', plot_kwargs={})[source]

Create the plot showing reward values by survey.

Parameters:
  • reward_df (pandas.DataFrame) – The rewards by survey, as recorded by the scheduler instance when running the simulation.

  • tier_label (str) – The label for the tier to plot.

  • night (astropy.time.Time) – The night to plot.

  • observatory (ModelObservatory) – The model observatory to use.

  • obs_rewards (pandas.DataFrame) – The mapping between scheduler calls and simulated observations, as recorded by the scheduler instance.

  • surveys (list [str], optional) – A list of the survey names to plot. Default to all surveys in the tier.

  • basis_funtions (list [str], optional) – A list of names of basis function to plot. Defaults to all basis functions in the tier.

  • plot_kwards (dict) – A dictionary of keyword parameters passed to bokeh.plotting.figure.

Returns:

app – The figure itself.

Return type:

bokeh.plotting.figure

schedview.plot.plot_survey_rewards(rewards)[source]

Plot survey rewards as a function of time.

Parameters:

rewards (pandas.DataFrame) –

Data with at least these columns:

"survey_name"

The name of the survey (str).

"time"

The sample time for the reward (datetime64[ns]).

"reward"

The reward (float).

Returns:

reward_plot – The figure.

Return type:

bokeh.plotting.figure

schedview.plot.plot_visit_param_vs_time(visits, column_name, plot=None, **kwargs)[source]

Plot a column in the visit table vs. time.

Parameters:
  • visits (pandas.DataFrame) – One row per visit, as created by schedview.collect.opsim.read_opsim.

  • column_name (str) – The name of the column to plot against time.

  • plot (bokeh.models.plots.Plot or None) – The figure on which to plot the visits. None creates a new figure. Defaults to None.

Returns:

`plot` – The figure with the plot.

Return type:

bokeh.models.plots.Plot

schedview.plot.plot_visit_planisphere(visits, footprint, conditions, hatch=False, fade_scale=0.001388888888888889, camera_perimeter='LSST', nside_low=8, show_stars=False)[source]

Plot visits on a map of the sky.

Parameters:
  • visits (pandas.DataFrame) –

    One row per visit, with at least the following columns:

    "fieldRA"

    The visit R.A. in degrees (float).

    "fieldDec"

    The visit declination in degrees (float).

    "observationStartMJD"

    The visit start MJD (float).

    "filter"

    The visit filter (str)

  • footprint (numpy.array) – A healpix map of the footprint.

  • conditions (rubin_scheduler.scheduler.features.conditions.Conditions) – The conditions for the night, which determines the start and end times covered by the map.

  • hatch (bool) – Use hatches instead of filling visit polygons. (SLOW!)

  • fade_scale (float) – Time (in days) over which visit outlines fade.

  • camera_perimeter (str or object) – An function that returns the perimeter of the camera footprint, or “LSST” for the LSST camera footprint. Defaults to “LSST”.

  • nside_low (int) – The healpix nside to try to use for low resolution sections of the healpix map.

  • show_stars (bool) – Show stars? (Defaults to False)

Returns:

_description_

Return type:

_type_

schedview.plot.plot_visit_skymaps(visits, footprint, conditions, hatch=False, fade_scale=0.001388888888888889, camera_perimeter='LSST', nside_low=8, show_stars=False)[source]

Plot visits on a map of the sky.

Parameters:
  • visits (pandas.DataFrame) –

    One row per visit, with at least the following columns:

    "fieldRA"

    The visit R.A. in degrees (float).

    "fieldDec"

    The visit declination in degrees (float).

    "observationStartMJD"

    The visit start MJD (float).

    "filter"

    The visit filter (str)

  • footprint (numpy.array) – A healpix map of the footprint.

  • conditions (rubin_scheduler.scheduler.features.conditions.Conditions) – The conditions for the night, which determines the start and end times covered by the map.

  • hatch (bool) – Use hatches instead of filling visit polygons. (SLOW!)

  • fade_scale (float) – Time (in days) over which visit outlines fade.

  • camera_perimeter (str or object) – An function that returns the perimeter of the camera footprint, or “LSST” for the LSST camera footprint. Defaults to “LSST”.

  • nside_low (int) – The healpix nside to try to use for low resolution sections of the healpix map.

  • show_stars (bool) – Show stars? (Defaults to False)

Returns:

_description_

Return type:

_type_

schedview.plot.plot_visits(visits)[source]

Instantiate an explorer to interactively examine a set of visits.

Parameters:

visits (pandas.DataFrame) – One row per visit, as created by schedview.collect.opsim.read_opsim

Returns:

figure – The figure itself.

Return type:

hvplot.ui.hvDataFrameExplorer

schedview.plot.reward_timeline_for_surveys(rewards_df, day_obs_mjd, show=True, **figure_kwargs)[source]

Plot the reward timeline for all surveys.

Parameters:
  • rewards_df (pandas.DataFrame) – The table of rewards data.

  • day_obs_mjd (int) – The MJD of the day_obs of the night to plot.

  • show (bool) – Actually show the plot? Defaults to True.

  • **figure_kwargs – Keyword arguments passed to bokeh.plotting.figure.

Returns:

`plot` – The plot that can be shown or saved.

Return type:

bokeh.models.layouts.LayoutDOM

schedview.plot.reward_timeline_for_tier(rewards_df, tier, day_obs_mjd, show=True, **figure_kwargs)[source]

Plot the reward timeline for basis functions in a specified tier.

Parameters:
  • rewards_df (pandas.DataFrame) – The table of rewards data.

  • tier (int) – The tier index, corresponding to the index of rubin_scheduler.scheduler.schedulers.CoreScheduler.survey_lists.

  • day_obs_mjd (int) – The MJD of the day_obs of the night to plot.

  • show (bool) – Actually show the plot? Defaults to True.

  • **figure_kwargs – Keyword arguments passed to bokeh.plotting.figure.

Returns:

`plot` – The plot that can be shown or saved.

Return type:

bokeh.models.layouts.LayoutDOM

Utilities

class schedview.param.DataFrame(default=None, columns=None, allow_empty=True, allow_None=False, *, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, per_instance=True, allow_refs=False, nested_refs=False)[source]

Bases: Parameter

A pandas.DataFrame parameter.

Parameters:
  • columns (list [str] or dict [‘str’, ‘type’]) – The columns of the DataFrame. If a dictionary, the keys are the column names and the values. If a list, it contains the column names. If None, any set of columns is accepted.

  • allow_empty (bool) – Whether to allow a DataFrame with no rows.

class schedview.param.Series(default=None, allow_None=False, *, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, per_instance=True, allow_refs=False, nested_refs=False)[source]

Bases: Parameter

A pandas.Series parameter.

schedview.sphere.offset_sep_bear(ra, decl, sep, bearing, degrees=False)[source]

Calculate coordinates after an offset by a separation.

Parameters:
  • ra (float) – R.A. as a float in radians

  • decl (float) – declination as a float in radians

  • sep (float) – separation in radians

  • bearing (float) – bearing (east of north) in radians

  • degrees (bool) – arguments and returnes are in degrees (False for radians).

Returns:

  • ra (float) – R.A. Right Ascension

  • decl (float) – declination

schedview.sphere.rotate_cart(ux, uy, uz, angle, x0, y0, z0)[source]

Rotate coordinates on a unit sphere around an axis

Parameters:
  • ux (float) – x coordinate of a point on the axis of rotation

  • uy (float) – y coordinate of a point on the axis of rotation

  • uz (float) – z coordinate of a point on the axis of rotation

  • angle (float) – Magnitude of the rotation.

  • x0 (float) – Input x coordinate

  • y0 (float) – Input y coordinate

  • z0 (float) – Input z coordinate

Returns:

  • ux (float) – Output x coordinate

  • uy (float) – Output y coordinate

  • uz (float) – Output z coordinate