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, template='csp')

Class representing a supernova object.

__init__(name, z=0.0, ra=None, dec=None, lc_file=None, template='csp')
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.

  • template (str, default csp) – Name of the spectral energy distribution (SED) template. E.g., csp, hsiao, salt2, salt3, etc.

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_log=False, wave_log=True, skip_lcs_fit=False)

Fits and corrects the multi-colour light curves with an SED template.

The corrections include Milky-Way dust extinction and mangling of the SED (i.e. K-correction). Rest-frame light curves and parameters are calculated as end products.

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_log (bool, default False.) – Whether to initiallly fit the light curves in logarithmic (base 10) scale. The mangling is always done in flux space.

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

  • skip_lcs_fit (bool, default False.) – Whether to skip the initial light-curve fit.

fit_lcs(bands=None, k1='Matern52', fit_log=False, wave_log=True)

Fits the multi-colour observed 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_log (bool, default False.) – Whether to fit the light curves in logarithmic (base 10) scale.

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

get_init_rest_lightcurves(bands=['Bessell_B'])

Obtains the corrected rest-frame light curves from the initial light-curve fits.

Returns:

bands – Bands for which to extract the light curves.

Return type:

list-like, default ['Bessell_B']

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 mangling surface fit.

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.

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

init_gp_predict(times_pred, wavelengths_pred, return_cov=True)

Returns the Gaussian Process prediction of the initial 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.

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

plot_fits(plot_mag=False, init_fits=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.

  • init_fits (bool, default False) – If True, plots the initial light-curve fits.

  • 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.

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.

set_sed_template(template)

Sets the SED template to be used for the mangling function.

Parameters:

template (str) – Template name. E.g., csp, hsiao, salt2, salt3, etc.

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