Utilities#
- rubin_nights.dayobs_utils.day_obs_int_to_str(day_obs)[source]#
Day_obs integer YYYYMMDD transformed to string YYYY-MM-DD.
- Parameters:
day_obs (
int)- Return type:
str
- rubin_nights.dayobs_utils.day_obs_str_to_int(day_obs)[source]#
Day_obs string YYYY-MM-DD to integer YYYYMMDD.
- Parameters:
day_obs (
str)- Return type:
int
- rubin_nights.dayobs_utils.day_obs_sunset_sunrise(day_obs, sun_alt=-12)[source]#
Return the civil sunset and sunrise for day_obs.
- Parameters:
day_obs (
str|int) – Current day_obs in format YYYY-MM-DD or YYYYMMDDsun_alt (
float, default:-12) – Altitude (in degrees) of the sun at ‘sunrise’ and ‘sunset’.
- Returns:
sunset, sunrise – The time of -6 degree (civil) sunset and sunrise. Science observations are generally expected from -12 degree twilight.
- Return type:
Time,Time
- rubin_nights.dayobs_utils.day_obs_to_time(day_obs)[source]#
Day_obs int or string to astropy Time.
- Parameters:
day_obs (
int|str)- Return type:
Time
- rubin_nights.dayobs_utils.estimated_baseline_visit_range(day_obs, relative_performance=1.0)[source]#
Estimate an average and likely upper limit for the number of visits on a given day_obs.
- Parameters:
day_obs (
int) – The day of interest.relative_performance (
float, default:1.0) – The expected open shutter fraction ratio compared to the baseline value used in the simulations. The simulations used to estimate open shutter fraction here are v5.1.
- Returns:
estimate_visits – A dictionary with
n_vis_aveandn_vis_highkeys, containing a range of estimated nvisits values. These estimates are based on open shutter fraction and night length.- Return type:
dict[str:int]
- rubin_nights.dayobs_utils.time_to_day_obs(time)[source]#
Return day_obs for astropy Time, formatted as YYYY-MM-DD.
- Parameters:
time (
Time)- Return type:
str
- rubin_nights.dayobs_utils.time_to_day_obs_int(time)[source]#
Return day_obs for astropy Time, integer YYYYMMDD.
- Parameters:
time (
Time)- Return type:
int
- rubin_nights.dayobs_utils.today_day_obs()[source]#
Return the day_obs for today, formatted as YYYY-MM-DD.
- Return type:
str
- rubin_nights.dayobs_utils.tomorrow_day_obs()[source]#
Return the day_obs for tomorrow, formatted at YYYY-MM-DD.
- Return type:
str
- rubin_nights.dayobs_utils.yesterday_day_obs()[source]#
Return the day_obs for yesterday, formatted as YYYY-MM-DD.
- Return type:
str
- class rubin_nights.ts_xml_enums.CSCState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnumCSC summaryState constants.
- class rubin_nights.ts_xml_enums.CategoryIndexExtended(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnumAdd assigned
category indexvalues for other portions of the scriptqueue context feed.
- class rubin_nights.ts_xml_enums.SalIndex(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnumAllowed SAL indices for the bin scripts.
The CSC allows other positive values, as well, but those should only be used for unit testing.
- class rubin_nights.ts_xml_enums.ScriptState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
IntEnumScriptState constants.
- rubin_nights.ts_xml_enums.apply_enum(x, column, enumvals)[source]#
Apply one of the ts-xml enums
- Parameters:
x (
Series)column (
str)enumvals (
ScriptState|CSCState)
- Return type:
str
- rubin_nights.plot_utils.detector_plot(key, detector_values, camera_df, title=None, vmin=None, vmax=None, cmap='viridis', text_color='black', ax=None)[source]#
Plot the values per detector arranged across the focal plane.
- Parameters:
key (
str) – The value out of thedetValuesdataframe to plot.detector_values (
Series|DataFrame) – The dataframe with values per detector.camera_df (
DataFrame) – A dataframe with camera detector locations, such as fromrubin_nights/data/lsstCamera.h5.title (
str|None, default:None) – Optional title for the plot.vmin (
float|None, default:None) – The minimum and maximum values for the colorbar. If None, will use the nanmin/nanmax of the data.vmax (
float|None, default:None) – The minimum and maximum values for the colorbar. If None, will use the nanmin/nanmax of the data.cmap (
Colormap|str, default:'viridis') – Matplotlib colormap.test_color – Color for the text over each detector.
ax (
Axes|None, default:None) – Matplotlib axes to use for the plot.text_color (
str, default:'black')
- Returns:
fig, ax – Matplotlib figure and axes for the plot.
- Return type:
matplotlib.Figure,matplotlib.axes.Axes