lc_correction package¶
lc_correction.compute module¶
-
lc_correction.compute.
CHINR_THRESHOLD
= 2¶ max threshold for chinr
-
lc_correction.compute.
DISTANCE_THRESHOLD
= 1.4¶ max threshold for distnr
-
lc_correction.compute.
SCORE_THRESHOLD
= 0.4¶ max threshold for sgscore
-
lc_correction.compute.
SHARPNR_MAX
= 0.1¶ max value for sharpnr
-
lc_correction.compute.
SHARPNR_MIN
= -0.13¶ min value for sharpnr
-
lc_correction.compute.
ZERO_MAG
= 100.0¶ default value for zero magnitude (a big value!)
-
lc_correction.compute.
apply_correction
(candidate)[source]¶ Correction function for a set of detections
Parameters: candidate ( pd.DataFrame
) – A dataframe with detections of a candidate.Returns: Wrapper for correction for magnitude, sigma and sigma_ext Return type: tuple Example:
(m_corr, s_corr, s_corr_ext) = correction(a, b, c, d, e)
-
lc_correction.compute.
apply_correction_df
(df)[source]¶ Correction function for a set of detections with the same object id and filter id. Use with pd.DataFrame.apply(this)
Parameters: df ( pd.DataFrame
) – A dataframe with detections of a candidate.Returns: A pandas dataframe with detections corrected Return type: pd.DataFrame
Example:
corrected = detections.groupby(["objectId", "fid"]).apply(apply_correction_df)
-
lc_correction.compute.
apply_mag_stats
(df, distnr=None, distpsnr1=None, sgscore1=None, chinr=None, sharpnr=None)[source]¶ Parameters: - df (
pd.DataFrame
) – A dataframe with corrected detections of a candidate. - distnr (float) –
- distpsnr1 (float) –
- sgscore1 (float) –
- chinr (float) –
- sharpnr (float) –
Returns: A pandas dataframe with magnitude statistics
Return type: pd.DataFrame
- df (
-
lc_correction.compute.
apply_object_stats_df
(corrected, magstats, step_name=None)[source]¶ Parameters: - corrected (
pd.DataFrame
) – A dataframe with corrected detections. - magstats (
pd.DataFrame
) – A dataframe with magnitude statistics. - step_name (string) –
Returns: Object statistics in a dataframe
Return type: pd.DataFrame
- corrected (
-
lc_correction.compute.
apply_objstats_from_correction
(df)[source]¶ Parameters: df ( pd.DataFrame
) – A dataframe with corrected detections of a candidate.Returns: A pandas series with statistics of an object Return type: pd.Series
-
lc_correction.compute.
apply_objstats_from_magstats
(df)[source]¶ Parameters: df ( pd.DataFrame
) – A dataframe with magnitude statistics.Returns: A pandas series with statistics of an object Return type: pd.Series
-
lc_correction.compute.
correction
(magnr, magpsf, sigmagnr, sigmapsf, isdiffpos, oid=None)[source]¶ Correction function. Implement of correction formula.
Parameters: - magnr (float) – Magnitude of nearest source in reference image PSF-catalog within 30 arcsec [mag]
- magpsf (float) – Magnitude from PSF-fit photometry [mag]
- sigmagnr (float) – 1-sigma uncertainty in magnr within 30 arcsec [mag]
- sigmapsf (float) – 1-sigma uncertainty in magpsf [mag]
- isdiffpos (int) – 1 => candidate is from positive (sci minus ref) subtraction; 0 => candidate is from negative (ref minus sci) subtraction
Returns: Correction for magnitude, sigma and sigma_ext
Return type: tuple
Example:
(m_corr, s_corr, s_corr_ext) = correction(a, b, c, d, e)
-
lc_correction.compute.
dmdt
(magpsf_first, sigmapsf_first, nd_diffmaglim, mjd_first, nd_mjd)[source]¶ Calculate dm/dt
Parameters: - magpsf_first (float) –
- sigmapsf_first (float) –
- nd_diffmaglim (float) –
- mjd_first (float) –
- nd_mjd (float) –
Returns: dm_sigma, dt, dmsigdt
Return type: tuple
Example:
dm_sigma, dt, dmsigdt = dmdt(magpsf_first, sigmapsf_first, nd.diffmaglim, mjd_first, nd.mjd)
-
lc_correction.compute.
do_dmdt
(nd, magstats, dt_min=0.5)[source]¶ Parameters: - nd (
pd.DataFrame
) – A dataframe with non detections. - magstats (
pd.DataFrame
) – A dataframe with magnitude statistics. - dt_min (float) –
Returns: Compute of dmdt of an object
Return type: pd.Series
- nd (
-
lc_correction.compute.
do_dmdt_df
(magstats, non_dets)[source]¶ Parameters: - magstats (
pd.DataFrame
) – A dataframe with magnitude statistics. - non_dets (
pd.DataFrame
) – A dataframe with non detections.
Returns: Compute of dmdt of an object in a dataframe
Return type: pd.DataFrame
- magstats (
-
lc_correction.compute.
is_dubious
(corrected, isdiffpos, corr_magstats)[source]¶ Get if object is dubious
Parameters: - corrected (bool) –
- isdiffpos (bool) –
- corr_magstats (bool) –
Returns: if the object is dubious
Return type: bool
-
lc_correction.compute.
is_stellar
(nearZTF, nearPS1, stellarPS1, stellarZTF)[source]¶ Get if object is stellar
Parameters: - nearZTF (bool) –
- nearPS1 (bool) –
- stellarPS1 (bool) –
- stellarZTF (bool) –
Returns: if the object is stellar
Return type: bool
-
lc_correction.compute.
near_stellar
(first_distnr, first_distpsnr1, first_sgscore1, first_chinr, first_sharpnr)[source]¶ Get if object is near stellar
Parameters: - first_distnr (
float
) – Distance to nearest source in reference image PSF-catalog within 30 arcsec [pixels] - first_distpsnr1 (
float
) – Distance of closest source from PS1 catalog; if exists within 30 arcsec [arcsec] - first_sgscore1 (
float
) – Star/Galaxy score of closest source from PS1 catalog 0 <= sgscore <= 1 where closer to 1 implies higher likelihood of being a star - first_chinr (
float
) – DAOPhot chi parameter of nearest source in reference image PSF-catalog within 30 arcsec - first_sharpnr (
float
) – DAOPhot sharp parameter of nearest source in reference image PSF-catalog within 30 arcsec
Returns: if the object is near stellar
Return type: tuple
- first_distnr (