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
+86
View File
@@ -0,0 +1,86 @@
#!/usr/bin/env python3
"""
Script to run Pr144 -> Nd144 beta decay calculations for neutrino mass range 1.5-2.5 keV
"""
import subprocess
import os
# Create output directory
output_dir = "/home/unzhakov/workspace/massive_nu_pr"
os.makedirs(output_dir, exist_ok=True)
# Neutrino mass range: 1.5 to 2.5 keV with step of 50 eV
# Convert to MeV: 1.5 keV = 0.0015 MeV, 2.5 keV = 0.0025 MeV, 50 eV = 0.00005 MeV
start_mass_meV = 1.5 # keV
end_mass_meV = 2.5 # keV
step_mass_meV = 0.05 # keV (50 eV)
# Convert to MeV
start_mass_MeV = start_mass_meV / 1000.0
end_mass_MeV = end_mass_meV / 1000.0
step_mass_MeV = step_mass_meV / 1000.0
# Energy step: 100 eV = 0.0001 MeV
e_step_MeV = 0.0001
# Intensity cutoff: 0.001
intensity_cutoff = 0.001
# Generate neutrino mass values
mass_values = []
mass = start_mass_MeV
while mass <= end_mass_MeV:
mass_values.append(mass)
mass += step_mass_MeV
print(f"Running calculations for {len(mass_values)} neutrino mass values...")
print(
f"Neutrino mass range: {start_mass_meV} - {end_mass_meV} keV with step {step_mass_meV} keV"
)
print(f"Energy step: {e_step_MeV * 1000} eV")
print(f"Intensity cutoff: {intensity_cutoff}")
# Run calculations for each neutrino mass
for i, mass_MeV in enumerate(mass_values):
mass_keV = mass_MeV * 1000.0
print(
f"\n[{i + 1}/{len(mass_values)}] Calculating for neutrino mass = {mass_keV:.2f} keV ({mass_MeV:.6f} MeV)"
)
# Generate filename
mass_str = f"{mass_keV:.2f}".replace(".", "_")
csv_filename = f"{output_dir}/pr144_nu_mass_{mass_str}keV.csv"
png_filename = f"{output_dir}/pr144_nu_mass_{mass_str}keV.png"
# Command to run
cmd = [
"python",
"-m",
"beta_spectrum.cli",
"--nuclide",
"Pr144",
"--neutrino-mass",
str(mass_MeV),
"--e-step",
str(e_step_MeV),
"--intensity-cutoff",
str(intensity_cutoff),
"--output",
csv_filename,
"--plot",
png_filename,
"-q", # quiet mode
]
print(f"Running: {' '.join(cmd)}")
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
print(f"Error in calculation for mass {mass_keV:.2f} keV:")
print(f"stdout: {result.stdout}")
print(f"stderr: {result.stderr}")
else:
print(f"Successfully completed calculation for mass {mass_keV:.2f} keV")
print("\nAll calculations completed!")