phot_class.fitting

The fitting module runs a series of fits on individual light-curves and tabulates the results. This includes the ability to fit each bandpass independently (like in SiFTO) or to fit restframe blue/red band passes os separate, collective sets.

Function Documentation

phot_class.fitting.create_empty_table(parameters, **kwargs)[source]

Create an empty table for storing fit results

Columns:
  • obj_id
  • band
  • source
  • pre_max
  • post_max
  • num_params
  • *parameters
  • *parameters + _err
  • chisq
  • ndof
  • b_max
  • delta_15
  • message
Parameters:
  • parameters (iter) – List of parameter names to add columns for
  • arguments to pass astropy.Table (Any) –
Returns:

A masked astropy Table

phot_class.fitting.fit_results_to_dict(data, obj_id, band_set, results, fitted_model)[source]

Format sncosmo fit results so they can be appended to an astropy table

See the create_empty_table function for information on the assumed table format.

Parameters:
  • data (Table) – The data used in the fit
  • obj_id (str) – The id of the object that was fit
  • band_set (str) – The name of the band set (‘all’, ‘blue’, ‘red’)
  • results (Result) – Fitting results returned by sncosmo
  • fitted_model (Model) – A fitted sncosmo model
Returns:

Fit results as a dictionary

phot_class.fitting.run_band_fits(obj_id, data, fit_func, priors_hs=None, priors_bg=None, kwargs_hs=None, kwargs_bg=None, show_plots=False)[source]

Run light curve fits on a given target using the Hsiao and 91bg model

Fits are run using both the hsiao_x1 and sn91bg models for all available bands and then for each band individually.

Varied parameters include z, t0, amplitude, x1, and c. If the z is specified in the priors for both models, it is not varied in any fit. The parameters t0 and z are not varied in the individual band fits.

Parameters:
  • obj_id (str) – Id of the object being fitted
  • data (Table) – Table of photometric data
  • fit_func (func) – Function to use to run fits (eg. fit_funcs.fit_lc)
  • priors_hs (dict) – Priors to use when fitting hsiao
  • priors_bg (dict) – Priors to use when fitting sn91bg
  • kwargs_hs (dict) – Kwargs to pass fit_func when fitting salt2
  • kwargs_bg (dict) – Kwargs to pass fit_func when fitting sn91bg
  • show_plots (bool) – Plot and display each individual fit
Returns:

A table with results each model / dataset combination

phot_class.fitting.run_collective_fits(obj_id, data, fit_func, band_names, lambda_eff, priors_hs=None, priors_bg=None, kwargs_hs=None, kwargs_bg=None, show_plots=False)[source]

Run light curve fits on a given target using the Hsiao and 91bg model

Parameters:
  • obj_id (str) – Id of the object being fitted
  • data (Table) – Table of photometric data
  • fit_func (func) – Function to use to run fits (eg. fit_funcs.fit_lc)
  • band_names (list) – Name of bands included in data_iter
  • lambda_eff (list) – Effective wavelength for bands in band_names
  • priors_hs (dict) – Priors to use when fitting hsiao
  • priors_bg (dict) – Priors to use when fitting sn91bg
  • kwargs_hs (dict) – Kwargs to pass fit_func when fitting salt2
  • kwargs_bg (dict) – Kwargs to pass fit_func when fitting sn91bg
  • show_plots (bool) – Plot and display each individual fit
Returns:

A table with results each model / dataset combination