dddm package
Subpackages
Submodules
dddm.context module
Setup the file structure for the software. Specifies several folders: software_dir: path of installation
dddm.priors module
dddm.statistics module
Statistical model giving likelihoods for detecting a spectrum given a benchmark to compare it with.
- class dddm.statistics.StatModel(wimp_mass: Union[float, int], cross_section: Union[float, int], spectrum_class: Union[DetectorSpectrum, GenSpectrum], prior: dict, tmp_folder: str, fit_parameters=('log_mass', 'log_cross_section', 'v_0', 'v_esc', 'density', 'k'), detector_name=None, verbose=False, notes='default')[source]
Bases:
object- allow_multiple_detectors = False
- property bench_is_set
- benchmark_values = None
- eval_spectrum(values: Union[list, tuple, ndarray], parameter_names: Union[List[str], Tuple[str]])[source]
For given values and parameter names, return the spectrum one would have with these parameters. The values and parameter names should be array like objects of the same length. Usually, one fits either two (‘log_mass’, ‘log_cross_section’) or five parameters (‘log_mass’, ‘log_cross_section’, ‘v_0’, ‘v_esc’, ‘density’). :param values: array like object of :param parameter_names: names of parameters :return: a spectrum as specified by the parameter_names
- known_parameters = ('log_mass', 'log_cross_section', 'v_0', 'v_esc', 'density')
- property log_cross_section
- property log_mass
- log_prior(value, variable_name)[source]
Compute the prior of variable_name for a given value :param value: value of variable name :param variable_name: name of the ‘value’. This name should be in the config of the class under the priors with a similar content as the priors as specified in the get_prior function. :return: prior of value
- log_probability(parameter_vals, parameter_names)[source]
- Parameters
parameter_vals – the values of the model/benchmark considered as the truth
parameter_names – the names of the parameter_values
- Returns
- set_benchmark()[source]
Set up the benchmark used in this statistical model. Likelihood of other models can be evaluated for this ‘truth’
dddm.test_utils module
dddm.utils module
Basic functions for saving et cetera
- dddm.utils.deterministic_hash(thing, length=10)[source]
Return a base32 lowercase string of length determined from hashing a container hierarchy
- dddm.utils.exporter(export_self=False)[source]
Export utility modified from https://stackoverflow.com/a/41895194 Returns export decorator, __all__ list stolen from https://github.com/AxFoundation/strax/blob/d3608efc77acd52e1d5a208c3092b6b45b27a6e2/strax/utils.py#46
- dddm.utils.print_versions(modules=('dddm', 'numpy', 'numba', 'wimprates'), print_output=True, include_python=True, return_string=False, include_git=True)[source]
Print versions of modules installed.
- Parameters
modules – Modules to print, should be str, tuple or list. E.g. print_versions(modules=(‘numpy’, ‘dddm’,))
return_string – optional. Instead of printing the message, return a string
include_git – Include the current branch and latest commit hash
- Returns
optional, the message that would have been printed