Supernova Class

The backbone of PISCOLA is the Supernova object. This class incorporates all the other modules listed on the side. See the documentation bellow:

class piscola.Supernova(name, z=0.0, ra=None, dec=None, lc_file=None)

Class representing a supernova object.

__init__(name, z=0.0, ra=None, dec=None, lc_file=None)
Parameters:
  • name (str) – Name of the supernova.

  • z (float, default 0.0) – Redshift of the supernova.

  • ra (float, default None) – Right ascension of the supernova.

  • dec (float, default None) – Declination of the supernova.

  • lc_file (str, default None) – File with the supernova light-curve data.

add_filter(band, mag_sys)

Adds a new filter.

Parameters:
  • band (str) – Name of the filter

  • mag_sys (str) – Magnitude system.

export_fits(output_file=None)

Exports the light-curve fits into an output file.

Parameters:

output_file (str, default None) – Name of the output file. If None, the output file is of the form <SN name>_fits.dat.

export_restframe_lcs(output_file=None)

Exports the corrected, rest-frame light-curves into an output file.

Parameters:
  • output_file (str, default None) – Name of the output file. If None, the output

  • name>_restframe_lcs.dat. (file is of the form <SN)

fit(bands=None, k1='Matern52', fit_type='flux', wave_log=True, time_scale=None, wave_scale=None, add_noise=True)

Fits the observed multi-colour light-curve data with Gaussian Process.

The time of rest-frame B-band peak luminosity is estimated by finding where the derivative is equal to zero.

Parameters:
  • bands (list-like, default None) – Bands used for fitting light curves. By default, use all the available bands.

  • k1 (str) – Kernel to be used for the time axis. Either Matern52, Matern32 or ExpSquared.

  • fit_type (str, default flux.) – Transformation used for the light-curve fits: flux, log, arcsinh.

  • wave_log (bool, default True.) – Whether to use logarithmic (base 10) scale for the wavelength axis.

  • time_scale (float, default None) – If given, the time scale is fixed using this value, in units of days.

  • wave_scale (float, default None) – If given, the wavelength scale is fixed using this value, in units of angstroms. Note that if ‘wave_log=True’, the logarithm base 10 of this value is used.

  • add_noise (bool, default True) – Whether to add a white-noise component to the GP model. This “inflates” the errors.

get_obs_params(bands=None)

Obtains the time and magnitude of maximum for the observed light curves.

No corrections are applied at all.

Returns:

bands – Bands for which to extract the parameters.

Return type:

list-like, default None

gp_predict(times_pred, wavelengths_pred, return_cov=True)

Returns the Gaussian Process prediction of the light-curve fits.

Parameters:
  • times_pred (ndarray) – Time-axis grid.

  • wavelengths_pred (ndarray) – Wavelength-axis grid.

  • return_cov (bool, optional) – Whether to return the covariance or variance.

Returns:

  • mu (ndarray) – Mean of the Gaussian Process.

  • cov (ndarray) – Either the variance or covariance of the Gaussian Process.

plot_fits(plot_mag=False, fig_name=None)

Plots the light-curves fits results.

Plots the observed data for each band together with the gaussian process fits. The time of \(B\)-band peak is shown as a vertical dashed line.

Parameters:
  • plot_mag (bool, default False) – If True, plots the bands in magnitude space.

  • fig_name (str, default None) – If given, name of the output plot.

plot_lcs(plot_mag=False, fig_name=None)

Plots the observed light-curves.

Parameters:
  • plot_mag (bool, default False) – If True, plots the bands in magnitude space.

  • fig_name (str, default None) – If given, name of the output plot.

plot_rest_fits(plot_mag=False, fig_name=None)

Plots the rest-frame light-curves fits results.

Plots the observed data for each band together with the gaussian process fits. The time of \(B\)-band peak is shown as a vertical dashed line.

Parameters:
  • plot_mag (bool, default False) – If True, plots the bands in magnitude space.

  • fig_name (str, default None) – If given, name of the output plot.

save(path=None)

Saves a SN object into a pickle file

Parameters:

path (str, default None) – Path where to save the SN object. If None, use current directory. The file will be saved with the name <SN name>.pisco.

Bellow you can find information about two of the main functions, to create and load an Supernova object, respectively:

piscola.call_sn(lc_file)

Loads a supernova from a file and initialises the sn() object. The object is initialised with all the necessary information like filters, fluxes, etc.

Parameters:

lc_file (str) – File with the SN info and light curves.

Returns:

sn_obj – New sn() object.

Return type:

obj

piscola.load_sn(piscola_file)

Loads a sn() oject that was previously saved as a pickle file.

Parameters:

piscola_file (str) – File with the SN object saved with PISCOLA.

Returns:

pickle.load(file)sn() object previously saved as a pickle file.

Return type:

obj