snsim.salt_utils ================ .. py:module:: snsim.salt_utils .. autoapi-nested-parse:: Contains function related to SALT model. Functions --------- .. autoapisummary:: snsim.salt_utils.x0_to_mb snsim.salt_utils.n21_x1_model snsim.salt_utils.x1_mass_model snsim.salt_utils.n21_x1_mass_model snsim.salt_utils.cov_x0_to_mb snsim.salt_utils.compute_salt_fit_error snsim.salt_utils.salt_fitter Module Contents --------------- .. py:function:: x0_to_mb(x0, source_name, source_version) .. py:function:: n21_x1_model(z, seed=None) X1 distribution redshift dependant model from Nicolas et al. 2021. :param z: Redshift(s) of the SN. :type z: numpy.array(float) :param seed: Random seed. :type seed: int, opt :returns: **X1** -- Stretch parameters of supernovae. :rtype: numpy.array(float) .. py:function:: x1_mass_model(host_mass, seed=None) .. py:function:: n21_x1_mass_model(z, host_mass=None, seed=None) .. py:function:: cov_x0_to_mb(x0, cov) Convert x0,x1,c covariance into mB,x1,c covariance. :param x0: SALT x0 parameter. :type x0: float :param cov: SALT x0, x1, c covariance matrix :type cov: numpy.array(float, size = (3,3)) :returns: SALT mb, x1, c covariance matrix. :rtype: numpy.array(float, size = (3,3)) .. py:function:: compute_salt_fit_error(fit_model, cov, band, time_th, zp, magsys='ab') Compute fit error on flux from sncosmo fit covariance x0,x1,c. :param fit_model: The model used to fit the sn lightcurve. :type fit_model: sncosmo.Model :param cov: sncosmo x0,x1,c covariance matrix from SALT fit. :type cov: numpy.ndarray(float, size=(3,3)) :param band: The band in which the error is computed. :type band: str :param time_th: Time for which compute the flux error. :type time_th: numpy.ndarray(float) :param zp: zeropoint to scale the error. :type zp: float :param magsys: Magnitude system to use. :type magsys: str :returns: Flux error for each input time. :rtype: numpy.ndarray(float) .. rubric:: Notes Compute theorical fluxerr from fit :math:`err = \sqrt{COV}` where :math:`COV = J^T COV(x0,x1,c) J` with :math:`J = (dF/dx0, dF/dx1, dF/dc)` the jacobian. .. math:: F_{norm} = \frac{x_0}{1+z} \int_\lambda \left(M_0(\lambda_s, p) + x_1 M_1(\lambda_s, p)\right)\ 10^{-0.4cCL(\lambda_s)}T_b(\lambda) \frac{\lambda}{hc} d\lambda \times \text{NF} where the Norm Factor is :math:`\text{NF} = 10^{0.4(ZP_{norm} -ZP_{magsys})}`. We found : .. math:: \frac{dF}{dx_0} = \frac{F}{x_0} .. math:: \frac{dF}{dx_1} = \frac{x_0}{1+z} \int_\lambda M_1(\lambda_s, p) * 10^{-0.4cCL(\lambda_s)}\ T_b(\lambda)\frac{\lambda}{hc} d\lambda \times \text{NF} .. math:: \frac{dF}{dc} = -\frac{\ln(10)}{2.5}\frac{x_0}{1+z} \int_\lambda \left(M_0(\lambda_s, p) + x_1 M_1(\lambda_s, p)\right)\ CL(\lambda_s)10^{-0.4 c CL(\lambda_s)}T_b(\lambda) \frac{\lambda}{hc} d\lambda \times \text{NF} .. py:function:: salt_fitter(lc, fit_model, fit_par, **kwargs) Fit a given lightcurve with sncosmo salt model. :param lc: The SN lightcurve. :type lc: astropy.Table :param fit_model: Model used to fit the ligthcurve. :type fit_model: sncosmo.Model :param fit_par: The parameters to fit. :type fit_par: list(str) :returns: sncosmo dict of fit results. :rtype: sncosmo.utils.Result (numpy.nan if no result)