opsimsummaryv2.utils#
This module contains usefull functions.
Attributes#
Functions#
|
Compute angle separation |
|
Write a SIMLIB data line |
|
Divide a dataframe into a list of sub-dataframne |
|
Download a specific versio of Opsim output. |
|
Fromat polygon that cross the 2 PI edge. |
|
Use geopandas to match host in survey fields. |
|
Resample host according to a WGTMAP |
|
Read a SNANA HOSTLIB WGTMAP |
Module Contents#
- opsimsummaryv2.utils.compute_angle_sep(ra_arr: numpy.array, dec_arr: numpy.array, ra: float, dec: float)[source]#
Compute angle separation
- Parameters:
- Returns:
angle separation
- Return type:
np.array
- opsimsummaryv2.utils.dataline(expMJD, ObsID, BAND, CCDgain, CCDnoise, SKYSIG, PSF, ZPT, ZPTNoise)[source]#
Write a SIMLIB data line
- Parameters:
expMJD (float) – Date of observation in MJD
ObsID (int) – ID of the observation
BAND (str) – Band used for the observation
CCDgain (float) – CCd gain
CCDnoise (float) – CCD noise
SKYSIG (float) – Sky noise error
PSF (float) – Point spread function sigma
ZPT (float) – Zero point
ZPTNoise (float) – Zero point calibration error
- Returns:
A SIMLIB LIB entry line
- Return type:
- opsimsummaryv2.utils.df_subdiviser(df, Nsub)[source]#
Divide a dataframe into a list of sub-dataframne
- Parameters:
df (pandas.DataFrame) – A pandas Dataframe to divide
Nsub (int) – Number of subdivision
- Returns:
A list of dataframme subdivisions.
- Return type:
- opsimsummaryv2.utils.download_rubinlsst_baseline_dbfile(version, output_dir=None)[source]#
Download a specific versio of Opsim output.
- Parameters:
- Raises:
ValueError – _description_
- opsimsummaryv2.utils.format_poly(poly)[source]#
Fromat polygon that cross the 2 PI edge.
- Parameters:
poly (shapely.polygons) – Polygon that represent fields
- Returns:
Polygon that represent fields cutted on 2 PI edge.
- Return type:
shapely.MultiPolygons
- opsimsummaryv2.utils.host_joiner(survey_fields, host)[source]#
Use geopandas to match host in survey fields.
- Parameters:
survey_fields (geopandas.GeoDataFrame) – Geodataframe describing survey fields
host (pandas.DataFrame) – Dataframe that contains host informations
- Returns:
Datafrane containing host that are in field with their correspind GROUPID
- Return type:
- opsimsummaryv2.utils.host_resampler(wgt_map_VAR, wgt_map_WGT, index, values, cdf_cut=0.95)[source]#
Resample host according to a WGTMAP
- Parameters:
- Returns:
_description_
- Return type:
_type_
- opsimsummaryv2.utils.read_SNANA_WGTMAP(file)[source]#
Read a SNANA HOSTLIB WGTMAP
- Parameters:
file (str) – path to WGTMAP
- Returns:
list of varnames, WGTMAP as a dict
- Return type:
- Raises:
ValueError – No WGT key
- opsimsummaryv2.utils.use_geopandas = True#