phot_class.simulation¶
Generates light-curves using sncosmo and write models results to file.
Usage Example¶
>>> from phot_class import simulation
>>>
>>> # Average 91bg stretch and color determined using SIFTO
>>> print(simulation.avg_stretch)
>>> print(simulation.avg_color)
>>>
>>> # Stretch and color covariance determined using SIFTO
>>> print(simulation.covariance)
>>>
>>> # Return random array 5 stretch and color values for 91bg SNe
>>> stretch_array, color_array = bg_stretch_color(5)
>>>
>>> # Simulate parameters for 91bg SNe
>>> param_dicts = simulation.sim_bg_params(zmin=0, zmax=1, tmin=100, tmax=1000)
>>>
>>> # Generate light curves in SDSS band passes
>>> import sncosmo
>>> from phot_class import models
>>>
>>> models.register_sources()
>>> model = sncosmo.Model('sn91bg')
>>> phase_range = (-50, 50)
>>> light_curves = generate_lc(model, phase_range, param_dicts)
Function Documentation¶
-
phot_class.simulation.
bg_stretch_color
(size, avg_color=0.557, avg_stretch=0.975, covariance=((0.009216, -0.0110263), (-0.0110263, 0.030624999999999996)), min_stretch=0.65, max_stretch=1.25, min_color=0, max_color=1)[source]¶ Return random arrays for 91bg stretch and color
Parameters: - size (int) – Number of stretches / colors to return
- avg_color (float) – Average color value
- avg_stretch (float) – Average stretch value
- covariance (float) – Covariance matrix for stretch / color
- min_stretch (float) – Minimum stretch to return
- max_stretch (float) – Maximum stretch to return
- min_color (float) – Minimum color to return
- max_color (float) – Maximum color to return
Returns: An array of stretch values An array of color values
-
phot_class.simulation.
sim_bg_params
(zmin, zmax, tmin, tmax, area=1.0, ratefunc=None, cosmo=None, **kwargs)[source]¶ Simulate parameters for “observed” 91bg light curves
Parameters: - zmin (float) – Minimum redshift value
- zmax (float) – Maximum redshift value
- tmin (float) – Minimum observation time in days
- tmax (float) – Maximum observation time in days
- area (float) – Sky area in deg2 to simulate. Determines number of SNe.
- ratefunc (callable) – A callable that accepts a single float (redshift) and returns the
comoving volumetric rate at each redshift in units of yr^-1 Mpc^-3.
The default is a function that returns
1.e-4
. - cosmo (Cosmology) – The cosmology used to determine volume. The default is a
FlatLambdaCDM cosmology with
Om0=0.3
,H0=70.0
. - other kwargs for bg_stretch_color except size (Any) –
Returns: A list of dictionaries with model parameters for each light-curve
-
phot_class.simulation.
generate_lc
(model, phase_range, model_params)[source]¶ Generate light curves in SDSS band passes
This is a very simple simulation that assumes observations are performed simultaneously at each epoch with a gain of one and zero sky noise. Simulations use SDSS band-passes
Parameters: - model (Model) – The model to be used
- phase_range (tuple) – Phase range to simulate light-curves over
- model_params (list) – List of model parameters for each light-curve