dddm package

Subpackages

Submodules

dddm.context module

Setup the file structure for the software. Specifies several folders: software_dir: path of installation

dddm.context.base_context()[source]

dddm.priors module

dddm.priors.get_priors(priors_from='Evans_2019')[source]
Returns:

dictionary of priors, type and values

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
check_spectrum()[source]

Lazy alias for eval_spectrum

property density: Union[int, float]
eval_benchmark()[source]
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

get_logger(tmp_folder, verbosity)[source]
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:

read_priors_mean(prior_name) Union[int, float][source]
set_benchmark()[source]

Set up the benchmark used in this statistical model. Likelihood of other models can be evaluated for this ‘truth’

set_fit_parameters(params)[source]

Write the fit parameters to the config

set_models()[source]

Update the dm model with with the required settings from the prior

total_log_prior(parameter_vals, parameter_names)[source]

For each of the parameter names, read the prior

Parameters:
  • parameter_vals – the values of the model/benchmark considered as the truth

  • parameter_names – the names of the parameter_values

Returns:

property v_0: Union[int, float]
property v_esc: Union[int, float]

dddm.test_utils module

dddm.test_utils.test_context()[source]

just returns the base contexts, might be different one day

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.is_installed(module)[source]

Try to import <module>, return False if not installed

dddm.utils.is_windows()[source]
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

dddm.utils.to_str_tuple(x: Union[str, bytes, list, tuple, Series, ndarray]) Tuple[str][source]

Convert any sensible instance to a tuple of strings stolen from https://github.com/AxFoundation/strax/blob/d3608efc77acd52e1d5a208c3092b6b45b27a6e2/strax/utils.py#242

Module contents