opsimsummaryv2#
Submodules#
Attributes#
Classes#
A class to manipulate OpSim db data and turn them into simulation inputs. |
Package Contents#
- class opsimsummaryv2.OpSimSurvey(db_path, mjd_range=None, host_file=None, host_config={})[source]#
A class to manipulate OpSim db data and turn them into simulation inputs.
- db_path#
Path to the database file
- Type:
- sql_engine#
The sqlalchemy engine link to the db.
- Type:
sqlalchemy.engine.base.Engine
- opsimdf#
Dataframe of the simulated observations.
- Type:
- tree#
A BallTree used to select observations on the healpy representation of the survey.
- Type:
sklearn.neighbors.BallTree
- host#
Dataframe of the hosts.
- Type:
- hp_rep#
The healpy representation oif the survey
- Type:
- survey#
The healpy representation oif the survey
- Type:
- survey_hosts#
The hosts that are inside the survey.
- Type:
- static _get_df_from_sql(sql_engine, mjd_range=None)[source]#
Load data from the db file.
- Parameters:
- Returns:
Dataframe of the simulated observations.
- Return type:
- static _get_sql_engine(dbname)[source]#
Read a sql db Opsim output file.
- Parameters:
dbname (str) – Path to sql file.
- Returns:
The sqlalchemy engine link to the db.
- Return type:
sqlalchemy.engine.base.Engine
- _read_host_file(host_file, col_ra='ra', col_dec='dec', ra_dec_unit='radians', wgt_map=None, add_SNMAGSHIFT=False)[source]#
Read a parquet file containing hosts.
- Parameters:
- Returns:
Dataframe of the hosts.
- Return type:
- compute_hp_rep(nside=256, minVisits=500, maxVisits=100000, ddf_nobs_thresh=1100, add_ddf_tag=False, angle_sep_tol=10)[source]#
Compute a healpy version of the survey.
- formatObs(OpSimObs, keep_keys=[])[source]#
Format function to get quantities of interest for simulation.
- Parameters:
OpSimObs (pandas.DataFrame) – Dataframe of OpSim output
keep_keys (list(str)) – List of keys to keep in addition to formatted quantities
- Returns:
Dataframe that contains quantities for simulation.
- Return type:
Notes
Quantities are obtained following arxiv:1905.02887
Details of the calculs:
The \(\sigma_\mathrm{PSF}\) in units of \(\mathrm{arcsec}^{-1}\) is obtained as
\[\sigma_\mathrm{PSF} = \frac{\mathbf{seeingFwhmEff}}{2\sqrt{2\ln2}}.\]The \(\mathbf{PSF}\) is computed in units of \(\mathrm{pixel}^{-1}\) as
\[\mathbf{PSF} = \frac{\sigma_\mathrm{PSF}}{\mathrm{PixelSize}},\]where \(\mathrm{PixelSize}\) is the pixel size in \(\mathrm{arcsec}^{-1}\).
The zero-point \(\mathbf{ZPT}\) is computed as
\[\mathbf{ZPT} = 2 m_5 - m_\mathrm{sky} + 2.5 \log\left[25 A \left(1 + A^{-1}10^{-0.4(m_5-m_\mathrm{sky})}\right)\right],\]where \(m_5 = \mathbf{fiveSigmaDepth}\), \(m_\mathrm{sky} = \mathbf{skyBrightness}\) and \(A\) is the noise equivalent area given by \(A = 4 \pi \sigma_\mathrm{PSF}^2\).
The sky noise \(\mathbf{SKYSIG}\) in unit of \(\mathrm{ADU}.\mathrm{pixel}^{-1}\) is computed such as
\[\mathbf{SKYSIG}^2 = 10^{-0.4\left(m_\mathrm{sky} - \mathbf{ZPT}\right)} \times \mathrm{PixelSize}^2.\]
- get_obs_from_coords(ra, dec, is_deg=True, formatobs=False, keep_keys=[])[source]#
Get observations at ra, dec coordinates.
- Parameters:
ra (numpy.ndarray(float)) – RA coordinate
dec (numpy.ndarray(float)) – Dec coordinate
is_deg (bool, optional) – is RA, Dec given in degrees, by default True
formatobs (bool, optional) – format obs for simulation, by default False
keep_keys (list(str)) – List of keys to keep in addition to formatted quantities
- Yields:
pandas.DatFrame – Dataframes of observations.
- get_survey_hosts(nworkers=10)[source]#
Get survey hosts.
- Parameters:
nworkers (int, optional) – Number of cores used to run multiprocessing, by default 10
- Returns:
Dataframe of host inside the survey, matched to their field indicated by GROUPID.
- Return type:
- plot_hp_rep(**hp_mollview_kwargs)[source]#
Plot the healpy mollview of the survey representation.
- Returns:
The mollview figure
- Return type:
matplotlib.Figure
- sample_survey(N_fields, random_seed=None, nworkers=10)[source]#
Sample Nfields inside the survey’s healpy representation.
- Parameters:
Notes
Random seed only apply on field sampling.
- __LSST_DDF_TAGS__#
- __LSST_FIELD_RADIUS__#
- __LSST_pixelSize__ = 0.2#
- _hp_rep = None#
- _survey = None#
- db_path#
- host = None#
- property hp_rep#
- opsimdf#
- sql_engine = None#
- property survey#
- property survey_hosts#
- tree#
- opsimsummaryv2.__opsimsummaryv2_dir_path__#
- opsimsummaryv2.__version__ = '0.1'#
- opsimsummaryv2.use_geopandas = True#