lightcurvelynx.obstable.opsim
A module to store and manipulate Rubin’s simulated survey data (OpSim).
Classes
A wrapper class around the Rubin's simulated data Opsim. |
Functions
|
Create a random OpSim pointings drawn uniformly from (RA, dec). |
|
Add a column composed of random uniform data. Used for testing. |
|
Single-pointing oversampled OpSim table. |
Module Contents
- class OpSim(table, colmap=None, saturation_mags=None, **kwargs)[source]
Bases:
lightcurvelynx.obstable.obs_table.ObsTableA wrapper class around the Rubin’s simulated data Opsim.
- Parameters:
table (dict or pandas.core.frame.DataFrame) – The table with all the OpSim information.
colmap (dict) – A mapping of standard column names to a list of possible names in the input table. Each value in the dictionary can be a string or a list of strings. Defaults to the Rubin column names (OpSim, DP1, etc.), stored in _default_colnames.
saturation_mags (dict, optional) – A dictionary mapping filter names to their saturation thresholds in magnitudes. The filters provided must match those in the table. If not provided, OpSim-specific defaults will be used.
**kwargs (dict) –
Additional keyword arguments to pass to the constructor. This includes overrides for survey parameters such as:
dark_current : The dark current for the camera in electrons per second per pixel.
ext_coeff: Mapping of filter names to extinction coefficients.
pixel_scale: The pixel scale for the camera in arcseconds per pixel.
radius: The angular radius of the observations (in degrees).
read_noise: The readout noise for the camera in electrons per pixel.
zp_per_sec: Mapping of filter names to zeropoints at zenith.
- classmethod from_url(opsim_url, force_download=False)[source]
Construct an OpSim object from a URL to a predefined opsim data file.
For Rubin OpSim data, you will typically use the latest baseline data set in: https://s3df.slac.stanford.edu/data/rubin/sim-data/ such as: https://s3df.slac.stanford.edu/data/rubin/sim-data/sims_featureScheduler_runs3.4/baseline/baseline_v3.4_10yrs.db
- Parameters:
opsim_url (str) – The URL to the opsim data file.
force_download (bool, optional) – If True, the OpSim data will be downloaded even if it already exists locally. Default is False.
- Returns:
opsim – An OpSim object containing the data from the specified URL.
- Return type:
- create_random_opsim(num_obs, seed=None)[source]
Create a random OpSim pointings drawn uniformly from (RA, dec).
- Parameters:
num_obs (int) – The size of the OpSim to generate.
seed (int) – The seed to used for random number generation. If None then uses a default random number generator. Default: None
- Returns:
opsim_data (OpSim) – The OpSim data structure.
seed (int, optional) – The seed for the random number generator.
- opsim_add_random_data(opsim_data, colname, min_val=0.0, max_val=1.0)[source]
Add a column composed of random uniform data. Used for testing.
- Parameters:
opsim_data (OpSim) – The OpSim data structure to modify.
colname (str) – The name of the new column to add.
min_val (float) – The minimum value of the uniform range. Default: 0.0
max_val (float) – The maximum value of the uniform range. Default: 1.0
- oversample_opsim(opsim: OpSim, *, pointing: tuple[float, float] = (200, -50), search_radius: float = 1.75, delta_t: float = 0.01, time_range: tuple[float | None, float | None] = (None, None), bands: list[str] | None = None, strategy: str = 'darkest_sky')[source]
Single-pointing oversampled OpSim table.
It includes observations for a single pointing only, but with very high time resolution. The observations would alternate between the bands.
- Parameters:
opsim (OpSim) – The OpSim table to oversample.
pointing (tuple of RA and Dec in degrees) – The pointing to use for the oversampled table.
search_radius (float, optional) – The search radius for the oversampled table in degrees. The default is the half of the LSST’s field of view.
delta_t (float, optional) – The time between observations in days.
time_range (tuple or floats or Nones, optional) – The start and end times of the observations in MJD. None means to use the minimum (maximum) time in all the observations found for the given pointing. Time is being samples as
np.arange(*time_range, delta_t).bands (list of str or None, optional) – The list of bands to include in the oversampled table. The default is to include all bands found for the given pointing.
strategy (str, optional) –
The strategy to select prototype observations.
”darkest_sky” selects the observations with the minimal sky brightness (maximum “skyBrightness” value) in each band. This is the default.
”random” selects the observations randomly. Fixed seed is used.