Models

In redback we have already implemented a lot of different models, which can be combined or modified to create another model easily. These models range from phenomenological, to analytical, semi-analytical to numerical surrogates built with machine learning techniques. Implementing a new model is probably the easiest way to contribute to redback!

Specifically, the models already included are

  • Afterglow models: Can output in flux density/magnitude/integrated flux/luminosity

    • Several structured jet models implemented in afterglowpy.

    • Tophat jet implemented in afterglowpy.

    • Cocoon

    • Kilonova afterglow

    • Surrogate built on top of jetfit.

    • Surrogate built on top of boxfit.

  • Kilonova models: Can output in flux density/magnitude/

  • Supernova models: Can output in flux density/magnitude/bolometric luminosity

    • Arnett

    • CSM

    • CSM + Ni

    • Basic magnetar powered

    • General magnetar powered

    • magnetar + nickel

    • SLSN

    • exponential powerlaw

    • SNcosmo

    • Shock cooling + Arnett

  • Shock models: Can output in flux density/magnitude/bolometric luminosity

    • Shock cooling

    • Thermal synchrotron

    • Shocked cocoon

    • CSM truncation shock

  • Magnetar driven ejecta models:

    • Metzger magnetar driven kilonova

    • Mergernova

    • Trapped magnetar

    • General magnetar driven kilonova

    • General mergernova

    • Magnetic field mergernova

    • Magnetic field metzger driven kilonova

  • Millisecond magnetar models

    • vacuum dipole magnetar

    • basic magnetar

    • gw + em magnetar

    • magnetar with variable braking index

    • evolving magnetar

    • magnetar with radiative losses

    • collapsing magnetar

    • piecewise magnetar

  • Tidal disruption models

  • Phenomenological and fireball models

    • 1-6 component piecewise power law

    • exponential_powerlaw

We note that these models can output in flux_density or magnitude set by the keyword argument output_format or in integrated flux or luminosity using the appropriate luminosity/flux function.

Alongside these models we also include some general models which can many of the above models as a base_model

  • Homologous expansion

  • Thin shell

  • Extinction models

  • Phase models

  • Phase + extinction models

  • Integrated flux afterglow models

  • Gaussian process base model: Will be soon implemented.

For a full up to date list of models implemented in redback, look at the API

Using redback models as functions

All models in redback are implemented as functions with minimal dependencies. This means that users can simply use these functions by themselves as you would any other python function. All users need to do is pass into the function a time array and any other parameter required by the function. In this way, users can use redback to just explore the impact of different parameters on the light curve and better understand the physics.

For example:

from redback.constants import day_to_s
from redback.model_library import all_models_dict
import numpy as np

model = 'arnett_bolometric'

function = all_models_dict[model]
time = np.logspace(2, 8, 100)/day_to_s
bolometric_luminosity = function(time, f_nickel=0.6,
                    mej=30, vej=1000, kappa=2, kappa_gamma=1e2)

Here we use all_models_dict to provide a simple way to access the relevant function. A user could of course just import the function themselves.

Users can also use the prior objects to get a simulation of the light curves predicted by the function for randomly drawn samples from the prior.

from redback.constants import day_to_s
from redback.model_library import all_models_dict
from redback.priors import get_priors
import numpy as np
import pandas as pd

model = 'arnett_bolometric'
priors = get_priors(model=model, data_mode='luminosity')
samples = pd.DataFrame(priors.sample(100))
function = all_models_dict[model]
time = np.logspace(2, 8, 100)/day_to_s

bolometric_luminosity = function(time, **samples.iloc[0])

Remember that the priors are simply a dictionary so users could also just pass a dictionary/dataframe they created themselves as well.

Users could also sample a lot of different draws from the prior at once (in the above we randomly drew a 100 samples) and then loop through them to simulate a population. Remember that we can also place arbitrary constraints on the priors to make a really specific population/simulation. For example, we could make a constraint that all priors in the population were brighter than 24th mag at peak or something else. Almost any time of constraint is possible, as long as it can be written mathematically.

Modifying redback models

A lot of the physics in different redback models is set by default. However, several different pieces of physics in various models can be changed by either passing your own function/class (see next section), by switching the default argument with something else already implemented in redback, or changing a keyword argument.

The specific physics that can be changed:

  • Jet spreading on/off

  • Whether to infer lorentz factor in afterglow models

  • Whether to turn on/off pair cascades

  • Whether to turn on/off neutron precursor emission

  • Different ejecta relations: See relations already implemented here.

  • Different equations of states: See eos already implemented here.

  • Different interaction process: See processes already implemented here.

  • Different photosphere: See photospheres already implemented here.

  • Different SED: See SED’s already implemented here.

We encourage users to add more of these physics switches, which is another easy way to contribute to redback.