rubin_lc_simulator.simulator
Created on Thu Jun 28 20:30:11 2018
@author: danielgodinez
Module Contents
Classes
Interface for simulating light curves using Rubin Observatory / LSST cadence and noise models. |
Functions
|
Draw a random baseline magnitude within the allowed dynamic range. |
|
Draw a random sky coordinate within the specified RA and DEC range. |
- class rubin_lc_simulator.simulator.LSSTSimulator(ra: float = 0.0, dec: float = 0.0, band: str = 'i', out_dir: str = '_metric_results_rubin_sim_')[source]
Interface for simulating light curves using Rubin Observatory / LSST cadence and noise models.
This class extracts the Rubin/LSST observational cadence at a specified sky position (RA, Dec) using the rubin_sim framework. It supports simulating photometric light curves by injecting user-defined models and applying realistic per-epoch noise based on the five sigma depth at each visit.
- Parameters:
ra (float) – Right Ascension (in decimal degrees) of the simulated source. Default is 0.0.
dec (float) – Declination (in decimal degrees) of the simulated source. Default is 0.0.
band (str, optional) – LSST photometric filter to use (‘u’, ‘g’, ‘r’, ‘i’, ‘z’, or ‘y’). Default is ‘i’.
out_dir (str, optional) – Output directory for storing cached metric results from rubin_sim. Default is ‘_metric_results_rubin_sim_’.
- photParams
LSST photometric configuration (e.g., exposure time, number of exposures).
- Type:
PhotometricParameters
- opsim
Handle to the baseline LSST OpSim cadence simulation database.
- Type:
Database
- metric
rubin_sim metric used to extract cadence and 5σ depth per observation.
- Type:
Metric
- mjd
Simulated time values for the generated light curve.
- Type:
np.ndarray or None
- mag
Simulated magnitudes (with noise) of the light curve.
- Type:
np.ndarray or None
- magerr
Corresponding per-epoch magnitude uncertainties.
- Type:
np.ndarray or None
- __repr__() str[source]
Return a string representation of the class instance.
- Returns:
Human-readable summary of the object.
- Return type:
- _slice_sky() rubin_sim.maf.slicers.UserPointsSlicer[source]
Slice the sky at the specified RA/DEC location.
- Returns:
The spatial slicer used by the rubin_sim API to evaluate the sky at the specified position.
- Return type:
rubin_sim.maf.slicers.UserPointsSlicer
- _retrieve_metrics() numpy.ndarray[source]
Query OpSim and return the raw metric data for the target position.
- Returns:
Array containing the raw simulation metrics for the specified sky position.
- Return type:
np.ndarray
- LSST_metrics() Optional[numpy.ndarray][source]
Public wrapper to obtain the visit table without any filtering and check if the slice is valid.
This method must be called by the user immediately after initialization. The returned dataSlice is not stored as a class attribute—by design, it must be handled externally by the user.
- Returns:
The dataSlice containing simulation metrics for a single sky position, representing all overlapping visits.
- Return type:
np.ndarray
Notes
The returned dataSlice is never stored internally. It should be assigned to a local variable and passed manually to downstream methods as needed.
- _filter_band_time(data: numpy.ndarray) numpy.ndarray[source]
Restrict a data slice to the configured band and MJD range.
- Parameters:
data (np.ndarray) – Array containing observation metadata, including filter, start MJD, and five-sigma depth.
- Returns:
Filtered data slice containing only entries within the configured band and MJD range.
- Return type:
np.ndarray
- _generate_light_curve(data: numpy.ndarray, lc: Optional[numpy.ndarray] = None) Tuple[numpy.ndarray, Ellipsis][source]
Generate a light curve with Rubin cadence and LSST noise model.
This method operates locally and does not assign instance attributes. Use lsst_real_lc() if you want the outputs stored as class attributes.
- Parameters:
data (np.ndarray) – The dataSlice containing cadence metrics for a single sky position.
lc (np.ndarray, optional) – Ideal (noise-free) light curve to which LSST noise will be added. If None, the method returns only the observation timestamps.
- Returns:
If lc is None, returns an array of observation MJDs. If lc is provided, returns a tuple of arrays: (mjd, mag, magerr), representing the light curve with simulated LSST noise.
- Return type:
np.ndarray or tuple of np.ndarray
Notes
This method is designed to be called twice. The first call retrieves the cadence (MJD array), allowing the user to simulate their own light curve. The second call takes the simulated magnitudes and returns the full light curve with LSST noise.
- lsst_real_lc(data_slice: numpy.ndarray, lc: Optional[numpy.ndarray] = None) Optional[numpy.ndarray][source]
Filter data_slice to the requested band and either return the cadence (MJD) or attach a full noisy light curve to the instance.
- Parameters:
data_slice (np.ndarray) – Output from LSST_metrics(), containing observation metadata.
lc (np.ndarray, optional) – Ideal (noise-free) magnitudes to which LSST noise will be added. If provided, the method assigns light curve attributes to the instance.
- Returns:
Returns an array of observation MJDs if lc is None. If lc is provided, the function modifies the instance in-place by setting the mjd, mag, and magerr attributes, and returns None.
- Return type:
np.ndarray or None
- rubin_lc_simulator.simulator.draw_random_baseline(band: str) float[source]
Draw a random baseline magnitude within the allowed dynamic range.
- rubin_lc_simulator.simulator.draw_random_coord(ra_range: tuple = (0, 360), dec_range: tuple = (-75, 15)) list[source]
Draw a random sky coordinate within the specified RA and DEC range.
- Parameters:
- Returns:
A list containing two values: right ascension and declination in decimal degrees.
- Return type: