BaseObs¶
- class rubin_sim.moving_objects.BaseObs(footprint='camera', r_fov=1.75, x_tol=5, y_tol=3, eph_mode='nbody', eph_type='basic', obs_code='I11', eph_file=None, obs_time_col='observationStartMJD', obs_time_scale='TAI', seeing_col='seeingFwhmGeom', visit_exp_time_col='visitExposureTime', obs_ra='fieldRA', obs_dec='fieldDec', obs_rot_sky_pos='rotSkyPos', obs_degrees=True, outfile_name='lsst_obs.dat', obs_metadata='', camera_footprint_file=None)¶
Bases:
object
Base class to generate observations of a set of moving objects.
- Parameters:
- footPrint: `str`, optional
Specify the footprint for the FOV. Options include “camera”, “circle”, “rectangle”. ‘Camera’ means use the actual LSST camera footprint (following a rough cut with a circular FOV). Default is camera FOV.
- r_fov
float
, optional If footprint is “circular”, this is the radius of the fov (in degrees). Default 1.75 degrees (only used for circular fov).
- x_tol
float
, optional If footprint is “rectangular”, this is half of the width of the (on-sky) fov in the RA direction (in degrees). Default 5 degrees. (so size of footprint in degrees will be 10 degrees in the RA direction).
- y_tol
float
, optional If footprint is “rectangular”, this is half of the width of the fov in Declination (in degrees). Default is 3 degrees (so size of footprint in degrees will be 6 degrees in the Dec direction).
- eph_mode: `str`, optional
Mode for ephemeris generation - nbody or 2body. Default is nbody.
- eph_type: `str`, optional
Type of ephemerides to generate - full or basic. Full includes all values calculated by openorb; Basic includes a more basic set. Default is Basic. (this includes enough information for most standard MAF metrics).
- eph_file: `str` or None, optional
The name of the planetary ephemerides file to use for ephemeris generation. Default (None) will use the default for PyOrbEphemerides.
- obs_code: `str`, optional
Observatory code for ephemeris generation. Default is “I11” - Cerro Pachon.
- obs_time_col: `str`, optional
Name of the time column in the obsData. Default ‘observationStartMJD’.
- obs_time_scale: `str`, optional
Type of timescale for MJD (TAI or UTC currently). Default TAI.
- seeing_col: `str`, optional
Name of the seeing column in the obsData. Default ‘seeingFwhmGeom’. This should be the geometric/physical seeing as it is used for the trailing loss calculation.
- visit_exp_time_col: `str`, optional
Name of the visit exposure time column in the obsData. Default ‘visitExposureTime’.
- obs_ra: `str`, optional
Name of the RA column in the obsData. Default ‘fieldRA’.
- obs_dec: `str`, optional
Name of the Dec column in the obsData. Default ‘fieldDec’.
- obs_rot_sky_pos: `str`, optional
Name of the Rotator column in the obsData. Default ‘rotSkyPos’.
- obs_degrees: `bool`, optional
Whether the observational data is in degrees or radians. Default True (degrees).
- outfile_name
str
, optional The output file name. Default is ‘lsst_obs.dat’.
- obs_metadata
str
, optional A string that captures provenance information about the observations. For example: ‘baseline_v2.0_10yrs, years 0-5’ or ‘baseline2018a minus NES’ Default ‘’.
Methods Summary
calc_colors
([sedname, sed_dir])Calculate the colors for a given SED.
calc_trailing_losses
(velocity, seeing[, texp])Calculate the detection and SNR trailing losses.
generate_ephemerides
(sso, times[, eph_mode, ...])Generate ephemerides for 'sso' at times 'times' (assuming MJDs, with timescale self.obs_time_scale).
read_filters
([filter_dir, bandpass_root, ...])Read (LSST) and Harris (V) filter throughput curves.
Initialize the ephemeris generator.
sso_in_camera_fov
(ephems, obs_data)Determine which observations are within the actual camera footprint for a series of observations.
sso_in_circle_fov
(ephems, obs_data)Determine which observations are within a circular fov for a series of observations.
sso_in_fov
(ephems, obs_data)Convenience layer - determine which footprint method to apply (from self.footprint) and use it.
sso_in_rectangle_fov
(ephems, obs_data)Determine which observations are within a rectangular FoV for a series of observations.
write_obs
(obj_id, obj_ephs, obs_data[, sedname])Call for each object; write out the observations of each object.
Methods Documentation
- calc_colors(sedname='C.dat', sed_dir=None)¶
Calculate the colors for a given SED.
If the sedname is not already in the dictionary self.colors, this reads the SED from disk and calculates all V-[filter] colors for all filters in self.filterlist. The result is stored in self.colors[sedname][filter], so will not be recalculated if the SED + color is reused for another object.
- calc_trailing_losses(velocity, seeing, texp=30.0)¶
Calculate the detection and SNR trailing losses.
‘Trailing’ losses = loss in sensitivity due to the photons from the source being spread over more pixels; thus more sky background is included when calculating the flux from the object and thus the SNR is lower than for an equivalent brightness stationary/PSF-like source. dmagTrail represents this loss.
‘Detection’ trailing losses = loss in sensitivity due to the photons from the source being spread over more pixels, in a non-stellar-PSF way, while source detection is (typically) done using a stellar PSF filter and 5-sigma cutoff values based on assuming peaks from stellar PSF’s above the background; thus the SNR is lower than for an equivalent brightness stationary/PSF-like source (and by a greater factor than just the simple SNR trailing loss above). dmag_detect represents this loss.
- Parameters:
- Returns:
- generate_ephemerides(sso, times, eph_mode=None, eph_type=None)¶
Generate ephemerides for ‘sso’ at times ‘times’ (assuming MJDs, with timescale self.obs_time_scale).
The default engine here is pyoorb, however this method could be overwritten to use another ephemeris generator, such as ADAM.
The initialized pyoorb class (PyOrbEphemerides) is saved, to skip setup on subsequent calls.
- Parameters:
- sso
rubin_sim.movingObjects.Orbits
Typically this will be a single object.
- times: `np.ndarray`
The times at which to generate ephemerides. MJD.
- eph_mode: `str` or None, optional
Potentially override default eph_mode (self.eph_mode). Must be ‘2body’ or ‘nbody’.
- sso
- Returns:
- ephs
pd.Dataframe
Ephemerides of the sso.
- ephs
- read_filters(filter_dir=None, bandpass_root='total_', bandpass_suffix='.dat', filterlist=('u', 'g', 'r', 'i', 'z', 'y'), v_dir=None, v_filter='harris_V.dat')¶
Read (LSST) and Harris (V) filter throughput curves.
Only the defaults are LSST specific; this can easily be adapted for any survey.
- Parameters:
- filter_dir
str
, optional Directory containing the filter throughput curves (‘total*.dat’) Default set by ‘LSST_THROUGHPUTS_BASELINE’ env variable.
- bandpass_root
str
, optional Rootname of the throughput curves in filterlist. E.g. throughput curve names are bandpass_root + filterlist[i] + bandpass_suffix Default total_ (appropriate for LSST throughput repo).
- bandpass_suffix
str
, optional Suffix for the throughput curves in filterlist. Default ‘.dat’ (appropriate for LSST throughput repo).
- filterlist
list
, optional List containing the filter names to use to calculate colors. Default (‘u’, ‘g’, ‘r’, ‘i’, ‘z’, ‘y’)
- v_dir
str
, optional Directory containing the V band throughput curve. Default None = $SIMS_MOVINGOBJECTS_DIR/data.
- v_filter
str
, optional Name of the V band filter curve. Default harris_V.dat.
- filter_dir
- setup_ephemerides()¶
Initialize the ephemeris generator. Save the setup PyOrbEphemeris class.
This uses the default engine, pyoorb - however this could be overwritten to use another generator.
- sso_in_camera_fov(ephems, obs_data)¶
Determine which observations are within the actual camera footprint for a series of observations. Note that ephems and obs_data must be the same length.
- Parameters:
- ephems
np.ndarray
Ephemerides for the objects.
- obs_data
np.ndarray
Observation pointings.
- ephems
- Returns:
- indices
np.ndarray
Returns the indexes of the numpy array of the object observations which are inside the fov.
- indices
- sso_in_circle_fov(ephems, obs_data)¶
Determine which observations are within a circular fov for a series of observations. Note that ephems and obs_data must be the same length.
- Parameters:
- ephems
np.recarray
Ephemerides for the objects.
- obs_data
np.recarray
The observation pointings.
- ephems
- Returns:
- indices
np.ndarray
Returns the indexes of the numpy array of the object observations which are inside the fov.
- indices
- sso_in_fov(ephems, obs_data)¶
Convenience layer - determine which footprint method to apply (from self.footprint) and use it.
- Parameters:
- ephems
np.ndarray
Ephemerides for the objects.
- obs_data
np.ndarray
Observation pointings.
- ephems
- Returns:
- indices
np.ndarray
Returns the indexes of the numpy array of the object observations which are inside the fov.
- indices
- sso_in_rectangle_fov(ephems, obs_data)¶
Determine which observations are within a rectangular FoV for a series of observations. Note that ephems and obs_data must be the same length.
- Parameters:
- ephems
np.recarray
Ephemerides for the objects.
- obs_data
np.recarray
The observation pointings.
- ephems
- Returns:
- indices
np.ndarray
Returns the indexes of the numpy array of the object observations which are inside the fov.
- indices
- write_obs(obj_id, obj_ephs, obs_data, sedname='C.dat')¶
Call for each object; write out the observations of each object.
This method is called once all of the ephemeris values for each observation are calculated; the calling method should have already done the matching between ephemeris & simulated observations to find the observations where the object is within the specified fov. Inside this method, the trailing losses and color terms are calculated and added to the output observation file.
The first time this method is called, a header will be added to the output file.
- Parameters:
- obj_id
str
orint
orfloat
The identifier for the object (from the orbital parameters)
- obj_ephs
np.ndarray
The ephemeris values of the object at each observation. Note that the names of the columns are encoded in the numpy structured array, and any columns included in the returned ephemeris array will also be propagated to the output.
- obs_data
np.ndarray
The observation details from the simulated pointing history, for all observations of the object. All columns automatically propagated to the output file.
- sedname
str
, out The sed_filename for the object (from the orbital parameters). Used to calculate the appropriate color terms for the output file. Default “C.dat”.
- obj_id