Background models
BackgroundModel
¶
Bases: ABC
Handles the background modelling in our spectra. This is handled in a separate class for now since backgrounds can be phenomenological models fitted directly on the folded spectrum. This is not the case for the source model, which is fitted on the unfolded spectrum. This might be changed later.
Source code in src/jaxspec/model/background.py
16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
numpyro_model(observation, name='', observed=True)
abstractmethod
¶
Build the model for the background.
Source code in src/jaxspec/model/background.py
23 24 25 26 27 28 |
|
BackgroundWithError
¶
Bases: BackgroundModel
Define a model where the observed background is subtracted from the observed accounting for its intrinsic spread. It fits a countrate for each background bin assuming a Poisson distribution.
Source code in src/jaxspec/model/background.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
GaussianProcessBackground
¶
Bases: BackgroundModel
Define a Gaussian Process to model the background. The GP is built using the
tinygp
library.
Source code in src/jaxspec/model/background.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
__init__(e_min, e_max, n_nodes=30, kernel=kernels.Matern52)
¶
Build the Gaussian Process background model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
e_min
|
float
|
The lower bound of the energy range. |
required |
e_max
|
float
|
The upper bound of the energy range. |
required |
n_nodes
|
int
|
The number of nodes used by the GP, must be lower than the number of channel. |
30
|
kernel
|
Kernel
|
The kernel used by the GP. |
Matern52
|
Source code in src/jaxspec/model/background.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
SubtractedBackground
¶
Bases: BackgroundModel
Define a model where the observed background is simply subtracted from the observed.
Danger
This is not a good way to model the background, as it does not account for the fact that the measured
background is a Poisson realisation of the true background's countrate. This is why we prefer a
[ConjugateBackground
][jaxspec.model.background.ConjugateBackground].
Source code in src/jaxspec/model/background.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|