# Reproduction package for the paper "A new approach to modelling gamma-ray burst afterglows: Using Gaussian processes to account for the systematics"

This is a basic reproduction package for the paper "A new approach to modelling gamma-ray burst afterglows: Using Gaussian processes to account for the systematics" by [Aksulu M.D. et al.
(2020)](https://arxiv.org/abs/2004.04166, https://doi.org/10.1093/mnras/staa2297).

## Raw Data:
- GRB afterglow data sets: 
    These files are organised as follows; the first column is time since burst (s), second column is observer band (Hz), third column is flux (mJy), and the fourth column is the error on the flux (mJy). The file names indicate to which GRB it belongs to and is formatted as "grbXXXXXXdata". The file names which do not end with "_full" indicate the data set used for modelling,  whereas if the file name ends with "_full" it indicates the complete data set. The file names are:
    - grb970508data_full.txt
    - grb970508data.txt
    - grb980703data_full.txt
    - grb980703data.txt
    - grb990510data.txt
    - grb991208data_full.txt
    - grb991208data.txt
    - grb991216data_full.txt
    - grb991216data.txt
- Posterior samples:
    These files contain the obtained posterior samples from modelling the sample of GRB afterglow data sets using the Gaussian process model. Each row contains a single sample including both physical parameters and hyperparameters, as well as the log-likelihood value corresponding to that sample. The prefix of the file names indicate to which GRB it belongs to. The files are organized as follows: 
    - 970508-post_equal_weights.dat: log10 a1, log10 l1, ln w, theta_0, log10 E_K_iso, log10 n_ref, theta_obs / theta_0, p, log10 epsilon_B, log10 epsilon_e_bar, lnlikelihood 
    - 980703-post_equal_weights.dat: log10 a1, log10 l1, ln w, theta_0, log10 E_K_iso, log10 n_ref, theta_obs / theta_0, p, log10 epsilon_B, log10 epsilon_e_bar, log10 persistent flux @ 1.43e9 Hz, log10 persistent flux @ 4.86e9 Hz, log10 persistent flux @ 8.46e9 Hz, log10 persistent flux @ 1.35e14 Hz, log10 persistent flux @ 1.87e14 Hz, log10 persistent flux @ 2.38e14 Hz, log10 persistent flux @ 3.79e14 Hz, log10 persistent flux @ 4.68e14 Hz, log10 persistent flux @ 5.45e14 Hz, log10 persistent flux @ 6.81e14 Hz, lnlikelihood 
    - 990510-post_equal_weights.dat: log10 a1, log10 l1, ln w, theta_0, log10 E_K_iso, log10 n_ref, theta_obs / theta_0, p, log10 epsilon_B, log10 epsilon_e_bar, lnlikelihood 
    - 991208-post_equal_weights.dat: log10 a1, log10 l1, ln w, theta_0, log10 E_K_iso, log10 n_ref, theta_obs / theta_0, p, log10 epsilon_B, log10 epsilon_e_bar, log10 persistent flux @ 3.79e14 Hz, log10 persistent flux @ 4.68e14 Hz, log10 persistent flux @ 5.45e14 Hz, log10 persistent flux @ 6.81e14 Hz, lnlikelihood 
    - 991216-post_equal_weights.dat: log10 a1, log10 l1, ln w, theta_0, log10 E_K_iso, log10 n_ref, theta_obs / theta_0, p, log10 epsilon_B, log10 epsilon_e_bar, log10 persistent flux @ 1.35e14 Hz, log10 persistent flux @ 1.87e14 Hz, log10 persistent flux @ 2.38e14 Hz, log10 persistent flux @ 3.79e14 Hz, log10 persistent flux @ 4.68e14 Hz, log10 persistent flux @ 5.45e14 Hz, lnlikelihood 
- Synthetic datasets:
    These files contain the resulting data set for the test case presented in Section 2. There are 2 data sets: one for model 1 (M1) and one for model 2 (M2). See paper for details. The formatting for these files is the same as "GRB afterglow data sets".
- Synthetic posterior samples:
    These files contain the posterior samples for the modelling results of the synthetic data sets. There are 4 files containing the posterior distribution created by using the GP and chi^2 approach for synthetic data sets created by both model 1 (M1) and model 2 (M2). The columns are organized as follows:
    - M1-chi-post_equal_weights.dat, M2-chi-post_equal_weights.dat: theta_0, log10 E_K_iso, log10 n_ref, theta_obs / theta_0, p, log10 epsilon_B, log10 epsilon_e_bar, lnlikelihood 
    - M1-gp-post_equal_weights.dat, M2-gp-post_equal_weights.dat: log10 a1, log10 l1, ln w, theta_0, log10 E_K_iso, log10 n_ref, theta_obs / theta_0, p, log10 epsilon_B, log10 epsilon_e_bar, lnlikelihood 


## Software:
- The software will be described in a future publication (Ryan, van Eerten, Aksulu et al. in preparation) and is not included in this reproduction package.

## Figures:
- Figure 1: The underlying data is given in grb970508data_full.txt and grb970508data.txt (see Raw Data section).
- Figure 2: These violin plots are created using the posterior samples given in "Synthetic posterior samples".
- Figure 3: The values for the lines are given as .txt files. The files are organised as follows; the first column is the X axis, second column is the Y axis. 
- Figure 4: This figure can be recreated using the posterior samples (see Raw Data section).
- Figure 5: The data underlying this plot is given in Tables 6 to 10.
- Figure 6: The values for the lines are given as .txt files. The files are organised as follows; the first column is the X axis, second column is the Y axis, third column is negative uncertainty, fourth column is positive uncertainty.
- Figure A1-5: The underlying data is given in "GRB afterglow data sets".