calculator
This module contains the Calculator class, the main class of DarkMAGIC
Calculator(calc_type, m_chi, material, model, numerics, time=None, v_e=None)
A class for calculating rates at a given list of masses and earth velocities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
calc_type |
str
|
The type of calculation, only "scattering" is supported at the moment |
required |
m_chi |
ArrayLike
|
The list of dark matter masses |
required |
material |
Material
|
The material |
required |
model |
Model
|
The model |
required |
numerics |
Numerics
|
The numerical parameters |
required |
time |
ArrayLike
|
The list of times in hours. Defaults to None. |
None
|
v_e |
ArrayLike
|
The list of earth velocities. Defaults to None (i.e., calculate from the tiems) |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If neither time nor v_e are provided |
ValueError
|
If both time and v_e are provided |
Source code in darkmagic/calculator.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
from_file(filename, format='darkmagic')
classmethod
Load a model from a file
Source code in darkmagic/calculator.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
evaluate(mpi=False)
Computes the differential rate for all masses and earth velocities
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mpi |
bool
|
Whether to run the calculation in parallel using MPI. Defaults to False. |
False
|
Source code in darkmagic/calculator.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
to_file(filename=None, format='darkmagic')
Save the rates to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
The name of the file to save to. Defaults to None (i.e., use the default name, {material.name_model.name.h5}). |
None
|
format |
str
|
The format of the file. Defaults to "darkmagic". |
'darkmagic'
|
Source code in darkmagic/calculator.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
compute_ve(times)
staticmethod
Returns the earth's velocity in the lab frame at time t (in hours)
Source code in darkmagic/calculator.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
get_total_rate(threshold_meV)
Computes the total rate for a given threshold
Parameters:
Name | Type | Description | Default |
---|---|---|---|
threshold_meV |
float
|
The detector threshold in meV |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The total rate |
Source code in darkmagic/calculator.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
compute_daily_modulation(threshold_meV=1.0)
Computes the rate \(R\) normalized by the average daily rate \(\langle R \rangle\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
threshold_meV |
float
|
The threshold in meV. Defaults to 1 meV. |
1.0
|
Returns:
Type | Description |
---|---|
array
|
np.array: the normalized rate \(R / \langle R \rangle\), indexed as (time, mass) |
Source code in darkmagic/calculator.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
compute_reach(threshold_meV=1.0, exposure_kg_yr=1.0, n_cut=3.0, model=None, time=0)
Computes the projected reach: the 95% C.L. constraint (3 events, no background) on \(ar{sigma}_n\) or \(ar{sigma}_e\) for a given model, in units of cm2 and normalizing to the appropriate reference cross section.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
threshold_meV |
float
|
The threshold in meV. Defaults to 1 meV. |
1.0
|
exposure_kg_yr |
float
|
The exposure in kg.yr. Defaults to 1 kg.yr |
1.0
|
n_cut |
float
|
The number of events. Defaults to 3. |
3.0
|
model |
str
|
The model to use. Defaults to the model attribute. |
None
|
time |
float | str
|
The time to use. Defaults to 0. |
0
|
Returns:
Type | Description |
---|---|
array
|
np.array: the cross section. |
Source code in darkmagic/calculator.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|