Add massive neutrino support and improve CSV/CLI output

- Add neutrino mass parameter to SpectrumConfig and CLI interface
- Update PhaseSpace component to handle neutrino mass effects properly
- Update CSV headers to show basic endpoint and all transition types
- Add --csv-verbosity option to CLI with 'full' and 'concise' options
- Fix comparison plots to properly show linear scale variations
- Add comprehensive tests for neutrino mass functionality
This commit is contained in:
2026-07-02 10:33:28 +03:00
parent 406fd57bcd
commit 876e1e3ab8
48 changed files with 5213 additions and 97 deletions
+9 -7
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple
from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass
import numpy as np
@@ -15,7 +15,6 @@ from beta_spectrum.components.screening import ScreeningCorrection
from beta_spectrum.components.exchange import ExchangeCorrection
from beta_spectrum.components.radiative import RadiativeCorrection
from beta_spectrum.utils import T_to_W
from beta_spectrum.constants import ME_MEV
@dataclass
@@ -71,6 +70,7 @@ class SpectrumConfig:
endpoint_MeV: float
transition_type: str = "A" # should be [A, F1, F1U, F2, F2U, F3, F3U, F4]
e_step_MeV: float = 0.001
neutrino_mass_MeV: float = 0.0
# Toggle components and corrections
use_phase_space: bool = True
@@ -251,7 +251,12 @@ class BetaSpectrum:
if config.use_phase_space:
components.append(
PhaseSpace(W0=W0, transition_type=config.transition_type, logger=logger)
PhaseSpace(
W0=W0,
transition_type=config.transition_type,
m_nu=config.neutrino_mass_MeV,
logger=logger,
)
)
if config.use_fermi:
@@ -331,6 +336,7 @@ class BetaSpectrum:
endpoint_MeV=branch.endpoint_MeV,
transition_type=branch.transition_type,
e_step_MeV=config.e_step_MeV,
neutrino_mass_MeV=config.neutrino_mass_MeV,
# Branch-dependent components
use_phase_space=config.use_phase_space,
use_radiative=config.use_radiative,
@@ -451,7 +457,3 @@ class BetaSpectrum:
branch_spectrum = branch_spec(W)
result.append(self.branches[i].intensity * np.maximum(0.0, branch_spectrum))
return result