# GRB 911031¶

```
import numpy as np
from PyGRB.main.fitpulse import PulseFitter
from PyGRB.backend.makemodels import create_model_from_key
from PyGRB.backend.makemodels import make_two_pulse_models
def load_973(sampler = 'dynesty', nSamples = 100):
test = PulseFitter(973, times = (-2, 50),
datatype = 'discsc', nSamples = nSamples, sampler = sampler,
priors_pulse_start = -5, priors_pulse_end = 50,
priors_td_lo = 0, priors_td_hi = 30, p_type ='docs')
return test
def evidence_for_973():
num_samples = [2000]
for samples in num_samples:
GRB = load_973(sampler=SAMPLER, nSamples=samples)
keys = ['FL', 'FF']
model_dict = {}
for key in keys:
model_dict[key] = create_model_from_key(key)
models = [model for key, model in model_dict.items()]
for model in models:
GRB.main_multi_channel(channels = [0, 1, 2, 3], model = model)
lens_bounds = [(21, 22.6), (0.25, 0.55)]
GRB.lens_calc(model = model, lens_bounds = lens_bounds)
GRB.get_evidence_from_models(model_dict = model_dict)
if __name__ == '__main__':
SAMPLER = 'nestle'
evidence_for_973()
```

Channel 1 (red)

Model |
ln Z |
error |
ln BF |

FL |
-3852.93 |
0.60 |
0.00 |

FF |
-3623.66 |
0.67 |
229.27 |

Channel 2 (orange)

Model |
ln Z |
error |
ln BF |

FL |
-3967.64 |
0.61 |
0.00 |

FF |
-3665.85 |
0.68 |
301.79 |

Channel 3 (green)

Model |
ln Z |
error |
ln BF |

FL |
-4014.63 |
0.62 |
0.00 |

FF |
-3640.90 |
0.70 |
373.73 |

Channel 4 (blue)

Model |
ln Z |
error |
ln BF |

FL |
-2986.56 |
0.57 |
0.00 |

FF |
-2970.48 |
0.62 |
16.08 |

We see that the Bayesian evidence strongly prefers a two pulse model.

## Notes¶

If you want to fit two pulses, one FRED and one FRED-X, but you do not know the order in which you would like to fit them in (eg. the two pulses are overlapping), then you will need to do both a [‘FX’] model and a [‘XF’] model. The best fitting model is then the one with the higher Bayesian evidence. This is because the order of the pulses is automatically encoded in the priors. We do this so that the results are unimodal for degenerate cases, eg [‘FF’].