snat_sim.pipeline.data_model

Defines a standardized data model for communication between pipeline nodes.

Usage Example

Data models are defined as Python data classes. All fields in the data model are onptional except for the supernova identifier (snid). Other fields include the supernova model parameters used in a light-curve simulation / fit and the cadence used in the simulation.

>>> import sncosmo
>>> from snat_sim.models import SNModel, LightCurve
>>> from snat_sim.pipeline.data_model import PipelinePacket

>>> # Load example data and an example supernova model
>>> example_data = sncosmo.load_example_data()
>>> light_curve = LightCurve.from_sncosmo(example_data)
>>> model_parameters = example_data.meta
>>> sn_model = SNModel('Salt2')

>>> # Set an initial guess for fitting the model parameters
>>> sn_model.update(model_parameters)

>>> fit_result = sn_model.fit_lc(light_curve, vparam_names=['x0', 'x1', 'c'])
>>> packet = PipelinePacket(
...     snid=1234,                    # Unique SN identifier
...     sim_params=model_parameters,  # Parameters used to simulate the light-curve
...     light_curve=light_curve,      # The simulated light-curve
...     fit_result=fit_result,        # ``SNFitResult`` object
...     message='This fit was a success!'
... )

Module Docs

class snat_sim.pipeline.data_model.PipelinePacket(snid, sim_params=None, cadence=None, light_curve=None, fit_result=None, covariance=None, message='')[source]

Class representation of internal pipeline data products

Fields:

snid: Unique identifier for the data packet sim_params: Parameters used to simulate the light-curve cadence: The observational cadence used to simulate the light-curve light_curve: The simulated light-curve fit_result: Fit result from fitting the light-curve fitted_model: Model used to fit the light-curve message: Status message

sim_params_to_pandas()[source]

Return simulated parameters as a pandas Dataframe

Return type:

DataFrame

Returns:

Parameters used in the simulation of light-curves

fitted_params_to_pandas()[source]

Return fitted parameters as a pandas Dataframe

Return type:

DataFrame

Returns:

Parameters recovered from fitting a light-curve

packet_status_to_pandas()[source]

Return the packet status message as a pandas DataFrame

Return type:

DataFrame

Returns:

Dataframe with the snid, fit success status, and result message

__init__(snid, sim_params=None, cadence=None, light_curve=None, fit_result=None, covariance=None, message='')