snat_sim.plasticc

The plasticc module provides data access for PLAsTICC cadence simulations stored on the local machine. Data is accessible by specifying the cadence name and model number used in a given simulation.

Usage Example

The PLAsTICC class is responsible for handling data access:

>>> from snat_sim.plasticc import PLAsTICC

>>> # Get a list of cadences available in the directory printed above
>>> print(PLAsTICC.get_available_cadences())  
>>> [ 'alt_sched' ]  

>>> # Count the number of light-curves for a given cadence and SN model
>>> lc_data = PLAsTICC('alt_sched', model=11)
>>> num_lc = lc_data.count_light_curves()

The class provides basic data access via the construction of an iterator over the observed cadence for each simulated light-curve. The iterator returns the unique Id, parameters, and cadecne used in each simulation.

Note

You should expect the first evaluation of the iterator to be slow since it has to load data into memory as chunks.

>>> lc_iterator = lc_data.iter_cadence(iter_lim=10, verbose=False)
>>> snid, sim_params, cadence = next(lc_iterator)

The light-curve simulated by PLAsTICC for each cadence can optionally be included with the iterator:

>>> lc_iterator = lc_data.iter_cadence(iter_lim=10, include_lc=True, verbose=False)
>>> snid, sim_params, cadence, lc = next(lc_iterator)

Module Docs

class snat_sim.plasticc.PLAsTICC(cadence, model)[source]

Data access object for PLAsTICC simulation data

__init__(cadence, model)[source]

Data access object for PLAsTICC simulations performed using a given cadence and SN model

Parameters:
  • cadence (str) – The cadence to load data for

  • model (int) – The numerical identifier of the PLAsTICC SN model used in the simulation

static get_available_cadences()[source]

Return a list of all cadences available in the working environment

Return type:

List[str]

get_model_headers()[source]

Return a list of file paths for all simulation header files

Return type:

List[Path]

count_light_curves()[source]

Return the number of available light-curve simulations for the current cadence and model

Return type:

int

iter_cadence(iter_lim=None, include_lc=False, verbose=True)[source]

Iterate over available cadence data for each supernova

Parameters:
  • iter_lim – Limit the number of iterated light-curves

  • include_lc – Include the PLAsTICC simulated light-curve with iterator outputs

  • verbose – Display a progress bar

Yields:
  • The supernova identifier (SNID)

  • The parameters used in the simulation

  • The cadence of the simulation