    Assumes two kilonova components corresponding to dynamical and disk wind ejecta with properties
    derived using ejecta relation specified by keyword argument.

    :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 mtov: Tolman Oppenheimer Volkoff mass in solar masses
    :param zeta: fraction of disk that gets unbound
    :param vej_2: disk wind velocity in c
    :param kappa_1: gray opacity of first component
    :param kappa_2: gracy opacity of second component
    :param tf_1: floor temperature of first component
    :param tf_2: floor temperature of second component
    :param kwargs: additional keyword arguments
    :param ejecta_relation: a class that relates the instrinsic parameters to the kilonova parameters
            default is TwoComponentBNS
    :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 two kilonova components corresponding to dynamical and disk wind ejecta with properties
    derived using ejecta relation specified by keyword argument and lambda set by polytropic EOS.

    :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 log_p: log central pressure in SI units
    :param gamma_1: polytrope index 1
    :param gamma_2: polytrope index 2
    :param gamma_3: polytrope index 3
    :param zeta: fraction of disk that gets unbound
    :param vej_2: disk wind velocity in c
    :param kappa_1: gray opacity of first component
    :param kappa_2: gracy opacity of second component
    :param tf_1: floor temperature of first component
    :param tf_2: floor temperature of second component
    :param kwargs: additional keyword arguments
    :param ejecta_relation: a class that relates the instrinsic parameters to the kilonova parameters
            default is TwoComponentBNS
    :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'


    One component NSBH model

    :param time: observer frame time in days
    :param redshift: redshift
    :param mass_bh: mass of black hole
    :param mass_2: mass of neutron star
    :param chi_bh: spin of black hole along z axis
    :param lambda_ns: tidal deformability of neutron star
    :param kappa: opacity
    :param kwargs: additional keyword arguments
    :param temperature_floor: floor temperature
    :param ejecta_relation: a class that relates the instrinsic parameters to the kilonova parameters
            default is OneComponentNSBH
    :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'


    Two component NSBH model with dynamical and disk wind ejecta

    :param time: observer frame time in days
    :param redshift: redshift
    :param mass_bh: mass of black hole
    :param mass_2: mass of neutron star
    :param chi_bh: spin of black hole along z axis
    :param lambda_ns: tidal deformability of neutron star
    :param zeta: fraction of disk that gets unbound
    :param vej_2: disk wind velocity in c
    :param kappa_1: gray opacity of first component
    :param kappa_2: gracy opacity of second component
    :param tf_1: floor temperature of first component
    :param tf_2: floor temperature of second component
    :param kwargs: additional keyword arguments
    :param ejecta_relation: a class that relates the instrinsic parameters to the kilonova parameters
            default is TwoComponentNSBH
    :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: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :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'


    Heating rate prescription following Rosswog and Korobkin 2024

    :param time: time in seconds
    :param mej: ejecta mass in solar masses
    :param electron_fraction: electron fraction
    :param ejecta_velocity: ejecta velocity in c
    :param kwargs: Additional keyword arguments
    :param heating_rate_perturbation: A fudge factor for heating rate to account for uncertainties in the heating rate. Default is 1.0 i.e., no perturbation.
    :param heating_rate_fudge: A fudge factor for each of the terms in the heating rate. Default to 1. i.e., no uncertainty
    Default is 1.0 i.e., no perturbation.
    :return: heating rate in erg/s


    :param time: observer frame time in days
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param kappa: gray opacity
    :param kwargs: Additional keyword arguments
    :param temperature_floor: Temperature floor in K (default 4000)
    :param heating_rate_perturbation: A fudge factor for heating rate to account for uncertainties in the heating rate.
    Default is 1.0 i.e., no perturbation.
    :param heating_rate_fudge: A fudge factor for each of the terms in the heating rate. Default to 1. i.e., no uncertainty
    :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 heating_rate_perturbation: A fudge factor for heating rate to account for uncertainties in the heating rate.
    Default is 1.0 i.e., no perturbation.
    :param heating_rate_fudge: A fudge factor for each of the terms in the heating rate. Default to 1. i.e., no uncertainty
    :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: source frame time in seconds
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param kappa_r: gray opacity
    :param kwargs: temperature_floor
    :return: bolometric_luminosity, temperature, r_photosphere


    :param time: observer frame time in days
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param beta: velocity power law slope (M=v^-beta)
    :param kappa: gray opacity
    :param kwargs: Additional keyword arguments
    :param neutron_precursor_switch: Whether to include neutron precursor emission
    :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 array to evaluate model on in source frame in seconds
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param beta: velocity power law slope (M=v^-beta)
    :param kappa: gray opacity
    :param kwargs: Additional keyword arguments
    :param neutron_precursor_switch: Whether to include neutron precursor emission
    :return: bolometric_luminosity, temperature, photosphere_radius


    Generates a single lightcurve for a given `gwemlightcurves` model

    Parameters
    ----------
    model: str
        The `gwemlightcurve` model, e.g. 'DiUj2017'
    t_ini: float
        Starting time of the time array `gwemlightcurves` will calculate values at.
    t_max: float
        End time of the time array `gwemlightcurves` will calculate values at.
    dt: float
        Spacing of time uniform time steps.
    parameters: dict
        Function parameters for the given model.
    Returns
    ----------
    func, func: A bolometric function and the magnitude function.


    Generates a single lightcurve for a given `gwemlightcurves` model

    Parameters
    ----------
    model: str
        The `gwemlightcurve` model, e.g. 'DiUj2017'
    times: array_like
        Times at which we interpolate the `gwemlightcurves` values, in days
    parameters: dict
        Function parameters for the given model.
    Returns
    ----------
    array_like, array_like: bolometric and magnitude arrays.


    Generates `bilby`-compatible functions from `gwemlightcurve` models.

    Parameters
    ----------
    model: str
        The `gwemlightcurve` model, e.g. 'DiUj2017'

    Returns
    ----------
    func, func: A bolometric function and the magnitude function.


    :param time: time array in seconds
    :param aa: amplitude term for powerlaw
    :param mm: deceleration powerlaw gradient; typically 3 but depends on physics
    :param t0: time GRB went off.
    :param kwargs: None
    :return: deceleration powerlaw; units are arbitrary and dependent on a_1.


    :param time: time array for power law
    :param a_1: power law decay amplitude
    :param alpha_1: power law decay exponent
    :param kwargs:
    :return: powerlaw; units are arbitrary and dependent on a_1.


    Synchrotron afterglow with integrated flux

    :param time: time in days
    :param kwargs:all kwargs required by model + frequency: a list of two frequencies to integrate over.
    :return: integrated flux


    Synchrotron afterglow with approximate calculation of the counts

    :param time: time in days
    :param kwargs:all kwargs required by model + frequency: an array of two frequencies to integrate over.
        + prefactor an array of values same size as time array
        or float which calculates the effective Ei/area for the specific time bin.
    :return: counts


    :param time: time in source frame
    :param mej: ejecta mass in solar masses
    :param beta: initial ejecta velocity in c
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param magnetar_luminosity: evaluated magnetar luminosity in source frame
    :param pair_cascade_switch: whether to account for pair cascade losses
    :param use_gamma_ray_opacity: whether to use gamma ray opacity to calculate thermalisation efficiency
    :param kwargs: Additional parameters
    :param use_r_process: whether to use r-process
    :param kappa_gamma: Gamma-ray opacity for leakage efficiency, only used if use_gamma_ray_opacity = True
    :param thermalisation_efficiency: magnetar thermalisation efficiency only used if use_gamma_ray_opacity = 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 f_nickel: nickel fraction (if not using r_process)
    :return: named tuple with 'lorentz_factor', 'bolometric_luminosity', 'comoving_temperature',
            'radius', 'doppler_factor', 'tau', 'time', 'kinetic_energy',
            'erad_total', 'thermalisation_efficiency'


    :param dl: luminosity distance in cm
    :param frequency: frequency to calculate in Hz - Must be same length as time array or a single number
    :param radius: ejecta radius in cm
    :param temperature: comoving temperature in K
    :param doppler_factor: doppler_factor
    :return: flux_density


    :param frequency: frequency to calculate in Hz - Must be same length as time array or a single number
    :param radius: ejecta radius in cm
    :param temperature: comoving temperature in K
    :param doppler_factor: doppler_factor
    :return: luminosity


    Function to process the output of the dynamics function into other formats

    :param dl: luminosity distance in cm
    :param output: dynamics output
    :param redshift: source redshift
    :param time_obs: observed time array in days
    :param time_temp: temporary time array in seconds where output is evaluated
    :param kwargs: extra arguments
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :return: returns the correct output format


    Function to process the output of the dynamics function into flux density

    :param dl: luminosity distance in cm
    :param output: dynamics output
    :param redshift: source redshift
    :param time_obs: observed time array in days
    :param time_temp: temporary time array in seconds where output is evaluated
    :param kwargs: extra arguments
    :return: returns the correct output format


    :param time: time in observer frame in days
    :param redshift: redshift
    :param mej: ejecta mass in solar units
    :param beta: initial ejecta velocity
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param p0: initial spin period in milliseconds
    :param bp: polar magnetic field strength in units of 10^14 Gauss
    :param mass_ns: mass of neutron star in solar masses
    :param theta_pb: angle between spin and magnetic field axes in radians
    :param thermalisation_efficiency: magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :param pair_cascade_switch: whether to account for pair cascade losses, default is False
    :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 redshift: redshift
    :param mej: ejecta mass in solar units
    :param beta: initial ejecta velocity
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param l0: initial magnetar X-ray luminosity
    :param tau_sd: magnetar spin down damping timescale
    :param nn: braking index
    :param thermalisation_efficiency: magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :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 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 redshift: redshift
    :param mej: ejecta mass in solar units
    :param beta: initial ejecta velocity
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param l0: initial magnetar X-ray luminosity
    :param tau_sd: magnetar spin down damping timescale
    :param nn: braking index
    :param kappa_gamma: gamma-ray opacity used to calculate magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :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 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 redshift: redshift
    :param mej: ejecta mass in solar units
    :param beta: initial ejecta velocity
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param logbint: log10 internal magnetic field in G
    :param logbext: log10 external magnetic field in G
    :param p0: spin period in s
    :param chi0: initial inclination angle
    :param radius: radius of NS in KM
    :param logmoi: log10 moment of inertia of NS
    :param kappa_gamma: gamma-ray opacity used to calculate magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :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 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.
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    :param time: time in source frame
    :param mej: ejecta mass in solar units
    :param beta: initial ejecta velocity
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param l0: initial magnetar X-ray luminosity
    :param tau_sd: magnetar spin down damping timescale
    :param nn: braking index
    :param thermalisation_efficiency: magnetar thermalisation efficiency
    :param kwargs: 'output_format' - whether to output flux density or AB magnitude
    :param kwargs: 'frequency' in Hertz to evaluate the mergernova emission - use a typical X-ray frequency
    :return: luminosity


    :param time: time in observer frame in seconds
    :param redshift: redshift
    :param mej: ejecta mass in solar units
    :param beta: initial ejecta velocity
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param l0: initial magnetar X-ray luminosity
    :param tau_sd: magnetar spin down damping timescale
    :param nn: braking index
    :param thermalisation_efficiency: magnetar thermalisation efficiency
    :param kwargs: 'output_format' - whether to output flux density or AB magnitude
    :param kwargs: 'frequency' in Hertz to evaluate the mergernova emission - use a typical X-ray frequency
    :param kwargs: 'photon_index' used to calculate k correction and convert from luminosity to flux
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: integrated flux


    :param time: time in source frame or observer frame depending on output format in seconds
    :param redshift: redshift - not used if evaluating luminosity
    :param mej: ejecta mass in solar units
    :param beta: initial ejecta velocity
    :param ejecta_radius: initial ejecta radius
    :param kappa: opacity
    :param n_ism: ism number density
    :param l0: initial magnetar X-ray luminosity
    :param tau_sd: magnetar spin down damping timescale
    :param nn: braking index
    :param thermalisation_efficiency: magnetar thermalisation efficiency
    :param kwargs: 'output_format' - whether to output luminosity or flux
    :param kwargs: 'frequency' in Hertz to evaluate the mergernova emission - use a typical X-ray frequency
    :param kwargs: 'photon_index' only used if calculating the flux lightcurve
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: luminosity or integrated flux


    :param time: time array to evaluate model on in source frame in seconds
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param beta: velocity power law slope (M=v^-beta)
    :param kappa: opacity
    :param magnetar_luminosity: evaluated magnetar luminosity in source frame
    :param pair_cascade_switch: whether to account for pair cascade losses
    :param use_gamma_ray_opacity: whether to use gamma ray opacity to calculate thermalisation efficiency
    :param kwargs: Additional parameters
    :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 kappa_gamma: Gamma-ray opacity for leakage efficiency, only used if use_gamma_ray_opacity = True
    :param thermalisation_efficiency: magnetar thermalisation efficiency only used if use_gamma_ray_opacity = False
    :param neutron_precursor_switch: whether to have neutron precursor emission, default True
    :param pair_cascade_switch: whether to account for pair cascade losses, default is True
    :param magnetar_heating: whether magnetar heats all layers or just the bottom layer.
    :param vmax: maximum initial velocity of mass layers, default is 0.7c
    :return: named tuple with 'lorentz_factor', 'bolometric_luminosity', 'temperature',
                'r_photosphere', 'kinetic_energy','erad_total', 'thermalisation_efficiency'


    :param time: observer frame time in days
    :param redshift: redshift
    :param mej: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param beta: velocity power law slope (M=v^-beta)
    :param kappa_r: opacity
    :param p0: initial spin period in milliseconds
    :param bp: polar magnetic field strength in units of 10^14 Gauss
    :param mass_ns: mass of neutron star in solar masses
    :param theta_pb: angle between spin and magnetic field axes in radians
    :param thermalisation_efficiency: magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :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 neutron_precursor_switch: whether to have neutron precursor emission, default True
    :param magnetar_heating: whether magnetar heats all layers or just the bottom layer. default first layer only
    :param vmax: maximum initial velocity of mass layers, default is 0.7c
    :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: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param beta: velocity power law slope (M=v^-beta)
    :param kappa_r: opacity
    :param l0: initial magnetar X-ray luminosity
    :param tau_sd: magnetar spin down damping timescale
    :param nn: braking index
    :param thermalisation_efficiency: magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :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 neutron_precursor_switch: whether to have neutron precursor emission, default true
    :param pair_cascade_switch: whether to account for pair cascade losses, default is True
    :param magnetar_heating: whether magnetar heats all layers or just the bottom layer. default first layer only
    :param vmax: maximum initial velocity of mass layers, default is 0.7c
    :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: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param beta: velocity power law slope (M=v^-beta)
    :param kappa_r: opacity
    :param l0: initial magnetar X-ray luminosity
    :param tau_sd: magnetar spin down damping timescale
    :param nn: braking index
    :param kappa_gamma: gamma-ray opacity used to calculate magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :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 neutron_precursor_switch: whether to have neutron precursor emission, default true
    :param pair_cascade_switch: whether to account for pair cascade losses, default is True
    :param magnetar_heating: whether magnetar heats all layers or just the bottom layer. default first layer only
    :param vmax: maximum initial velocity of mass layers, default is 0.7c
    :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: ejecta mass in solar masses
    :param vej: minimum initial velocity
    :param beta: velocity power law slope (M=v^-beta)
    :param kappa_r: opacity
    :param logbint: log10 internal magnetic field in G
    :param logbext: log10 external magnetic field in G
    :param p0: spin period in s
    :param chi0: initial inclination angle
    :param radius: radius of NS in KM
    :param logmoi: log10 moment of inertia of NS
    :param kappa_gamma: gamma-ray opacity used to calculate magnetar thermalisation efficiency
    :param kwargs: Additional parameters
    :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 neutron_precursor_switch: whether to have neutron precursor emission, default true
    :param pair_cascade_switch: whether to account for pair cascade losses, default is True
    :param magnetar_heating: whether magnetar heats all layers or just the bottom layer. default first layer only
    :param vmax: maximum initial velocity of mass layers, default is 0.7c
    :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'


    function to combine the flux density signals of a tophat afterglow and a two layer stratified kilonova with extinction

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param av: V-band extinction from host galaxy in magnitudes
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param beta: index for power-law structure, theta^-b
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :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 e.g., for extinction or the models
    :param r_v: extinction parameter, defaults to 3.1
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param frequency: frequency to calculate - Must be same length as time array or a single number
    :return: flux density signal with extinction added


    function to combine the flux density signals of a tophat afterglow and a two component kilonova with extinction added

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param av: V-band extinction from host galaxy in magnitudes
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param beta: index for power-law structure, theta^-b
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :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 e.g., for extinction or the models
    :param r_v: extinction parameter, defaults to 3.1
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param frequency: frequency to calculate - Must be same length as time array or a single number
    :return: flux density signal with extinction added


    function to combine the flux density signals of a tophat afterglow and an arnett supernova with extinction added

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param av: V-band extinction from host galaxy in magnitudes
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param beta: index for power-law structure, theta^-b
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param f_nickel: fraction of nickel mass
    :param mej: total ejecta mass in solar masses
    :param kwargs: Additional keyword arguments
        Must include 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
        any other kwargs for the specific models.
    :param r_v: extinction parameter, defaults to 3.1
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :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: frequency to calculate - Must be same length as time array or a single number
    :return: flux density with extinction added


    function to combine the signals of any afterglow and any other optical transient with extinction added

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param av: V-band extinction from host galaxy in magnitudes
    :param model_kwargs: kwargs shared by models frequency and r_v (extinction paramater defaults to 3.1)
    :param afterglow_kwargs: dictionary of  parameters required by the afterglow transient model specified by 'base_model'
        and any additional keyword arguments. Refer to model documentation for details.
    :param optical_kwargs: dictionary of parameters required by the optical transient model specifed by 'base_model'
        and any additional keyword arguments. Note the base model must correspond to the given model type. Refer to model documentation
        for details.
    :return: flux density signal with extinction added


    :param nu: frequency in Hz
    :param B: magnetic field in G
    :param gamma_m: minimum Lorentz factor of electrons
    :param gamma_c: electron Lorentz factor at which the cooling is important
    :param Ne: Number of emitting electrons
    :param p: power law index of the electron energy distribution
    :return: Pnu


    Calculates blast-wave hydrodynamics. Based on Pe'er (2012) with a numerical correction
    factor to ensure asymptotic convergence to Sedov-Taylor solution (see also Nava et al. 2013; Huang et al. 1999)

    :param n0: ISM density in cm^-3
    :param Eej: Ejecta energy in erg
    :param Mej: ejecta mass in g
    :return: Dynamical outputs - t, R, beta, Gamma, eden, tobs, beta_sh, Gamma_sh.


    A tophat model implemented directly in redback. Based on Lamb, Mandel & Resmi 2018 and other work.
    Look at the RedbackAfterglow class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet opening angle in radians
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A Gaussian structure afterglow model implemented directly in redback. Based on Lamb, Mandel & Resmi 2018 and other work.
    Look at the RedbackAfterglow class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A two component model implemented directly in redback. Tophat till thc and then second component till thj.
    Based on Lamb, Mandel & Resmi 2018 and other work.
    Look at the RedbackAfterglow class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Fraction of energy in the outer sheath of the jet. Defaults to 0.01
    :param aa: Lorentz factor outside the core. Defaults to 4.
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A Classic powerlaw structured jet implemented directly in redback.
    Tophat with powerlaw energy proportional to theta^ss and lorentz factor proportional to theta^aa outside core.
    Based on Lamb, Mandel & Resmi 2018 and other work.
    Look at the RedbackAfterglow class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Index of energy outside core. Defaults to -3
    :param aa: Index of Lorentz factor outside the core. Defaults to -3
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    An alternative powerlaw structured jet implemented directly in redback. Profile follows (theta/thc^2)^0.5^(-s or -a).
    Based on Lamb, Mandel & Resmi 2018 and other work.
    Look at the RedbackAfterglow class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Index of energy outside core. Defaults to 3
    :param aa: Index of Lorentz factor outside the core. Defaults to 3
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    Double Gaussian structured jet implemented directly in redback.
    Based on Lamb, Mandel & Resmi 2018 and other work.
    Look at the RedbackAfterglow class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Fractional contribution of energy to second Gaussian. Defaults to 0.1, must be less than 1.
    :param aa: Lorentz factor for second Gaussian, must be less than 1.
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A Refreshed tophat model implemented directly in redback. Based on Lamb et al. 2019
    Look at the RedbackAfterglowRefreshed class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet opening angle in radians
    :param g1: Lorentz factor of shell at start of energy injection. 2 <= g1 < g0
    :param et: factor by which total kinetic energy is larger
    :param s1: index for energy injection; typically between 0--10, some higher values, ~<30, are supported for some structures.
        Values of ~10 are consistent with a discrete shock interaction, see Lamb, Levan & Tanvir 2020
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A Refreshed Gaussian structured jet model implemented directly in redback. Based on Lamb et al. 2019
    Look at the RedbackAfterglowRefreshed class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param g1: Lorentz factor of shell at start of energy injection. 2 <= g1 < g0
    :param et: factor by which total kinetic energy is larger
    :param s1: index for energy injection; typically between 0--10, some higher values, ~<30, are supported for some structures.
        Values of ~10 are consistent with a discrete shock interaction, see Lamb, Levan & Tanvir 2020
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A refreshed two component model implemented directly in redback. Tophat till thc and then second component till thj.
    Based on Lamb et al. 2019 and other work.
    Look at the RedbackAfterglowRefreshed class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param g1: Lorentz factor of shell at start of energy injection. 2 <= g1 < g0
    :param et: factor by which total kinetic energy is larger
    :param s1: index for energy injection; typically between 0--10, some higher values, ~<30, are supported for some structures.
        Values of ~10 are consistent with a discrete shock interaction, see Lamb, Levan & Tanvir 2020
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Fraction of energy in the outer sheath of the jet. Defaults to 0.01
    :param aa: Lorentz factor outside the core. Defaults to 4.
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A Classic refreshed powerlaw structured jet implemented directly in redback.
    Tophat with powerlaw energy proportional to theta^ss and lorentz factor proportional to theta^aa outside core.
    Based on Lamb et al. 2019 and other work.
    Look at the RedbackAfterglowRefreshed class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param g1: Lorentz factor of shell at start of energy injection. 2 <= g1 < g0
    :param et: factor by which total kinetic energy is larger
    :param s1: index for energy injection; typically between 0--10, some higher values, ~<30, are supported for some structures.
        Values of ~10 are consistent with a discrete shock interaction, see Lamb, Levan & Tanvir 2020
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Index of energy outside core. Defaults to -3
    :param aa: Index of Lorentz factor outside the core. Defaults to -3
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    An alternative refreshed powerlaw structured jet implemented directly in redback. Profile follows (theta/thc^2)^0.5^(-s or -a).
    Based on Lamb et al. 2019.
    Look at the RedbackAfterglowRefreshed class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param g1: Lorentz factor of shell at start of energy injection. 2 <= g1 < g0
    :param et: factor by which total kinetic energy is larger
    :param s1: index for energy injection; typically between 0--10, some higher values, ~<30, are supported for some structures.
        Values of ~10 are consistent with a discrete shock interaction, see Lamb, Levan & Tanvir 2020
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Index of energy outside core. Defaults to 3
    :param aa: Index of Lorentz factor outside the core. Defaults to 3
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    Double Gaussian structured, refreshed jet implemented directly in redback.
    Based on Lamb et al. 2019 and other work.
    Look at the RedbackAfterglowRefreshed class for more details/implementation.

    :param time: time in days
    :param redshift: source redshift
    :param thv: observer viewing angle in radians
    :param loge0: jet energy in \log_{10} ergs
    :param thc: jet core size in radians
    :param thj: jet edge in radians (thc < thj < pi/2)
    :param g1: Lorentz factor of shell at start of energy injection. 2 <= g1 < g0
    :param et: factor by which total kinetic energy is larger
    :param s1: index for energy injection; typically between 0--10, some higher values, ~<30, are supported for some structures.
        Values of ~10 are consistent with a discrete shock interaction, see Lamb, Levan & Tanvir 2020
    :param logn0: ism number density in \log_{10} cm^-3 or \log_{10} A* for wind-like density profile
    :param p: electron power law index
    :param logepse: partition fraction in electrons
    :param logepsb: partition fraction in magnetic field
    :param g0: initial lorentz factor
    :param xiN: fraction of electrons that get accelerated. Defaults to 1.
    :param kwargs: additional keyword arguments
    :param res: resolution - set dynamically based on afterglow properties by default,
            but can be set manually to a specific number.
    :param steps: number of steps used to resolve Gamma and dm. Defaults to 250 but can be set manually.
    :param k: power law index of density profile. Defaults to 0 for constant density.
        Can be set to 2 for wind-like density profile.
    :param expansion: 0 or 1 to dictate whether to include expansion effects. Defaults to 1
    :param ss: Fractional contribution of energy to second Gaussian. Defaults to 0.1, must be less than 1.
    :param aa: Lorentz factor for second Gaussian, must be less than 1.
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A cocoon afterglow model from afterglowpy

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param umax: initial outflow 4 velocity maximum
    :param umin: minimum outflow 4 velocity
    :param loge0: log10 fidicial energy in velocity distribution E(>u) = E0u^-k in erg
    :param k: power law index of energy velocity distribution
    :param mej: mass of material at umax in solar masses
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A kilonova afterglow model from afterglowpy, similar to cocoon but with constraints.

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param umax: initial outflow 4 velocity maximum
    :param umin: minimum outflow 4 velocity
    :param loge0: log10 fidicial energy in velocity distribution E(>u) = E0u^-k in erg
    :param k: power law index of energy velocity distribution
    :param mej: mass of material at umax in solar masses
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A cone afterglow model from afterglowpy

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thw: wing truncation angle of jet thw = thw*thc
    :param thc: half width of jet core in radians
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A gaussiancore model from afterglowpy

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thw: wing truncation angle of jet thw = thw*thc
    :param thc: half width of jet core in radians
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A gaussian structured jet model from afterglowpy

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thw: wing truncation angle of jet thw = thw*thc
    :param thc: half width of jet core in radians
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A smoothpowerlaw structured jet model from afterglowpy

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thw: wing truncation angle of jet thw = thw*thc
    :param thc: half width of jet core in radians
    :param beta: index for power-law structure, theta^-b
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A power law with core structured jet model from afterglowpy

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thw: wing truncation angle of jet thw = thw*thc
    :param thc: half width of jet core in radians
    :param beta: index for power-law structure, theta^-b
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A tophat jet model from afterglowpy

    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param ksin: fraction of electrons that get accelerated
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models. assuming a monochromatic


    Evaluate a tophat afterglow model using an mpl regressor. Note that this model predicts for a fixed redshift = 0.01 and fixed ksin = 1.
    This tophat model does not include all of the ususal kwargs

    :param time: time in days in observer frame, should be in range 0.1 to 300
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param logn0: log10 number density of ISM in cm^-3
    :param p: electron distribution power law index. Must be greater than 2.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param frequency: frequency of the band to view in- single number or same length as time array
    :param output_format: Whether to output flux density or AB mag, specified by 'flux_density' or 'magnitude'
    :return: flux density or AB mag predicted by emulator. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models


    A base class for afterglowpy models with energy injection.

    :param time: time in days in observer frame
    :param kwargs: Additional keyword arguments
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param base_model: A string to indicate the type of jet model to use.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A base class for afterglow models with jet spreading. Note, with these models you cannot sample in g0.

    :param time: time in days in observer frame
    :param kwargs: Additional keyword arguments
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param l0, ts, q: energy injection parameters, defaults to 0
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param base_model: A string to indicate the type of jet model to use.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.
        For a proper calculation of the magntitude use the sed variant models.


    A base class for afterglowpy models for bandpass magnitudes/flux/spectra/sncosmo source.

    :param time: time in days in observer frame
    :param kwargs: Additional keyword arguments, must be all parameters required by the base model and the following:
    :param base_model: A string to indicate the type of jet model to use.
    :param spread: whether jet can spread, defaults to False
    :param latres: latitudinal resolution for structured jets, defaults to 2
    :param tres: time resolution of shock evolution, defaults to 100
    :param spectype: whether to have inverse compton, defaults to 0, i.e., no inverse compton.
        Change to 1 for including inverse compton emission.
    :param bands: Required if output_format is 'magnitude' or 'flux'.
    :param output_format: 'magnitude', 'spectra', 'flux', 'sncosmo_source'
    :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on.
    :return: set by output format - 'magnitude', 'spectra', 'flux', 'sncosmo_source'


    A tophat jet model from jetsimpy
    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param nism: number density of ISM in cm^-3 (ntot = A * (r / 1e17)^-2 + nism (cm^-3))
    :param A: wind density scale (ntot = A * (r / 1e17)^-2 + nism (cm^-3))
    :param p: electron distribution power law index.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.


    A gaussian jet model from jetsimpy
    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param nism: number density of ISM in cm^-3 (ntot = A * (r / 1e17)^-2 + nism (cm^-3))
    :param A: wind density scale (ntot = A * (r / 1e17)^-2 + nism (cm^-3))
    :param p: electron distribution power law index.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param g0: initial lorentz factor
    :param kwargs: Additional keyword arguments
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.


    A power-law jet model from jetsimpy
    :param time: time in days in observer frame
    :param redshift: source redshift
    :param thv: viewing angle in radians
    :param loge0: log10 on axis isotropic equivalent energy
    :param thc: half width of jet core/jet opening angle in radians
    :param nism: number density of ISM in cm^-3 (ntot = A * (r / 1e17)^-2 + nism (cm^-3))
    :param A: wind density scale (ntot = A * (r / 1e17)^-2 + nism (cm^-3))
    :param p: electron distribution power law index.
    :param logepse: log10 fraction of thermal energy in electrons
    :param logepsb: log10 fraction of thermal energy in magnetic field
    :param g0: initial lorentz factor
    :param s: power-law jet slope
    :param kwargs: Additional keyword arguments
    :param output_format: Whether to output flux density or AB mag
    :param frequency: frequency in Hz for the flux density calculation
    :param cosmology: Cosmology to use for luminosity distance calculation. Defaults to Planck18. Must be a astropy.cosmology object.
    :return: flux density or AB mag. Note this is going to give the monochromatic magnitude at the effective frequency for the band.


    :param time: time in mjd
    :param t0: start time in mjd
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model']
    :return: output of the base_model


    :param time: time in mjd
    :param t0: start time in mjd
    :param av_host: V-band extinction from host galaxy in magnitudes
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model'] plus:
        - redshift: source redshift (required)
        - av_mw: MW V-band extinction in magnitudes (default 0.0)
        - rv_host: host R_V parameter (default 3.1)
        - rv_mw: MW R_V parameter (default 3.1)
        - host_law: host extinction law (default 'fitzpatrick99')
        - mw_law: MW extinction law (default 'fitzpatrick99')
        Available extinction laws: 'fitzpatrick99', 'fm07', 'calzetti00', 'odonnell94', 'ccm89'
    :return: flux_density or magnitude depending on kwargs['output_format'] with extinction applied


    Afterglow model with t0 parameter and host/MW extinction

    :param time: time in mjd
    :param t0: start time in mjd
    :param av_host: V-band extinction from host galaxy in magnitudes
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model'] plus:
        - redshift: source redshift (required)
        - av_mw: MW V-band extinction in magnitudes (default 0.0)
        - rv_host: host R_V parameter (default 3.1)
        - rv_mw: MW R_V parameter (default 3.1)
        - host_law: host extinction law (default 'fitzpatrick99')
        - mw_law: MW extinction law (default 'fitzpatrick99')
        Available extinction laws: 'fitzpatrick99', 'fm07', 'calzetti00', 'odonnell94', 'ccm89'
    :return: flux_density or magnitude depending on kwargs['output_format'] with extinction applied


    Supernova model with t0 parameter and host/MW extinction

    :param time: time in mjd
    :param t0: start time in mjd
    :param av_host: V-band extinction from host galaxy in magnitudes
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model'] plus:
        - redshift: source redshift (required)
        - av_mw: MW V-band extinction in magnitudes (default 0.0)
        - rv_host: host R_V parameter (default 3.1)
        - rv_mw: MW R_V parameter (default 3.1)
        - host_law: host extinction law (default 'fitzpatrick99')
        - mw_law: MW extinction law (default 'fitzpatrick99')
        Available extinction laws: 'fitzpatrick99', 'fm07', 'calzetti00', 'odonnell94', 'ccm89'
    :return: flux_density or magnitude depending on kwargs['output_format'] with extinction applied


    Kilonova model with t0 parameter and host/MW extinction

    :param time: time in mjd
    :param t0: start time in mjd
    :param av_host: V-band extinction from host galaxy in magnitudes
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model'] plus:
        - redshift: source redshift (required)
        - av_mw: MW V-band extinction in magnitudes (default 0.0)
        - rv_host: host R_V parameter (default 3.1)
        - rv_mw: MW R_V parameter (default 3.1)
        - host_law: host extinction law (default 'fitzpatrick99')
        - mw_law: MW extinction law (default 'fitzpatrick99')
        Available extinction laws: 'fitzpatrick99', 'fm07', 'calzetti00', 'odonnell94', 'ccm89'
    :return: flux_density or magnitude depending on kwargs['output_format'] with extinction applied


    TDE model with t0 parameter and host/MW extinction

    :param time: time in mjd
    :param t0: start time in mjd
    :param av_host: V-band extinction from host galaxy in magnitudes
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model'] plus:
        - redshift: source redshift (required)
        - av_mw: MW V-band extinction in magnitudes (default 0.0)
        - rv_host: host R_V parameter (default 3.1)
        - rv_mw: MW R_V parameter (default 3.1)
        - host_law: host extinction law (default 'fitzpatrick99')
        - mw_law: MW extinction law (default 'fitzpatrick99')
        - peak_time_mjd: peak time in mjd (if provided, will be converted to peak_time relative to t0)
        Available extinction laws: 'fitzpatrick99', 'fm07', 'calzetti00', 'odonnell94', 'ccm89'
    :return: flux_density or magnitude depending on kwargs['output_format'] with extinction applied


    Magnetar-driven model with t0 parameter and host/MW extinction

    :param time: time in mjd
    :param t0: start time in mjd
    :param av_host: V-band extinction from host galaxy in magnitudes
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model'] plus:
        - redshift: source redshift (required)
        - av_mw: MW V-band extinction in magnitudes (default 0.0)
        - rv_host: host R_V parameter (default 3.1)
        - rv_mw: MW R_V parameter (default 3.1)
        - host_law: host extinction law (default 'fitzpatrick99')
        - mw_law: MW extinction law (default 'fitzpatrick99')
        Available extinction laws: 'fitzpatrick99', 'fm07', 'calzetti00', 'odonnell94', 'ccm89'
    :return: flux_density or magnitude depending on kwargs['output_format'] with extinction applied


    Shock-powered model with t0 parameter and host/MW extinction

    :param time: time in mjd
    :param t0: start time in mjd
    :param av_host: V-band extinction from host galaxy in magnitudes
    :param kwargs: Must be all the parameters required by the base_model specified using kwargs['base_model'] plus:
        - redshift: source redshift (required)
        - av_mw: MW V-band extinction in magnitudes (default 0.0)
        - rv_host: host R_V parameter (default 3.1)
        - rv_mw: MW R_V parameter (default 3.1)
        - host_law: host extinction law (default 'fitzpatrick99')
        - mw_law: MW extinction law (default 'fitzpatrick99')
        Available extinction laws: 'fitzpatrick99', 'fm07', 'calzetti00', 'odonnell94', 'ccm89'
    :return: flux_density or magnitude depending on kwargs['output_format'] with extinction applied


    :param time: time in mjd
    :param lognh: hydrogen column density
    :param factor: prefactor for extinction
    :param kwargs: Must include t0 parameter which is in the same units as the data.
                And all the parameters required by the base_model specified using kwargs['base_model']
    :return: magnitude or flux_density depending on kwarg 'output_format'


    Assume pre-deceleration behaviour is in thin-shell regime and follows Sari and Piran 1997

    :param time:
    :param kwargs:
    :return: flux or magnitude


    Sample in peak time and smoothly connect with afterglowpy output

    :param time: in MJD, times should be after T0.
    :param tp: in MJD
    :param kwargs:
    :return: flux or magnitude depending on kwargs.


    :param time: time in seconds
    :param burst_start: burst start time in seconds
    :param background_rate: background rate. This background rate could be zero.
    :param kwargs: all other keyword arguments needed for the base model
    :return: rate, including the background rate


    Afterglowpy based integrated flux models with burst_start as a parameter.

    :param time: time in seconds
    :param kwargs: Must include a burst_start and background_rate parameter. This background rate could be zero.
    :return: integrated flux


    Afterglowpy based flux density models with burst_start as a parameter.

    :param time: time in seconds
    :param kwargs: Must include a burst_start and background_rate parameter. This background rate could be zero.
    :return: flux density for time > T0 parameter


    Bolometric lightcurve following the Morag, Sapir, & Waxman model.

    :param time: time in source frame in days
    :param v_shock: shock speed in km/s
    :param m_env: envelope mass in solar masses
    :param f_rho_m: f_rho * M (with M in solar masses). f_rho is typically, of order unity
    :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


    Lightcurve following the Morag, Sapir, & Waxman model

    :param time: time in observer frame in days
    :param redshift: redshift
    :param v_shock: shock speed in km/s
    :param m_env: envelope mass in solar masses
    :param f_rho_m: f_rho * M (with M in solar masses). f_rho is typically, of order unity
    :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 time_temp: Optional argument to set your desired time array (in source frame days) to evaluate the model on.
    :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 lightcurve following the Sapir & Waxman (and Rabinak & Waxman) model.

    :param time: time in source frame in days
    :param v_shock: shock speed in km/s
    :param m_env: envelope mass in solar masses
    :param f_rho_m: f_rho * M (with M in solar masses). f_rho is typically, of order unity
    :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