model
Model(name, coeff_prefactor, coeff_func, F_med_prop=None, ref_cross_sect=None, S_chi=0.5, shortname=None)
A class representing a model for dark matter scattering. See the benchmark models for examples on how to define a model.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the model. |
coeff_prefactor |
dict
|
A dictionary of coefficient prefactors (constants). |
coeff_func |
dict
|
A dictionary of coefficient functions of the form (grid, m_chi, S_chi) -> np.array. |
F_med_prop |
Callable[[SphericalGrid], array]
|
The mediator propagator |
power_V |
int
|
The power V |
S_chi |
float
|
The value of S_chi. |
operators |
dict
|
A dictionary of operators. |
particles |
dict
|
A dictionary of particles. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the model. |
required |
coeff_prefactor |
dict
|
A dictionary of coefficient prefactors. |
required |
coeff_func |
dict
|
A dictionary of coefficient functions. |
required |
F_med_prop |
Callable[[SphericalGrid], array] | None
|
A function that calculates the medium flux property. Defaults to None. |
None
|
ref_cross_sect |
Callable[[array], array] | None
|
A function that calculates the reference cross section. Defaults to None. |
None
|
S_chi |
float
|
DM spin, 1/2 by default. |
0.5
|
shortname |
str
|
The short name of the model, used in the output filenames. Defaults to lowercase initials of the model name. |
None
|
Source code in darkmagic/model.py
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
get_unscreened_coeff(alpha, psi, grid, m_chi, S_chi)
Get the unscreened coefficient for a given (alpha, psi) pair.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alpha |
str
|
The operator ID. |
required |
psi |
str
|
The particle. |
required |
grid |
SphericalGrid
|
The spherical grid. |
required |
m_chi |
float
|
The dark matter mass. |
required |
S_chi |
float
|
The dark matter spin. |
required |
Returns:
Type | Description |
---|---|
float
|
The unscreened coefficient \(c_{lpha}^{(\psi)}\). |
Source code in darkmagic/model.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
compute_screened_coeff(grid, epsilon, m_chi, S_chi)
Compute the screened coefficients for every (operator, particle) pair.
The screening of electron coefficients is done according to $$ c^{(e)}{\alpha} \rightarrow \frac{c^{(e)}{\alpha}}{\hat{q} \cdot (\epsilon \hat{q})} $$ and the proton coefficients $$ c^{(p)}{\alpha} \rightarrow c^{(p)}{\alpha} + c^{(e)}_{\alpha} \left( 1 - \frac{1}{\hat{q} \cdot (\epsilon \hat{q})} \right) $$
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grid |
SphericalGrid
|
The SphericalGrid object containing all the momentum transfer vectors. |
required |
epsilon |
array
|
The dielectric tensor. |
required |
m_chi |
float
|
The dark matter mass. |
required |
S_chi |
float
|
The dark matter spin. |
required |
Returns:
Type | Description |
---|---|
dict
|
A dictionary of the screened coefficients, indexable as [alpha][psi], with each element being a np.array of shape (nq,). |
Source code in darkmagic/model.py
127 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 166 167 168 |
|
Potential(model)
Class for evaluating the potential for a given model.
TODO: needs a good bit of cleanup and rethinking. Maybe this should be a subclass of model? TODO: all terms except V1_00 are written correctly but don't work with an array of q's as they should. (Painful) work in progress.
Attributes:
Name | Type | Description |
---|---|---|
operators |
set
|
The set of operators. |
particles |
set
|
The set of particles. |
c |
Callable[[SphericalGrid, array, float, float], array]
|
The function to compute the screened coefficients. |
needs_g1 |
bool
|
Whether the G1 velocity integrals are needed. |
needs_g2 |
bool
|
Whether the G2 velocity integrals are needed. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Model
|
The model for which to evaluate the potential. |
required |
Source code in darkmagic/model.py
259 260 261 262 263 264 265 266 267 268 |
|
eval_V(grid, material, m_chi, S_chi)
Evaluate the full potential V_j(q) for the given grid and material
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grid |
SphericalGrid
|
The grid of momentum transfer vectors. |
required |
material |
Material
|
The material object |
required |
m_chi |
float
|
The dark matter mass. |
required |
S_chi |
float
|
The dark matter spin. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary of the potential terms, indexed by the term type. |
Source code in darkmagic/model.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
|
MissingCoefficientFunctionException
Bases: Exception
Raised when an operator has a non-zero coefficient prefactor but no coefficient function.
ExtraCoefficientFunctionWarning
Bases: Warning
Warning that an operator has a coefficient function but no non-zero coefficient prefactor, so the operator will be ignored.
UnsupportedOperatorException
Bases: Exception
Raised when an operator is not supported.