primat.config — configuration and defaults

config.py

Central configuration for primat.

Physical constants and derived unit conversions are fixed and computed once here. All run-time flags and cosmological/nuclear parameters are carried in a PRIMATConfig instance and can be overridden by passing a parameter dictionary to PRIMATConfig(params).

No file I/O happens here. Nuclear rate data are loaded separately in nuclear_data.py.

class primat.config.PRIMATConfig(params=None)[source]

Bases: object

Immutable physical constants + mutable run-time parameters.

Usage:

cfg = PRIMATConfig()                    # all defaults
cfg = PRIMATConfig({"Omegabh2": 0.022, "network": "large", "amax": 8})

After construction every key in DEFAULT_PARAMS is an attribute, plus all physical constants listed below.

Parameters:

params (dict | None)

property is_small: bool

True if using the ‘small’ network.

property is_large: bool

True if using the ‘large’ network.

property xi_nu_e: float

Effective reduced chemical potential xi_e = mu_{nu_e}/T of nu_e.

Returns munuOverTnu_e if the user set it, else falls back to the common munuOverTnu. This is the ONLY flavour that shifts the n<->p weak rates (via the FD_nu3 integrand in weak_rates), so it is also the one carried in the weak-rate cache fingerprint.

property xi_nu_mu: float

Effective reduced chemical potential xi_mu of nu_mu (munuOverTnu_mu or, if None, munuOverTnu). nu_mu only gravitates: it enters the neutrino energy density / Neff (Plasma.rho_nu) but not the weak rates.

property xi_nu_tau: float

Effective reduced chemical potential xi_tau of nu_tau (munuOverTnu_tau or, if None, munuOverTnu). Like nu_mu, nu_tau only gravitates (energy density / Neff), with no n<->p weak-rate effect.

Kelvin = 1.0
second = 1.0
cm = 1.0
gram = 1.0
erg = 1.0
kB = 1.380649e-16
clight = 29979245800.0
hbar = 1.0545718176461565e-27
Mpc = 3.08567758149e+24
MeV = 1.602176634e-06
keV = 1.602176634e-09
alphaem = 0.0072973525692838015
GF = 1.1663786999999999e-11
mZ = 91187.6
me = 0.51099895
mn = 939.56542052
mp = 938.27208816
T0CMB = 2.7255
MeV_to_Kelvin = 11604518121.550083
MeV_to_secm1 = 1.519267447878626e+21
MeV_to_g = 1.7826619216278976e-27
MeV_to_cmm1 = 50677307161.56396
MeV4_to_gcmm3 = 232011.5348269848
T_start = 116045181215.50082
T_weak = 11604518121.550083
T_nucl = 1276496993.3705091
sW2 = np.float64(0.21215165647076067)
geL = np.float64(0.7121516564707606)
geR = np.float64(0.21215165647076067)
gmuL = np.float64(-0.2878483435292393)
gmuR = np.float64(0.21215165647076067)
gA = 1.2756
kappa_p = 1.7928473446300002
kappa_n = -1.91304273
deltakappa = 3.70589007463
Vud = 0.9738
radproton = 8.409e-14
s0bar = 0.8772981689857207
s0CMB = 1.1365916178018472e-29
n0CMB = np.float64(3.155822026400018e-30)
ma = 931.494061
He4Overma = 4.0026032541
HOverma = 1.00782503223
Neff_SM = 3.044
mB = 937.132394746721
maOvermB = 0.9939834181612675
HubbleOverh = 2.1331196781520894e-39
property T_start_cosmo: float
property T_end: float

End temperature for nuclear integration [K].

Set via T_end_MeV [MeV] in DEFAULT_PARAMS (default 0.001 MeV, i.e. the standard BBN endpoint at ~11.6 MK / ~1.3×10^6 s). Making it configurable allows extending the integration into the Decay Time era (decay_era=True) or performing custom post-BBN analysis at lower temperatures.

The default 0.001 MeV (≈ 11.6 MK, cosmic time ≈ 1.3×10⁶ s ≈ 15 days) is the standard end point of BBN integration.

Example:

# Extend BBN integration to 0.0001 MeV (10× lower than default):
cfg = PRIMATConfig({"T_end_MeV": 1e-4})
property Mpl: float
property rhocOverh2: float
property Omegabh2: float
Nuclides: dict[str, list[int]] = {}
NuclExcessMass: dict[str, float] = {}
NuclSpin: dict[str, float] = {}
resolve_rates_path(*parts)[source]

Resolve a path inside the nuclear data tree through the overlay chain.

Used by every caller that needs a nuclear network file or rate-table file, so a user’s user_nuclear_dir additive overlay (or a full data_dir takeover — see those fields in DEFAULT_PARAMS) is honoured without touching the installed primat package.

Lookup order (first existing path wins):
  1. self.user_nuclear_dir (additive nuclear overlay), if set.

  2. self._resolved_data_dir (either the user-supplied data_dir or the shipped primat/data/ tree — always tried last so small/large and the default rate tables are never unreachable just because user_nuclear_dir is also configured).

If the relative path is not found under any candidate base, the resolved-default path is returned anyway (not found), so callers get a “missing file” error that points at the expected default location rather than at whichever overlay happened to be checked last.

Parameters:

*parts (str) – path components relative to a nuclear data root, e.g. "nuclear", "networks", "large.txt".

Returns:

str – an absolute path (existing, if found under any candidate base; otherwise the resolved-default path, for use in error messages).

Return type:

str

Example

>>> cfg.resolve_rates_path("nuclear", "networks", "large.txt")
'/.../primat/data/nuclear/networks/large.txt'