actsnclass.LightCurve¶
-
class
actsnclass.LightCurve¶ Light Curve object, holding meta and photometric data.
Variables: - bazin_features_names (list) – List of names of the Bazin function parameters.
- bazin_features (list) – List with the 5 best-fit Bazin parameters in all filters. Concatenated from blue to red.
- dataset_name (str) – Name of the survey or data set being analyzed.
- filters (list) – List of broad band filters.
- id (int) – SN identification number
- id_name – Column name of object identifier.
- photometry (pd.DataFrame) – Photometry information. Keys –> [mjd, band, flux, fluxerr, SNR, MAG, MAGERR].
- redshift (float) – Redshift
- sample (str) – Original sample to which this light curve is assigned
- sim_peakmag (np.array) – Simulated peak magnitude in each filter
- sncode (int) – Number identifying the SN model used in the simulation
- sntype (str) – General classification, possibilities are: Ia, II or Ibc
-
check_queryable(mjd: float, r_lim: float)¶ Check if this light can be queried in a given day.
-
evaluate_bazin(param: list, time: np.array) → np.array¶ Evaluate the Bazin function given parameter values.
-
load_snpcc_lc(path_to_data: str)¶ Reads header and photometric information for 1 light curve
-
load_plasticc_lc(photo_file: str, snid: int)¶ Load photometric information for 1 PLAsTiCC light curve
-
load_resspect_lc(photo_file: str, snid: int)¶ Load photometric information for 1 RESSPECT light curve
-
fit_bazin(band: str) → list¶ Calculates best-fit parameters from the Bazin function in 1 filter
-
fit_bazin_all()¶ Calculates best-fit parameters from the Bazin func for all filters
-
plot_bazin_fit(save: bool, show: bool, output_file: srt)¶ Plot photometric points and Bazin fitted curve
Examples
##### for RESSPECT and PLAsTiCC light curves it is necessary to ##### input the object identification for dealing with 1 light curve
>>> import io >>> import pandas as pd >>> import tarfile
>>> from actsnclass import LightCurve
# path to header file >>> path_to_header = ‘~/RESSPECT_PERFECT_V2_TRAIN_HEADER.tar.gz’
# openning ‘.tar.gz’ files requires some juggling … >>> tar = tarfile.open(path_to_header, ‘r:gz’) >>> fname = tar.getmembers()[0] >>> content = tar.extractfile(fname).read() >>> header = pd.read_csv(io.BytesIO(content)) >>> tar.close()
# choose one object >>> snid = header[‘objid’].values[4]
# once you have the identification you can use this class >>> path_to_lightcurves = ‘~/RESSPECT_PERFECT_V2_TRAIN_LIGHTCURVES.tar.gz’
>>> lc = LightCurve() # create light curve instance >>> lc.load_snpcc_lc(path_to_lightcurves) # read data >>> lc.photometry mjd band flux fluxerr SNR 0 53214.0 u 0.165249 0.142422 1.160276 1 53214.0 g -0.041531 0.141841 -0.292803 .. ... ... ... ... ... 472 53370.0 z 68.645930 0.297934 230.406460 473 53370.0 Y 63.254270 0.288744 219.067050
>>> lc.fit_bazin_all() # perform Bazin fit in all filters >>> lc.bazin_features # display Bazin parameters [198.63302952843623, -9.38297128588733, 43.99971014717201, ... ... -1.546372806815066]
for fitting the entire sample …
>>> output_file = 'RESSPECT_PERFECT_TRAIN.DAT' >>> fit_resspect_bazin(path_to_lightcurves, path_to_header, output_file, sample='train')
-
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__()Initialize self. check_queryable(mjd, r_lim)Check if this light can be queried in a given day. evaluate_bazin(param, time)Evaluate the Bazin function given parameter values. fit_bazin(band)Extract Bazin features for one filter. fit_bazin_all()Perform Bazin fit for all filters independently and concatenate results. load_plasticc_lc(photo_file, snid)Return 1 light curve from PLAsTiCC simulations. load_resspect_lc(photo_file, snid)Return 1 light curve from RESSPECT simulations. load_snpcc_lc(path_to_data)Reads one LC from SNPCC data. plot_bazin_fit([save, show, output_file, …])Plot data and Bazin fitted function.