    Uses interpolation from Tanaka+19 to calculate
    the opacity based on the electron fraction
    :param ye: electron fraction
    :return: electron_fraction


    Calculates the Lorentz factor for a given velocity
    :param velocity: velocity in cm/s
    :return: Lorentz factor


    Calculates the velocity for a given Lorentz factor
    :param Lorentz_factor: relativistic Lorentz factor
    :return: velocity in cm/s


        Return the user-specified luminosity distance, ignoring the redshift.

        Parameters
        ----------
        redshift : float or array-like
            Redshift (ignored).

        Returns
        -------
        astropy.units.Quantity
            The user-specified luminosity distance.


adding rphotmin on to rphot for soft min
        also creating soft max -- inverse( 1/rphot + 1/rphotmax)


    Synthetic photometry of a model through a single bandpass

    :param model: Source object
    :param band: Bandpass
    :param time_or_phase: Time or phase numpy array
    :return: bandflux through the bandpass


    Support function for bandflux in Source and Model. Follows SNCOSMO

    This is necessary to have outside because ``phase`` is used in Source
    and ``time`` is used in Model, and we want the method signatures to
    have the right variable name.


    Support function for bandflux in Source and Model.
    This is necessary to have outside the models because ``phase`` is used in
    Source and ``time`` is used in Model.


            Flux through the given bandpass(es) at the given phase(s).

            Default return value is flux in photons / s / cm^2. If zp and zpsys
            are given, flux(es) are scaled to the requested zeropoints.

            Parameters
            ----------
            band : str or list_like
                Name(s) of bandpass(es) in registry.
            phase : float or list_like, optional
                Phase(s) in days. Default is `None`, which corresponds to the full
                native phase sampling of the model.
            zp : float or list_like, optional
                If given, zeropoint to scale flux to (must also supply ``zpsys``).
                If not given, flux is not scaled.
            zpsys : str or list_like, optional
                Name of a magnitude system in the registry, specifying the system
                that ``zp`` is in.

            Returns
            -------
            bandflux : float or `~numpy.ndarray`
                Flux in photons / s /cm^2, unless `zp` and `zpsys` are
                given, in which case flux is scaled so that it corresponds
                to the requested zeropoint. Return value is `float` if all
                input parameters are scalars, `~numpy.ndarray` otherwise.


Magnitude at the given phase(s) through the given
            bandpass(es), and for the given magnitude system(s).

            Parameters
            ----------
            band : str or list_like
                Name(s) of bandpass in registry.
            magsys : str or list_like
                Name(s) of `~sncosmo.MagSystem` in registry.
            phase : float or list_like
                Phase(s) in days.

            Returns
            -------
            mag : float or `~numpy.ndarray`
                Magnitude for each item in band, magsys, phase.
                The return value is a float if all parameters are not iterables.
                The return value is an `~numpy.ndarray` if any are iterable.


    A general blackbody_to_flux_density formula

    :param temperature: effective temperature in kelvin
    :param r_photosphere: photosphere radius in cm
    :param dl: luminosity_distance in cm
    :param frequency: frequency to calculate in Hz - Must be same length as time array or a single number.
                      In source frame
    :return: flux_density in erg/s/Hz/cm^2


Calculate power law + blackbody flux density with time-evolving power law


Returns the computed flux density; this property wraps an internal attribute.


        Returns the wavelength corresponding to self.frequency (using nu_to_lambda),
        while preserving broadcasting.


Compute the modified SED with the absorption line and store the result internally.


        :param axes: The axes used in the plotting procedure.
        :type axes: matplotlib.axes.Axes

        :return: Linearly or logarithmically scaled time values depending on the y scale used in the plot.
        :rtype: np.ndarray


        :param axes: The axes used in the plotting procedure.
        :type axes: matplotlib.axes.Axes

        :return: Linearly or logarithmically scaled angtrom values depending on the y scale used in the plot.
        :rtype: np.ndarray


Plots the Integrated flux data and returns Axes.

        :param axes: Matplotlib axes to plot the data into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the Integrated flux data and the lightcurve and returns Axes.

        :param axes: Matplotlib axes to plot the lightcurve into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the residual of the Integrated flux data returns Axes.

        :param axes: Matplotlib axes to plot the lightcurve into. Useful for user specific modifications to the plot.
        :param save: Whether to save the plot. (Default value = True)
        :param show: Whether to show the plot. (Default value = True)

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the Magnitude data and returns Axes.

        :param axes: Matplotlib axes to plot the data into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the Magnitude data and returns Axes.

        :param axes: Matplotlib axes to plot the lightcurve into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the Magnitude multiband data and returns Axes.

        :param figure: Matplotlib figure to plot the data into.
        :type figure: matplotlib.figure.Figure
        :param axes: Matplotlib axes to plot the data into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the Magnitude multiband lightcurve and returns Axes.

        :param figure: Matplotlib figure to plot the data into.
        :param axes: Matplotlib axes to plot the data into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the spectrum data and returns Axes.

        :param axes: Matplotlib axes to plot the data into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


Plots the spectrum data and the fit and returns Axes.

        :param axes: Matplotlib axes to plot the lightcurve into. Useful for user specific modifications to the plot.
        :type axes: Union[matplotlib.axes.Axes, None], optional
        :param save: Whether to save the plot. (Default value = True)
        :type save: bool
        :param show: Whether to show the plot. (Default value = True)
        :type show: bool

        :return: The axes with the plot.
        :rtype: matplotlib.axes.Axes


        Calculate ejecta velocity assuming no orbital plane or orthogonal projection

        :return: ejecta velocity in c


        Calculate ejecta mass assuming one single component

        :return: ejecta mass in solar masses


        Polar opening angle

        :return: polar opening angle


        azimuthal opening angle

        :return: azimuthal opening angle


        Calculate ejecta velocity of the dynamical ejecta

        :return: ejecta velocity in c


        Calculate the disk wind and dynamical ejecta masses

        :return: ejecta mass in solar masses


        Calculate the normalized ISCO radius for a given BH spin.

        :return: Normalized radius of the Innermost Stable Circular Orbit


        Calculate ejecta velocity

        :return: ejecta velocity in c


        Calculate ejecta mass

        :return: ejecta mass in solar masses


        Calculate innermost stable orbit radius

        :return: isco radius


    :param lambda_1: dimensionless tidal deformability
    :return: compactness


    :param mass: in solar masses
    :param radius: in meters
    :return: compactness


    :param mass_g: gravitational mass in solar mass
    :param radius_14: radius of 1.4 M_sun neutron star in meters
    :return: baryonic mass


    :param mass: mass in solar masses
    :param compactness: NS compactness
    :return: baryonic mass


    Average velocity in the orbital plane

    :param mass_1: mass of primary neutron star
    :param mass_2: mass of secondary neutron star
    :param lambda_1: tidal deformability of primary neutron star
    :param lambda_2: tidal deformability of secondary neutron star
    :return: average velocity in the orbital plane


    Velocity orthogonal to the orbital plane (z direction)

    :param mass_1: mass of primary neutron star
    :param mass_2: mass of secondary neutron star
    :param lambda_1: tidal deformability of primary neutron star
    :param lambda_2: tidal deformability of secondary neutron star
    :return: average velocity orthogonal to the orbital plane


    :param transient: The transient to be fitted
    :param model: Name of the model to fit to data or a function.
    :param outdir: Output directory. Will default to a sensible structure if not given.
    :param label: Result file labels. Will use the model name if not given.
    :param sampler: The sampling backend. Nested samplers are encouraged to allow evidence calculation.
                    (Default value = 'dynesty')
    :param nlive: Number of live points.
    :param prior: Priors to use during sampling. If not given, we use the default priors for the given model.
    :param walks: Number of `dynesty` random walks.
    :param truncate: Flag to confirm whether to truncate the prompt emission data
    :param use_photon_index_prior: flag to turn off/on photon index prior and fits according to the curvature effect
    :param truncate_method: method of truncation
    :param resume: Whether to resume the run from a checkpoint if available.
    :param save_format: The format to save the result in. (Default value = 'json'_
    :param model_kwargs: Additional keyword arguments for the model.
    :param clean: If True, rerun the fitting, if false try to use previous results in the output directory.
    :param plot: If True, create corner and lightcurve plot
    :param kwargs: Additional parameters that will be passed to the sampler
    :return: Redback result object, transient specific data object


    Place constraints on the magnetar rotational energy being larger than the total output energy,
    and the that nebula phase does not begin till at least a 100 days.

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint so that magnetar rotational energy is larger than ejecta kinetic energy

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint so that magnetar rotational energy is smaller than some number

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint so that the pericenter radius is larger than the schwarzchild radius of the black hole.

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint on beta, eta and peak time for gaussian rise TDE model
    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint so that nuclear burning energy is greater than kinetic energy.

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint on the fall back energy being larger than the kinetic energy,
    and the that nebula phase does not begin till at least a 100 days.

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint so that photospheric radius is within the csm and the
    diffusion time is less than the shock crossing time.

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


    Constraint on piecewise-polytrope EOS to enforce causality and max mass

    :param parameters: dictionary of parameters
    :return: converted_parameters dictionary where the violated samples are thrown out


        Save the transient observations to a csv file.
        This will save the full observational dataframe including non-detections etc.
        This will save the data to a folder called 'simulated'
        with the name of the transient and a csv file of the injection parameters

        :param name: name to save transient.


        Constructor method to build simulated transient object for a single transient.

        :param model: String corresponding to redback model or a python function that can evaluate an SED.
        :param parameters: Dictionary of parameters describing a single transient or a transient population.
            This can either include RA and DEC or it is randomly drawn from the pointing database.
            Must include t0_mjd_transient or t0.
        :param pointings_database: A pandas DataFrame containing the pointings of the survey.
        :param survey: String corresponding to the survey name. This is used to look up the pointings database.
            Set to LSST 10 year baseline 3.0 by default.
        :param sncosmo_kwargs: Any kwargs to be passed to SNcosmo.
            SNcosmo is used to evaluate the bandpass magnitudes in different bands.
        :param obs_buffer: A observation buffer in days to add to the start of the transient
            to allow for non-detections. Default is 5 days
        :param survey_fov_sqdeg: Survey field of view. Default is 9.6 sqdeg for Rubin.
        :param snr_threshold: SNR threshold for detection. Default is 5.
        :param end_transient_time: End time of the transient in days. Default is 1000 days.
            Note that SNCosmo will extrapolate past when the transient model evaluates the SED so these should really be the same.
        :param add_source_noise: Boolean. If True, add an extra noise in quadrature to the limiting mag noise.
            The factor is a multiple of the model flux i.e. noise = (skynoise**2 + (model_flux*source_noise)**2)**0.5
        :param population: Boolean. If True, the parameters are assumed to be for a population of transients.
        :param model_kwargs: Dictionary of kwargs to be passed to the model.
        :param kwargs: Dictionary of additional kwargs
        :param source_noise: Float. Factor to multiply the model flux by to add an extra noise
            in quadrature to the limiting mag noise. Default value is 0.02, disabled by default.


        Constructor method to build simulated transient object for a single transient with Rubin.

        :param model: String corresponding to redback model or a python function that can evaluate an SED.
        :param parameters: Dictionary of parameters describing a single transient or a transient population.
            This can either include RA and DEC or it is randomly drawn from the pointing database.
            Must include t0_mjd_transient or t0.
        :param pointings_database: A pandas DataFrame containing the pointings of the survey.
        :param survey: String corresponding to the survey name. This is used to look up the pointings database.
            Set to LSST 10 year baseline 3.0 by default.
        :param sncosmo_kwargs: Any kwargs to be passed to SNcosmo.
            SNcosmo is used to evaluate the bandpass magnitudes in different bands.
        :param obs_buffer: A observation buffer in days to add to the start of the transient
            to allow for non-detections. Default is 5 days
        :param snr_threshold: SNR threshold for detection. Default is 5.
        :param end_transient_time: End time of the transient in days. Default is 1000 days.
            Note that SNCosmo will extrapolate past when the transient model evaluates the SED so these should really be the same.
        :param add_source_noise: Boolean. If True, add an extra noise in quadrature to the limiting mag noise.
            The factor is a multiple of the model flux i.e. noise = (skynoise**2 + (model_flux*source_noise)**2)**0.5
        :param model_kwargs: Dictionary of kwargs to be passed to the model.
        :param kwargs: Dictionary of additional kwargs
        :param source_noise: Float. Factor to multiply the model flux by to add an extra noise
            in quadrature to the limiting mag noise. Default value is 0.02, disabled by default.


        Constructor method to build simulated transient object for a single transient with ZTF.

        :param model: String corresponding to redback model or a python function that can evaluate an SED.
        :param parameters: Dictionary of parameters describing a single transient or a transient population.
            This can either include RA and DEC or it is randomly drawn from the pointing database.
            Must include t0_mjd_transient or t0.
        :param pointings_database: A pandas DataFrame containing the pointings of the survey.
        :param survey: String corresponding to the survey name. This is used to look up the pointings database.
        :param sncosmo_kwargs: Any kwargs to be passed to SNcosmo.
            SNcosmo is used to evaluate the bandpass magnitudes in different bands.
        :param obs_buffer: A observation buffer in days to add to the start of the transient
            to allow for non-detections. Default is 5 days
        :param snr_threshold: SNR threshold for detection. Default is 5.
        :param end_transient_time: End time of the transient in days. Default is 1000 days.
            Note that SNCosmo will extrapolate past when the transient model evaluates the SED so these should really be the same.
        :param add_source_noise: Boolean. If True, add an extra noise in quadrature to the limiting mag noise.
            The factor is a multiple of the model flux i.e. noise = (skynoise**2 + (model_flux*source_noise)**2)**0.5
        :param model_kwargs: Dictionary of kwargs to be passed to the model.
        :param kwargs: Dictionary of additional kwargs
        :param source_noise: Float. Factor to multiply the model flux by to add an extra noise
            in quadrature to the limiting mag noise. Default value is 0.02, disabled by default.


        Constructor method to build simulated transient object for a single transient.

        :param model: String corresponding to redback model or a python function that can evaluate an SED.
        :param parameters: Dictionary of parameters describing a single transient or a transient population.
            This can either include RA and DEC or it is randomly drawn from the pointing database.
            Must include t0_mjd_transient or t0.
        :param pointings_database: A pandas DataFrame containing the pointings of the survey.
        :param survey: String corresponding to the survey name. This is used to look up the pointings database.
            Set to LSST 10 year baseline 3.0 by default.
        :param sncosmo_kwargs: Any kwargs to be passed to SNcosmo.
            SNcosmo is used to evaluate the bandpass magnitudes in different bands.
        :param obs_buffer: A observation buffer in days to add to the start of the transient
            to allow for non-detections. Default is 5 days
        :param survey_fov_sqdeg: Survey field of view. Default is 9.6 sqdeg for Rubin.
        :param snr_threshold: SNR threshold for detection. Default is 5.
        :param end_transient_time: End time of the transient in days. Default is 1000 days.
            Note that SNCosmo will extrapolate past when the transient model evaluates the SED so these should really be the same.
        :param add_source_noise: Boolean. If True, add an extra noise in quadrature to the limiting mag noise.
            The factor is a multiple of the model flux i.e. noise = (skynoise**2 + (model_flux*source_noise)**2)**0.5
        :param model_kwargs: Dictionary of kwargs to be passed to the model.
        :param kwargs: Dictionary of additional kwargs
        :param source_noise: Float. Factor to multiply the model flux by to add an extra noise
            in quadrature to the limiting mag noise. Default value is 0.02, disabled by default.


        Constructor method to build simulated transient object for a single transient.

        :param model: String corresponding to redback model or a python function that can evaluate an SED.
        :param parameters: Dictionary of parameters describing a single transient or a transient population.
            This can either include RA and DEC or it is randomly drawn from the pointing database.
            Must include t0_mjd_transient or t0.
        :param pointings_database: A pandas DataFrame containing the pointings of the survey.
        :param survey: String corresponding to the survey name. This is used to look up the pointings database.
            Set to LSST 10 year baseline 3.0 by default.
        :param sncosmo_kwargs: Any kwargs to be passed to SNcosmo.
            SNcosmo is used to evaluate the bandpass magnitudes in different bands.
        :param obs_buffer: A observation buffer in days to add to the start of the transient
            to allow for non-detections. Default is 5 days
        :param snr_threshold: SNR threshold for detection. Default is 5.
        :param end_transient_time: End time of the transient in days. Default is 1000 days.
        :param add_source_noise: Boolean. If True, add an extra noise in quadrature to the limiting mag noise.
            The factor is a multiple of the model flux i.e. noise = (skynoise**2 + (model_flux*source_noise)**2)**0.5
        :param model_kwargs: Dictionary of kwargs to be passed to the model.
        :param kwargs: Dictionary of additional kwargs
        :param source_noise: Float. Factor to multiply the model flux by to add an extra noise
            in quadrature to the limiting mag noise. Default value is 0.02, disabled by default.


        Constructor method to build simulated transient object for a single transient.

        :param model: String corresponding to redback model or a python function that can evaluate an SED.
        :param parameters: Dictionary of parameters describing a single transient or a transient population.
            This can either include RA and DEC or it is randomly drawn from the pointing database.
            Must include t0_mjd_transient or t0.
        :param pointings_database: A pandas DataFrame containing the pointings of the survey.
        :param survey: String corresponding to the survey name. This is used to look up the pointings database.
        :param sncosmo_kwargs: Any kwargs to be passed to SNcosmo.
            SNcosmo is used to evaluate the bandpass magnitudes in different bands.
        :param obs_buffer: A observation buffer in days to add to the start of the transient
            to allow for non-detections. Default is 5 days
        :param snr_threshold: SNR threshold for detection. Default is 5.
        :param end_transient_time: End time of the transient in days. Default is 1000 days.
            Note that SNCosmo will extrapolate past when the transient model evaluates the SED so these should really be the same.
        :param add_source_noise: Boolean. If True, add an extra noise in quadrature to the limiting mag noise.
            The factor is a multiple of the model flux i.e. noise = (skynoise**2 + (model_flux*source_noise)**2)**0.5
        :param model_kwargs: Dictionary of kwargs to be passed to the model.
        :param kwargs: Dictionary of additional kwargs
        :param source_noise: Float. Factor to multiply the model flux by to add an extra noise
            in quadrature to the limiting mag noise. Default value is 0.02, disabled by default.


        Make a dataframe that can be used for inference.
        This removes all the non-detections from the observations dataframe.

        :return:


        Convert the circular field of view to a radius in radians.
        :return: survey_radius in radians


:return: The start time of the transient in MJD


:return: The RA of the transient in radians. Draw randomly from the pointings database if not supplied.


:return: The DEC of the transient in radians. Draw randomly from the pointings database if not supplied.


:return: Minimum dec of the survey in radians


:return: Maximum dec of the survey in radians


:return: Start of the survey in MJD


:return: End of the survey in MJD


:return: Get the unique reference fluxes for each filter in the survey


        Function to wrap user models into sncosmo model format for full functionality.
        :return: sncosmo source


        A lookup table to get the name of the pointings database for a given survey.
        :param survey: name of the survey
        :return: path to the pointings database


        Find the time indices of the pointings database that overlap with the transient.

        :return: indices of the pointings database that overlap with the transient.


Find the sky indices of the pointings database that overlap with the transient.


        Calculate properties of the transient at the overlapping pointings for a single transient.

        :param overlapping_database:
        :return: Dataframe of observations including non-detections/upper limits


        Calculate properties of the transient at the overlapping pointings for a single transient.
        :return: Dataframe of observations including non-detections/upper limits


        Calculate properties of the transient at the overlapping pointings for a transient population.
        :return: Dataframe of observations including non-detections/upper limits


        Save the transient population to a csv file.
        This will save the full observational dataframe including non-detections etc.
        This will save the data to a folder called 'simulated'
        with the name of the transient and a csv file of the injection parameters

        :param transient_names: list of transient names. Default is None which will label transients as event_0, etc
        :param kwargs: kwargs for the save_transient function
        :param injection_file_path: path to save the injection file
        :return: None


    Makes a pandas dataframe of pointings from specified settings.

    :param float: ra
    :param float: dec
    :param dict: num_obs
    :param dict: average_cadence
    :param dict: cadence_scatter
    :param dict: limiting_magnitudes

    :return dataframe: pandas dataframe of the mock pointings needed to simulate observations for
    given transient.


Reconstruct the transient used during sampling time using the metadata information.

        :return: The reconstructed Transient.
        :rtype: redback.transient.transient.Transient


 Reconstructs the transient and calls the specific `plot_lightcurve` method.
        Detailed documentation appears below by running `print(plot_lightcurve.__doc__)`


 Reconstructs the transient and calls the specific `plot_spectrum` method.
        Detailed documentation appears below by running `print(plot_spectrum.__doc__)`


Reconstructs the transient and calls the specific `plot_residual` method.
        Detailed documentation appears below by running `print(plot_residual.__doc__)`


Reconstructs the transient and calls the specific `plot_multiband_lightcurve` method.
        Detailed documentation appears below by running `print(plot_multiband_lightcurve.__doc__)`


    :param filename: Filename with entire path of result to open.
    :type filename: str, optional
    :param outdir: If filename is not given, directory of the result.
    :type outdir: str, optional
    :param label: If filename is not given, label of the result.
    :type label: str, optional
    :type extension: str, optional
    :param extension: If filename is not given, filename extension.
                      Must be in ('json', 'hdf5', 'h5', 'pkl', 'pickle', 'gz').
                      (Default value = 'json')
    :param gzip: If the file is compressed with gzip. Default is False.
    :type gzip: bool, optional

    :return: The loaded redback result.
    :rtype: RedbackResult


        :return: Length of the x/y-values
        :rtype: int


        Estimate the maximum likelihood

        :param iterations: Iterations to run the minimizer for before stopping. Default is 5.
        :param maximization_kwargs: Any extra keyword arguments passed to the scipy minimize function
        :param method: Minimize method to use. Default is 'Nelder-Mead'
        :param break_threshold: The threshold for the difference in log likelihood to break the loop. Default is 1e-3.
        :return: Dictionary of maximum likelihood parameters


        :return: The model output for the given x values.
        :rtype: np.ndarray


        :return: The noise log-likelihood, i.e. the log-likelihood assuming the signal is just noise.
        :rtype: float


        :return: The log-likelihood.
        :rtype: float


        Fast computation of normal CDF using erf.
        CDF(x) = 0.5 * (1 + erf(x / sqrt(2)))

        :param x: Standardized values (z-scores)
        :return: CDF values


        Calculate log-likelihood contribution from upper limits only.

        :param observed: Upper limit values
        :param model: Model predictions at upper limit points
        :return: Log-likelihood contribution from upper limits


        Override parent method to include upper limits in noise likelihood.

        :return: The noise log-likelihood, i.e. the log-likelihood assuming the signal is just noise.
        :rtype: float


        Override parent method to include upper limits.

        :return: The log-likelihood including upper limits.
        :rtype: float


        Provide a summary of the likelihood setup.

        :return: Dictionary with summary information


        Compute the log-likelihood of the residuals under a mixture of two Gaussians in a stable
        manner using the log-sum-exp trick.

        Parameters
        ----------
        res : np.ndarray
            Array of residuals.
        sigma : float or np.ndarray
            Standard deviation for the inlier Gaussian.
        sigma_out : float or np.ndarray
            Standard deviation for the outlier Gaussian.
        alpha : float
            Inlier fraction (between 0 and 1).

        Returns
        -------
        np.ndarray
            Log-likelihood for each residual under the mixture model.


        Compute the inlier probability density for residuals.

        Parameters
        ----------
        r : np.ndarray
            Residuals.

        Returns
        -------
        np.ndarray
            Inlier probability density evaluated at each residual.


        Compute the outlier probability density for residuals.

        Parameters
        ----------
        r : np.ndarray
            Residuals.

        Returns
        -------
        np.ndarray
            Outlier probability density evaluated at each residual.


Compute the log-likelihood assuming the signal is pure noise (i.e. the residuals are just y).


        Compute the total log-likelihood for the Student-t likelihood model.

        :return: The log-likelihood.
        :rtype: float


        :return: The log-likelihood due to x-errors.
        :rtype: float


        :return: The log-likelihood due to y-errors.
        :rtype: float


        :return: The standard deviation of the full noise
        :rtype: Union[float, np.ndarray]


        :return: The upper limit of the flux.
        :rtype: float


        :return: The log-likelihood due to the upper limit.
        :rtype: float


    Add a filter to the Redback filter database.

    :param label:       name of the filter in the Redback filter database
    :param wavelength:  central wavelength of the filter as defined on SVO in m
    :param zeroflux:   zero flux of the filter in erg/cm^2/s/Hz
    :param database:    filter database
    :param plot_label:  plot label. If none is provided, it will use LABEL (default: None).
    :param effective_width: effective width of the filter in Angstrom
    :return: None


    Add a filter to the Redback filter database.

    :param label:       name of the filter in the Redback filter database
    :param WAVELENGTH:  central wavelength of the filter as defined on SVO
    :return: None


    Wrapper to add a filter from SVO to SNCosmo and the Redback filter database

    :param filter: record from the SVO query
    :param label:  name of the filter in SNCosmo
    :param plot_label: plot label. If none is provided, it will use LABEL (default: None).
    :param overwrite:  overwrite any existing entry? (default: False)
    :return: None


    Wrapper to add a user filter from SVO to SNCosmo and the Redback filter database
    :param file:       file name that contains the transmission function
                       (Must have two columns, wavelength must be in AA)
    :param label:      name of the filter
    :param DATABASE:   location of the Redback filter database
    :param plot_label: plot label. If none is provided, it will use LABEL (default: None).
    :param overwrite:  overwrite any existing entry? (default: False)
    :return: None


    Adds Euclid, NTT/EFOSC2, MPG/GROND, Spitzer and WISE filters from SVO

    :return: None


    Adds effective widths to the Redback filter database

    :return: None


    A wrapper to SNCosmo models

    :param time: observer frame time in days
    :param redshift: redshift
    :param model_kwargs: all model keyword arguments in a dictionary
    :param kwargs: Additional keyword arguments for redback
    :param frequency: Frequency in Hz to evaluate model on, must be same shape as time array or a single value.
    :param sncosmo_model: String of the SNcosmo model to use.
    :param peak_time: SNe peak time in days
    :param cosmology: astropy cosmology object by default set to Planck18
    :param mw_extinction: Boolean for whether there is MW extinction or not. Default True
    :param host_extinction: Boolean for whether there is host extinction or not. Default True
            if used adds an extra parameter ebv which must also be in kwargs; host galaxy E(B-V). Set to 0.1 by default
    :param use_set_peak_magnitude: Boolean for whether to set the peak magnitude or not. Default False,
        if True the following keyword arguments also apply. Else the brightness is set by the model_kwargs.
    :param peak_abs_mag: SNe peak absolute magnitude default set to -19
    :param peak_abs_mag_band: Band corresponding to the peak abs mag limit, default to standard::b. Must be in SNCosmo
    :param magnitude_system: Mag system; default ab
    :return: set by output format - 'flux_density', 'magnitude', 'flux', 'sncosmo_source'


    A wrapper to the salt2 model in sncosmo

    :param time: time in days in observer frame (in mjd days)
    :param redshift: redshift
    :param x0: x0
    :param x1: x1
    :param c: c
    :param peak_time: peak time in mjd
    :param kwargs: Additional keyword arguments
    :param cosmology: astropy cosmology object by default set to Planck18
    :param mw_extinction: Boolean for whether there is MW extinction or not. Default True
    :param host_extinction: Boolean for whether there is host extinction or not. Default True
            if used adds an extra parameter ebv which must also be in kwargs; host galaxy E(B-V). Set to 0.1 by default
    :param use_set_peak_magnitude: Boolean for whether to set the peak magnitude or not. Default False,
        if True the following keyword arguments also apply. Else the brightness is set by the model_kwargs.
    :param peak_abs_mag: SNe peak absolute magnitude default set to -19
    :param peak_abs_mag_band: Band corresponding to the peak abs mag limit, default to standard::b. Must be in SNCosmo
    :param magnitude_system: Mag system; default ab
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :return: set by output format - 'flux_density', 'magnitude', 'flux', 'sncosmo_source'


    :param time: rest frame time in days
    :param lbol_0: bolometric luminosity scale in cgs
    :param alpha_1: first exponent
    :param alpha_2: second exponent
    :param tpeak_d: peak time in days
    :param kwargs: Must be all the kwargs required by the specific interaction_process
            e.g., for Diffusion: kappa, kappa_gamma, vej (km/s), temperature_floor
    :param interaction_process: Default is Diffusion.
        Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :return: bolometric_luminosity


    :param time: observer frame time in days
    :param redshift: source redshift
    :param lbol_0: bolometric luminosity scale in cgs
    :param alpha_1: first exponent
    :param alpha_2: second exponent
    :param tpeak_d: peak time in days
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
        e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, mej (solar masses), vej (km/s), floor temperature
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in days
    :param f_nickel: fraction of nickel mass
    :param mej: total ejecta mass in solar masses
    :param kwargs: None
    :return: bolometric_luminosity


    :param time: time in days
    :param f_nickel: fraction of nickel mass
    :param mej: total ejecta mass in solar masses
    :param kwargs: Must be all the kwargs required by the specific interaction_process
    :param interaction_process: Default is Diffusion.
        Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
        e.g., for Diffusion: kappa, kappa_gamma, vej (km/s), temperature_floor
    :return: bolometric_luminosity


    :param time: time in days
    :param redshift: source redshift
    :param f_nickel: fraction of nickel mass
    :param mej: total ejecta mass in solar masses
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
         e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Bolometric luminosity of shock cooling and arnett model

    :param time: time in days in source frame
    :param log10_mass: log10 mass of extended material in solar masses
    :param log10_radius: log10 radius of extended material in cm
    :param log10_energy: log10 energy of extended material in ergs
    :param f_nickel: fraction of nickel mass
    :param mej: total ejecta mass in solar masses
    :param vej: velocity of ejecta in km/s
    :param kappa: opacity in cm^2/g
    :param kappa_gamma: gamma-ray opacity in cm^2/g
    :param temperature_floor: temperature floor in K
    :param kwargs: Additional keyword arguments
    :param nn: density power law slope
    :param delta: inner density power law slope
    :return: bolometric luminosity in erg/s


    Photometric light curve of shock cooling and arnett model

    :param time: time in days
    :param redshift: source redshift
    :param log10_mass: log10 mass of extended material in solar masses
    :param log10_radius: log10 radius of extended material in cm
    :param log10_energy: log10 energy of extended material in ergs
    :param f_nickel: fraction of nickel mass
    :param mej: total ejecta mass in solar masses
    :param vej: velocity of ejecta in km/s
    :param kappa: opacity in cm^2/g
    :param kappa_gamma: gamma-ray opacity in cm^2/g
    :param temperature_floor: temperature floor in K
    :param kwargs: Additional keyword arguments
    :param nn: density power law slope
    :param delta: inner density power law slope
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes Shock cooling following Morag+ and arnett model for radioactive decay

    :param time: time in source frame in days
    :param v_shock: shock speed in km/s, also the ejecta velocity in the arnett calculation
    :param m_env: envelope mass in solar masses
    :param mej: ejecta mass in solar masses
    :param f_rho: f_rho. Typically, of order unity
    :param f_nickel: fraction of nickel mass
    :param radius: star/envelope radius in units of 10^13 cm
    :param kappa: opacity in cm^2/g
    :param kwargs: Additional parameters required by model
    :return: bolometric luminosity in erg/s


    Assumes Shock cooling following Morag+ and arnett model for radioactive decay

    :param time: time in observer frame in days
    :param redshift: source redshift
    :param v_shock: shock speed in km/s, also the ejecta velocity in the arnett calculation
    :param m_env: envelope mass in solar masses
    :param mej: ejecta mass in solar masses
    :param f_rho: f_rho. Typically, of order unity
    :param f_nickel: fraction of nickel mass
    :param radius: star/envelope radius in units of 10^13 cm
    :param kappa: opacity in cm^2/g
    :param kwargs: Additional parameters required by model
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes Shock cooling following Sapir and Waxman and arnett model for radioactive decay

    :param time: time in source frame in days
    :param v_shock: shock speed in km/s, also the ejecta velocity in the arnett calculation
    :param m_env: envelope mass in solar masses
    :param mej: ejecta mass in solar masses
    :param f_rho: f_rho. Typically, of order unity
    :param f_nickel: fraction of nickel mass
    :param radius: star/envelope radius in units of 10^13 cm
    :param kappa: opacity in cm^2/g
    :param kwargs: Additional parameters required by model
    :param n: index of progenitor density profile, 1.5 (default) or 3.0
    :param RW: If True, use the simplified Rabinak & Waxman formulation (off by default)
    :return: bolometric luminosity in erg/s


    Assumes Shock cooling following Sapir and Waxman and arnett model for radioactive decay

    :param time: time in source frame in days
    :param v_shock: shock speed in km/s, also the ejecta velocity in the arnett calculation
    :param m_env: envelope mass in solar masses
    :param mej: ejecta mass in solar masses
    :param f_rho: f_rho. Typically, of order unity
    :param f_nickel: fraction of nickel mass
    :param radius: star/envelope radius in units of 10^13 cm
    :param kappa: opacity in cm^2/g
    :param kwargs: Additional parameters required by model
    :param n: index of progenitor density profile, 1.5 (default) or 3.0
    :param RW: If True, use the simplified Rabinak & Waxman formulation (off by default)
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in days in source frame
    :param p0: initial spin period
    :param bp: polar magnetic field strength in Gauss
    :param mass_ns: mass of neutron star in solar masses
    :param theta_pb: angle between spin and magnetic field axes
    :param kwargs: Must be all the kwargs required by the specific interaction_process
             e.g., for Diffusion: kappa, kappa_gamma, vej (km/s), temperature_floor
    :param interaction_process: Default is Diffusion.
        Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :return: bolometric_luminosity


    :param time: time in days in observer frame
    :param redshift: source redshift
    :param p0: initial spin period
    :param bp: polar magnetic field strength in Gauss
    :param mass_ns: mass of neutron star in solar masses
    :param theta_pb: angle between spin and magnetic field axes
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
         e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number.
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Same as basic magnetar_powered but with constraint on rotational_energy/kinetic_energy and nebula phase

    :param time: time in days in source frame
    :param p0: initial spin period
    :param bp: polar magnetic field strength in Gauss
    :param mass_ns: mass of neutron star in solar masses
    :param theta_pb: angle between spin and magnetic field axes
    :param kwargs: Must be all the kwargs required by the specific interaction_process
             e.g., for Diffusion: kappa, kappa_gamma, vej (km/s), temperature_floor
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :return: bolometric_luminosity


    Same as basic magnetar_powered but with constraint on rotational_energy/kinetic_energy and nebula phase

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param p0: initial spin period
    :param bp: polar magnetic field strength in Gauss
    :param mass_ns: mass of neutron star in solar masses
    :param theta_pb: angle between spin and magnetic field axes
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
             e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
             and CutoffBlackbody: cutoff_wavelength, default is 3000 Angstrom
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is CutoffBlackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in days in observer frame
    :param f_nickel: fraction of nickel mass
    :param mej: total ejecta mass in solar masses
    :param redshift: source redshift
    :param p0: initial spin period
    :param bp: polar magnetic field strength in Gauss
    :param mass_ns: mass of neutron star in solar masses
    :param theta_pb: angle between spin and magnetic field axes
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
             e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes homologous expansion to transform kinetic energy to ejecta velocity

    :param time: time in days in source frame
    :param mej: ejecta mass in solar masses
    :param ek: kinetic energy in ergs
    :param kwargs: Must be all the kwargs required by the specific interaction_process
        e.g., for Diffusion: kappa, kappa_gamma, vej (km/s), temperature_floor
        'base model' from homologous_expansion_models list
    :param interaction_process: Default is Diffusion.
        Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :return: bolometric_luminosity


    Assumes thin shell ejecta to transform kinetic energy into ejecta velocity

    :param time: time in days in source frame
    :param mej: ejecta mass in solar masses
    :param ek: kinetic energy in ergs
    :param kwargs: Must be all the kwargs required by the specific interaction_process
             e.g., for Diffusion: kappa, kappa_gamma, vej (km/s), temperature_floor,
             'base model' from homologous_expansion_models list
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :return: bolometric_luminosity


    Assumes homologous expansion to transform kinetic energy to ejecta velocity

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param mej: ejecta mass in solar masses
    :param ek: kinetic energy in ergs
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
        e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
        'base model' from homologous_expansion_models list
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes thin shell ejecta to transform kinetic energy into ejecta velocity

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param mej: ejecta mass in solar masses
    :param ek: kinetic energy in ergs
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
             e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
             'base model' from homologous_expansion_models list
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in days in source frame
    :param mej: ejecta mass in solar masses
    :param csm_mass: csm mass in solar masses
    :param vej: ejecta velocity in km/s
    :param eta: csm density profile exponent
    :param rho: csm density profile amplitude
    :param kappa: opacity
    :param r0: radius of csm shell in AU
    :param kwargs:
            efficiency: in converting between kinetic energy and luminosity, default 0.5
            delta: default 1,
            nn: default 12,
    :return: named tuple with 'lbol','r_photosphere' 'mass_csm_threshold'


    :param time: time in days in source frame
    :param mej: ejecta mass in solar masses
    :param csm_mass: csm mass in solar masses
    :param vej: ejecta velocity in km/s
    :param eta: csm density profile exponent
    :param rho: csm density profile amplitude
    :param kappa: opacity
    :param r0: radius of csm shell in AU
    :param kwargs:
            efficiency: in converting between kinetic energy and luminosity, default 0.5
            delta: default 1,
            nn: default 12,
            If interaction process is different kwargs must include other keyword arguments that are required.
    :param interaction_process: Default is CSMDiffusion.
        Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :return: bolometric_luminosity


    :param time: time in days in observer frame
    :param redshift: source redshift
    :param mej: ejecta mass in solar masses
    :param csm_mass: csm mass in solar masses
    :param vej: ejecta velocity in km/s
    :param eta: csm density profile exponent
    :param rho: csm density profile amplitude
    :param kappa: opacity
    :param r0: radius of csm shell in AU
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
             e.g., for Diffusion and TemperatureFloor: kappa_gamma, temperature_floor
             'base model' from homologous_expansion_models list
    :param interaction_process: Default is CSMDiffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes csm and nickel engine with homologous expansion

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param mej: ejecta mass in solar masses
    :param csm_mass: csm mass in solar masses
    :param ek: kinetic energy in ergs
    :param eta: csm density profile exponent
    :param rho: csm density profile amplitude
    :param kappa: opacity
    :param r0: radius of csm shell in AU
    :param kwargs: kappa_gamma, temperature_floor, and any kwarg to
                change any other input physics/parameters from default.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    A nickel powered explosion with line absorption and cutoff blackbody SED for SNe 1A.

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param f_nickel: fraction of nickel mass
    :param mej: ejecta mass in solar masses
    :param kwargs: kappa, kappa_gamma, vej (km/s),
        temperature_floor (K), cutoff_wavelength (default is 3000 Angstrom)
    :param line_wavelength: line wavelength in angstrom, default is 7.5e3 Angstrom in observer frame
    :param line_width: line width in angstrom, default is 500
    :param line_time: line time, default is 50
    :param line_duration: line duration, default is 25
    :param line_amplitude: line amplitude, default is 0.3
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number.
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be an astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    A nickel powered explosion with synchrotron and blackbody SED's for SNe 1C.

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param f_nickel: fraction of nickel mass
    :param mej: ejecta mass in solar masses
    :param pp: power law index for synchrotron
    :param kwargs: kappa, kappa_gamma, vej (km/s), temperature_floor (K), nu_max (default is 1e9 Hz)
        source_radius (default is 1e13), f0: synchrotron normalisation (default is 1e-26).
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in days in source frame
    :param l0: magnetar energy normalisation in ergs
    :param tsd: magnetar spin down damping timescale in source frame days
    :param nn: braking index
    :param kwargs: Must be all the kwargs required by the specific interaction_process,
             e.g., for Diffusion: kappa, kappa_gamma, vej (km/s)
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :return: bolometric_luminosity


    :param time: time in days in observer frame
    :param redshift: source redshift
    :param l0: magnetar energy normalisation in ergs
    :param tsd: magnetar spin down damping timescale in source frame in days
    :param nn: braking index
    :param kwargs: Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
             e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
    :param interaction_process: Default is Diffusion.
            Can also be None in which case the output is just the raw engine luminosity, or another interaction process.
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is blackbody.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in observer frame in days
    :param mej: ejecta mass in solar units
    :param E_sn: supernova explosion energy
    :param kappa: opacity
    :param l0: initial magnetar X-ray luminosity (Is this not the spin-down luminosity?)
    :param tau_sd: magnetar spin down damping timescale (days? seconds?)
    :param nn: braking index
    :param kappa_gamma: gamma-ray opacity used to calculate magnetar thermalisation efficiency
    :param kwargs: Additional parameters - Must be all the kwargs required by the specific interaction_process  used
             e.g., for Diffusion: kappa, kappa_gamma, vej (km/s)
    :param pair_cascade_switch: whether to account for pair cascade losses, default is True
    :param ejecta albedo: ejecta albedo; default is 0.5
    :param pair_cascade_fraction: fraction of magnetar luminosity lost to pair cascades; default is 0.05
    :param output_format: whether to output flux density or AB magnitude
    :param f_nickel: Ni^56 mass as a fraction of ejecta mass
    :return: bolometric luminsoity or dynamics output


    :param time: time in observer frame in days
    :param redshift: redshift
    :param mej: ejecta mass in solar units
    :param E_sn: supernova explosion energy
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param l0: initial magnetar spin-down luminosity (in erg/s)
    :param tau_sd: magnetar spin down damping timescale (in seconds)
    :param nn: braking index
    :param kappa_gamma: gamma-ray opacity used to calculate magnetar thermalisation efficiency
    :param kwargs: Additional parameters - Must be all the kwargs required by the specific interaction_process, photosphere, sed methods used
             e.g., for Diffusion and TemperatureFloor: kappa, kappa_gamma, vej (km/s), temperature_floor
             and CutoffBlackbody: cutoff_wavelength, default is 3000 Angstrom
    :param pair_cascade_switch: whether to account for pair cascade losses, default is False
    :param ejecta albedo: ejecta albedo; default is 0.5
    :param pair_cascade_fraction: fraction of magnetar luminosity lost to pair cascades; default is 0.05
    :param output_format: whether to output flux density or AB magnitude
    :param frequency: (frequency to calculate - Must be same length as time array or a single number)
    :param f_nickel: Ni^56 mass as a fraction of ejecta mass
    :param photosphere: Default is TemperatureFloor.
            kwargs must have vej or relevant parameters if using different photosphere model
    :param sed: Default is CutoffBlackbody.
    :return: flux density or AB magnitude or dynamics output


    Assumes CSM interaction for a shell-like CSM with a hard outer boundary and arnett model for radioactive decay

    :param time: time in days in source frame
    :param mej: ejecta mass in solar masses
    :param f_nickel: fraction of nickel mass
    :param csm_mass: csm mass in solar masses
    :param v_min: ejecta velocity in km/s
    :param beta: velocity ratio in c (beta < 1)
    :param shell_radius: radius of shell in 10^14 cm
    :param kappa: opacity
    :param shell_width_ratio: shell width ratio (deltaR/R0)
    :param kwargs: kappa_gamma, temperature_floor, and any kwarg to
                change any other input physics/parameters from default.
    :return: bolometric luminosity in erg/s


    Assumes CSM interaction for a shell-like CSM with a hard outer boundary and arnett model for radioactive decay
    Assumes one single photosphere from the sum of the bolometric luminosities

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param mej: ejecta mass in solar masses
    :param f_nickel: fraction of nickel mass
    :param csm_mass: csm mass in solar masses
    :param v_min: ejecta velocity in km/s
    :param beta: velocity ratio in c (beta < 1)
    :param shell_radius: radius of shell in 10^14 cm
    :param kappa: opacity
    :param shell_width_ratio: shell width ratio (deltaR/R0)
    :param kwargs: kappa_gamma, temperature_floor, and any kwarg to
                change any other input physics/parameters from default.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes CSM interaction for a shell-like CSM with a hard outer boundary and arnett model for radioactive decay.
    Assumes the photospheres for the CSM-interaction and the Arnett model are different.

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param mej: ejecta mass in solar masses
    :param f_nickel: fraction of nickel mass
    :param csm_mass: csm mass in solar masses
    :param v_min: ejecta velocity in km/s
    :param beta: velocity ratio in c (beta < 1)
    :param shell_radius: radius of shell in 10^14 cm
    :param kappa: opacity
    :param shell_width_ratio: shell width ratio (deltaR/R0)
    :param kwargs: kappa_gamma, temperature_floor, and any kwarg to
                change any other input physics/parameters from default.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Emission from a shocked cocoon and arnett model for radioactive decay.
    We assume two different photospheres here.

    :param time: Time in days in observer frame
    :param redshift: redshift
    :param mej_c: cocoon mass (in solar masses)
    :param vej_c: cocoon material velocity (in c)
    :param eta: slope for the cocoon density profile
    :param tshock: shock breakout time (in seconds)
    :param shocked_fraction: fraction of the cocoon shocked
    :param cos_theta_cocoon: cosine of the cocoon opening angle
    :param kappa: opacity
    :param mej: supernova ejecta mass (in solar masses)
    :param f_nickel: fraction of nickel for ejecta mass
    :param vej: supernova ejecta velocity (in km/s)
    :param kwargs: Extra parameters used by model e.g., kappa_gamma, temperature_floor, and any kwarg to
                change any other input physics/parameters from default.
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Bolometric luminosity for a Type II supernova based on Sarin et al. 2025 surrogate model
    to stella grid in Moriya et al. 2023

    :param time: Time in days in source frame
    :param progenitor: in solar masses
    :param ni_mass: in solar masses
    :param log10_mdot: in solar masses per year
    :param beta: dimensionless
    :param rcsm: in 10^14 cm
    :param esn: in 10^51
    :param kwargs: None
    :return: bolometric luminosity in erg/s


    Photosphere properties for a Type II supernova based on Sarin et al. 2025 surrogate model
    to stella grid in Moriya et al. 2023

    :param time: Time in days in source frame
    :param progenitor: in solar masses
    :param ni_mass: in solar masses
    :param log10_mdot: in solar masses per year
    :param beta: dimensionless
    :param rcsm: in 10^14 cm
    :param esn: in 10^51
    :param kwargs: None
    :return: photosphere properties (temperature in K, radius in cm)


    Type II supernova model based on Sarin et al. 2025 surrogate model
    to stella grid in Moriya et al. 2023

    :param time: Time in days in observer frame
    :param redshift: redshift
    :param progenitor: in solar masses
    :param ni_mass: in solar masses
    :param log10_mdot: in solar masses per year
    :param beta: dimensionless
    :param rcsm: in 10^14 cm
    :param esn: in 10^51
    :param kwargs: Additional parameters for the model, such as:
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Calculates quantities for the Nicholl et al. 2021 BNS model

    :param mass_1: Mass of primary in solar masses
    :param mass_2: Mass of secondary in solar masses
    :param lambda_s: Symmetric tidal deformability i.e, lambda_s = lambda_1 + lambda_2
    :param kappa_red: opacity of the red ejecta
    :param kappa_blue: opacity of the blue ejecta
    :param mtov: Tolman Oppenheimer-Volkoff mass in solar masses
    :param epsilon: fraction of disk that gets unbound/ejected
    :param alpha: Enhancement of blue ejecta by NS surface winds if mtotal < prompt collapse,
                can turn off by setting alpha=1
    :param cos_theta_open: Lanthanide opening angle
    :param cos_theta: Viewing angle of observer
    :param kwargs: Additional keyword arguments
    :param dynamical_ejecta_error: Error in dynamical ejecta mass, default is 1 i.e., no error in fitting formula
    :param disk_ejecta_error: Error in disk ejecta mass, default is 1 i.e., no error in fitting formula
    :return: Namedtuple with 'mejecta_blue', 'mejecta_red', 'mejecta_purple',
            'vejecta_blue', 'vejecta_red', 'vejecta_purple',
            'vejecta_mean', 'kappa_mean', 'mejecta_dyn',
            'mejecta_total', 'kappa_purple', 'radius_1', 'radius_2',
            'binary_lambda', 'remnant_radius', 'area_blue', 'area_blue_ref',
            'area_red', 'area_red_ref' properties. Masses in solar masses and velocities in units of c


    Kilonova model from Nicholl et al. 2021, inclides three kilonova components
    + shock heating from cocoon + disk winds from remnant

    :param time: time in days in observer frame
    :param redshift: redshift
    :param mass_1: Mass of primary in solar masses
    :param mass_2: Mass of secondary in solar masses
    :param lambda_s: Symmetric tidal deformability i.e, lambda_s = lambda_1 + lambda_2
    :param kappa_red: opacity of the red ejecta
    :param kappa_blue: opacity of the blue ejecta
    :param mtov: Tolman Oppenheimer-Volkoff mass in solar masses
    :param epsilon: fraction of disk that gets unbound/ejected
    :param alpha: Enhancement of blue ejecta by NS surface winds if mtotal < prompt collapse,
                can turn off by setting alpha=1
    :param cos_theta: Viewing angle of observer
    :param cos_theta_open: Lanthanide opening angle
    :param cos_theta_cocoon: Opening angle of shocked cocoon
    :param temperature_floor_1: Temperature floor of first (blue) component
    :param temperature_floor_2: Temperature floor of second (purple) component
    :param temperature_floor_3: Temperature floor of third (red) component
    :param kwargs: Additional keyword arguments
    :param dynamical_ejecta_error: Error in dynamical ejecta mass, default is 1 i.e., no error in fitting formula
    :param disk_ejecta_error: Error in disk ejecta mass, default is 1 i.e., no error in fitting formula
    :param shocked_fraction: Fraction of ejecta that is shocked by jet, default is 0.2 i.e., 20% of blue ejecta is shocked.
        Use 0. if you want to turn off cocoon emission.
    :param nn: ejecta power law density profile, default is 1.
    :param tshock: time for shock in source frame in seconds, default is 1.7s (see Nicholl et al. 2021)
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param dense_resolution: resolution of the grid that the model is actually evaluated on, default is 300
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    A single component kilonova model that *should* be exactly the same as mosfit's r-process model.
    Effectively the only difference to the redback one_component model is the inclusion of gamma-ray opacity in diffusion.

    :param time: observer frame time in days
    :param redshift: redshift
    :param mej: ejecta mass in solar masses of first component
    :param vej: minimum initial velocity of first component in units of c
    :param kappa: gray opacity of first component
    :param temperature_floor: floor temperature of first component
    :param kappa_gamma: gamma-ray opacity
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param dense_resolution: resolution of the grid that the model is actually evaluated on, default is 300
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    A three component kilonova model that *should* be exactly the same as mosfit's kilonova model or Villar et al. 2017.
    Effectively the only difference to the redback three_component model is the inclusion of gamma-ray opacity in diffusion.
    Note: Villar et al. fix the kappa's of each component to get the desired red/blue/purple components. This is not done here.

    :param time: observer frame time in days
    :param redshift: redshift
    :param mej_1: ejecta mass in solar masses of first component
    :param vej_1: minimum initial velocity of first component in units of c
    :param kappa_1: gray opacity of first component
    :param temperature_floor_1: floor temperature of first component
    :param mej_2: ejecta mass in solar masses of second component
    :param vej_2: minimum initial velocity of second component in units of c
    :param temperature_floor_2: floor temperature of second component
    :param kappa_2: gray opacity of second component
    :param mej_3: ejecta mass in solar masses of third component
    :param vej_3: minimum initial velocity of third component in units of c
    :param temperature_floor_3: floor temperature of third component
    :param kappa_3: gray opacity of third component
    :param kappa_gamma: gamma-ray opacity
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param dense_resolution: resolution of the grid that the model is actually evaluated on, default is 300
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in seconds in source frame
    :param mej: mass in solar masses
    :param vej: velocity in units of c
    :return: lbol in erg/s


    Assumes a power law distribution of ejecta velocities
    and a power law distribution of kappa corresponding to the ejecta velocity layers for a total of 10 "shells"
    and calculates the kilonova light curve, using kilonova heating rate.
    Velocity distribution is flipped so that faster material is the outermost layer as expected for homologous expansion.

    Must be used with a constraint to avoid prior draws that predict nonsensical luminosities. Or a sensible prior.

    :param time: time in days in observer frame
    :param redshift: redshift
    :param mej: total ejecta mass in solar masses
    :param voffset: minimum ejecta velocity in units of c
    :param v0: velocity normalization in units of c of the power law
    :param alpha: power-law index of the velocity distribution i.e., vel = (xs/v0)^-alpha + voffset.
    :param kappa_offset: minimum kappa value
    :param kappa_0: kappa normalization
    :param zeta: power law index of the kappa distribution i.e., kappa = (xs/kappa_0)^-zeta + kappa_offset
    :param beta: power law index of density profile
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Kilonovanet model based on Bulla BNS merger simulations

    :param time: time in days in observer frame
    :param redshift: redshift
    :param mej_dyn: dynamical mass of ejecta in solar masses
    :param mej_disk: disk mass of ejecta in solar masses
    :param phi: half-opening angle of the lanthanide-rich tidal dynamical ejecta in degrees
    :param costheta_obs: cosine of the observers viewing angle
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Kilonovanet model based on Bulla NSBH merger simulations

    :param time: time in observer frame in days
    :param redshift: redshift
    :param mej_dyn: dynamical mass of ejecta in solar masses
    :param mej_disk: disk mass of ejecta in solar masses
    :param costheta_obs: cosine of the observers viewing angle
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Kilonovanet model based on Kasen BNS simulations

    :param time: time in days in observer frame
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej: ejecta velocity in units of c
    :param chi: lanthanide fraction
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Uses kilonova_heating_rate module to model a two layer stratified kilonova

    :param time: observer frame time in days
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej_1: velocity of inner shell in c
    :param vej_2: velocity of outer shell in c
    :param kappa: constant gray opacity
    :param beta: power law index of density profile
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Uses kilonova_heating_rate module

    :param time: observer frame time in days
    :param redshift: redshift
    :param frequency: frequency to calculate - Must be same length as time array or a single number
    :param mej: ejecta mass
    :param velocity_array: array of ejecta velocities; length >=2
    :param kappa_array: opacities of each shell, length = 1 less than velocity
    :param beta: power law index of density profile
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Uses kilonova_heating_rate module

    :param time: source frame time in seconds
    :param mej: ejecta mass
    :param velocity_array: array of ejecta velocities; length >=2
    :param kappa_array: opacities of each shell, length = 1 less than velocity
    :param beta: power law index of density profile
    :return: bolometric_luminosity, temperature, photosphere


    :param time: observer frame time in days
    :param redshift: redshift
    :param mej_1: ejecta mass in solar masses of first component
    :param vej_1: minimum initial velocity of first component
    :param kappa_1: gray opacity of first component
    :param temperature_floor_1: floor temperature of first component
    :param mej_2: ejecta mass in solar masses of second component
    :param vej_2: minimum initial velocity of second component
    :param temperature_floor_2: floor temperature of second component
    :param kappa_2: gray opacity of second component
    :param mej_3: ejecta mass in solar masses of third component
    :param vej_3: minimum initial velocity of third component
    :param temperature_floor_3: floor temperature of third component
    :param kappa_3: gray opacity of third component
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: observer frame time in days
    :param redshift: redshift
    :param mej_1: ejecta mass in solar masses of first component
    :param vej_1: minimum initial velocity of first component
    :param kappa_1: gray opacity of first component
    :param temperature_floor_1: floor temperature of first component
    :param mej_2: ejecta mass in solar masses of second component
    :param vej_2: minimum initial velocity of second component
    :param temperature_floor_2: floor temperature of second component
    :param kappa_2: gray opacity of second component
    :param kwargs: Additional keyword arguments
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes no velocity projection in the ejecta velocity ejecta relation

    :param time: observer frame time in days
    :param redshift: redshift
    :param mass_1: mass of primary in solar masses
    :param mass_2: mass of secondary in solar masses
    :param lambda_1: dimensionless tidal deformability of primary
    :param lambda_2: dimensionless tidal deformability of secondary
    :param kappa: gray opacity
    :param kwargs: Additional keyword arguments
    :param temperature_floor: Temperature floor in K (default 4000)
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    Assumes a velocity projection between the orthogonal and orbital plane

    :param time: observer frame time in days
    :param redshift: redshift
    :param mass_1: mass of primary in solar masses
    :param mass_2: mass of secondary in solar masses
    :param lambda_1: dimensionless tidal deformability of primary
    :param lambda_2: dimensionless tidal deformability of secondary
    :param kappa: gray opacity
    :param kwargs: Additional keyword arguments
    :param temperature_floor: Temperature floor in K (default 4000)
    :param frequency: Required if output_format is 'flux_density'.
        frequency to calculate - Must be same length as time array or a single number).
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'