lightcurves

lightcurves#

This module provides functions to create lightcurves by applying a transient model to survey observing logs. (used by dataset.realize_lightcurves).

skysurvey.lightcurves.get_obsdata(template, observations, parameters, zpsys='ab', incl_error=True, discard_bands=False, trim_observations=False, phase_range=None)[source]#

Get observed data using sncosmo.realize_lcs().

Parameters:
  • template (sncosmo.Model) – an sncosmo model from which we can draw observations

  • observations (pandas.DataFrame) – Dataframe containing the observing infortation. requested entries: TBD

  • parameters (pandas.DataFrame) – Dataframe containing the target parameters information. These depend on you model.

  • incl_error (bool) – should the returned flux contain a random gaussian scatter drawn from the flux_err ? If False, lightcurve flux are “perfect”.

  • discard_bands (bool) – If True, if the sncosmo model is not defined in a given observeing band, the observation is discarded altogether, to prevent sncosmo.realize_lcs() from crashing. This only works for bands that are too blue for now.

Returns:

all the observations for all targets

Return type:

MultiIndex DataFrame

See also

DataSet.from_targets_and_survey: generate a DataSet from target and survey’s object

skysurvey.lightcurves.realize_lightcurves(observations, model, parameters, trim_observations=False, phase_range=None, scatter=True, rng=None)[source]#

Realize data for a set of SNe given a set of observations.

Note: adapted from sncosmo.realize_lcs, but:

  • replacing astropy.Table by pandas.DataFrame

  • removing ability to use aliases. (no time lost in that)

  • removing thresh (no time lost in that)

Parameters:
  • observations (pandas.DataFrame) – Table of observations. Must contain the following column names: band, mjd, zp, zpsys, gain, skynoise.

  • model (sncosmo.Model) – The model to use in the simulation.

  • parameters (pandas.DataFrame) – List of parameters to feed to the model for realizing each light curve.

  • trim_observations (bool, optional) – If True, only observations with times between model.mintime() and model.maxtime() are included in result table for each SN. Default is False.

  • phase_range (list, None, optional) – If given, only observations within the given rest-frame phase range will be considered.

  • scatter (bool, optional) – If True, the flux value of the realized data is calculated by adding a random number drawn from a Normal Distribution with a standard deviation equal to the fluxerror of the observation to the bandflux value of the observation calculated from model. Default is True.

  • rng (None, int, (Bit)Generator, optional) – seed for the random number generator. (doc adapted from numpy’s np.random.default_rng docstring. See that documentation for details.) If None, an unpredictable entropy will be pulled from the OS. If an int, (>0), it will set the initial BitGenerator state. If a (Bit)Generator, it will be returned as a Generator unaltered.

Returns:

sne – Table of realized data for each item in params.

Return type:

list of pandas.DataFrame

Notes

skynoise is the image background contribution to the flux measurement error (in units corresponding to the specified zeropoint and zeropoint system). To get the error on a given measurement, skynoise is added in quadrature to the photon noise from the source.

It is left up to the user to calculate skynoise as they see fit as the details depend on how photometry is done and possibly how the PSF is is modeled. As a simple example, assuming a Gaussian PSF, and perfect PSF photometry, skynoise would be 4 * pi * sigma_PSF * sigma_pixel where sigma_PSF is the standard deviation of the PSF in pixels and sigma_pixel is the background noise in a single pixel in counts.