The sn_magnitudes.py
module is responsible for calculating supernova
magnitudes as a function of PWV and redshift. Functionality includes calculating
magnitudes directly from a supernova model or via a light-curve fit.
Warning
DO NOT USE THIS MODULE FOR NEW DEVELOPMENT. This module is deprecated. All functionality provided by this module is now available elsewhere in the package.
Retrieve PWV values to use as reference values
Lower pwv bound for calculating slope
Reference PWV value for normalizing delta m
Upper pwv bound for calculating slope
config_path (Union
[str
, Path
]) – Path of config file if not default
Dict
[str
, Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]]
Dictionary with PWV values in mm
Calculate apparent magnitude due to presence of PWV
Magnitude is calculated for the model by adding PWV effects to a model and leaving all other parameters unchanged.
model (Union
[SNModel
, Model
]) – The sncosmo model to use in the simulations
pwv_arr (Collection
[Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]]) – Array of PWV values
z_arr (Collection
[Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]]) – Array of redshift values
bands (List
[str
]) – Name of the bands to tabulate magnitudes for
verbose (bool
) – Show a progress bar
Dict
[str
, ndarray
]
A dictionary with 2d arrays for the magnitude at each PWV and redshift
Get SN magnitudes corresponding to the fiducial atmosphere
{<band>: [<slope start mag> , <reference pwv mag>, <slope end mag>]
model (SNModel
) – The sncosmo model to use in the simulations
z_arr (ndarray
) – Array of redshift values
bands (List
[str
]) – Name of the bands to tabulate magnitudes for
fid_pwv_dict (Optional
[Dict
[str
, Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]]]) – Config dictionary for fiducial atmosphere
Dict
[str
, ndarray
]
A dictionary with fiducial magnitudes in each band
Correct fitted supernova magnitude for stretch and color
calibrated mag = mag + α * x1 - β * c
model (SNModel
) – Model used to fit the given magnitudes
mag (ndarray
) – (n)d array of magnitudes for pwv and redshift
params (ndarray
) – (n+1)d array with dimensions for pwv, redshift, parameter
alpha (Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]) – Alpha parameter value
beta (Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]) – Beta parameter value
ndarray
Array of calibrated magnitudes with same dimensions as mag
Determine apparent mag by fitting simulated light-curves
Returned arrays are shape (len(pwv_arr), len(z_arr)).
model (SNModel
) – The sncosmo model to use when fitting
light_curves (Collection
[Table
]) – Array of light-curves to fit
vparams (List
[str
]) – Parameters to vary with the fit
bands (Collection
[str
]) – Name of the bands to tabulate magnitudes for
pwv_arr (Optional
[Collection
[Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]]]) – Array of PWV values
z_arr (Optional
[Collection
[Union
[float
, float16
, float32
, float64
, float128
, int
, int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
, longlong
, ulonglong
]]]) – Array of redshift values
sncosmo.fit_lc. (Any arguments for) –
Tuple
[Dict
[str
, ndarray
], ...
]
Dictionary with arrays for fitted magnitude at each PWV and redshift Dictionary with arrays for fitted parameters at each PWV and redshift
Determine the change in magnitude relative to the fiducial atmosphere
This is also equivalent to determining the apparent magnitude of a SN normalized to the magnitude at the fiducial atmosphere.
mag (Dict
[str
, ndarray
]) – Dictionary with magnitudes in each band
fiducial_mag (Dict
[str
, ndarray
]) – Dictionary for fiducial atmosphere mag vals
fiducial_pwv (Dict
[str
, ndarray
]) – Dictionary for fiducial atmosphere pwv vals
Tuple
[Dict
[str
, ndarray
], ...
]
A dictionary with the change in magnitude for each band
A dictionary with the slope (mag / pwv) for each band
Calculate the distance modulus of a model
model (SNModel
) – An sncosmo model
cosmo (Cosmology
) – Cosmology to use in the calculation
float
mu = m_B - M_B
Calculate the distance modulus for an array of fitted params
model (SNModel
) – The sncosmo model to use in the simulations
params (ndarray
) – n-dimensional array of parameters
ndarray
An array of distance moduli with one dimension less than params
Calculate the distance modulus for an array of fitted params
returns constants.alpha * x_1 - constants.beta * c
model (SNModel
) – The sncosmo model to use in the simulations
params (ndarray
) – n-dimensional array of parameters
ndarray
An array of calibration factors with one dimension less than params