feat(cli): report core in dry-run, build plots from exported CSV

This commit is contained in:
2026-09-30 03:04:18 +03:00
parent afb7afc5b7
commit 7dc2ec79d1
+13 -6
View File
@@ -40,7 +40,6 @@ def _build_parser() -> argparse.ArgumentParser:
" bs_pnpi --nuclide Tc99 --output spectrum.csv\n"
" bs_pnpi --input custom_input.json --output spectrum.csv\n"
" bs_pnpi --nuclide Tc99 --plot spectrum.png --output spectrum.csv\n"
" bs_pnpi --nuclide Tc99 --detector gaussian --output convolved.csv\n"
" bs_pnpi --nuclide Tc99 --output spectrum.csv -vv --log-file /tmp/calc.log\n"
" bs_pnpi --nuclide Tc99 --dry-run\n"
),
@@ -326,9 +325,20 @@ def _run(args: argparse.Namespace) -> None:
)
logger.info("Spectrum exported to %s", args.output)
# Generate plot
# Generate plot — always built from the exported CSV data (single
# source of truth): when a full-verbosity CSV was exported it is
# plotted directly from that file, otherwise via a temporary export.
if args.plot:
analyzer = BetaSpectrumAnalyzer(spectrum, config, logger=logger)
if args.output and args.csv_verbosity == "full":
from beta_spectrum.output.visualization import Visualizer
Visualizer.plot_from_csv(
args.output,
save_path=args.plot,
show_components=(args.verbose >= 2),
)
else:
analyzer.plot_analysis(
save_path=args.plot,
show_components=(args.verbose >= 2),
@@ -342,11 +352,8 @@ def _print_dry_run_output(config, source_type: str) -> None:
"""Print resolved configuration for dry-run mode."""
from beta_spectrum.logging_utils import get_git_short_hash
print("Core: phase_space × fermi (basic spectrum, always included)")
enabled = []
if config.use_phase_space:
enabled.append("phase_space")
if config.use_fermi:
enabled.append("fermi")
if config.use_screening:
enabled.append("screening")
if config.use_finite_size: