diff --git a/README.md b/README.md index 61f5712..e796cf3 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,11 @@ A modular Python package for calculating high-precision **beta decay energy spec - Selective inclusion of higher-order corrections via `SpectrumConfig` toggles - Clean, composable component architecture - Built-in visualization and CSV export via `BetaSpectrumAnalyzer` + - Normal mode: single spectrum plot with nuclear data header + - Debug mode (`-vv`): 4-panel view with all correction factors + - All plots include commit hash and UTC timestamp for traceability - Comprehensive scientific reference in [`docs/`](docs/) +- Debug verification workflow: `bs_pnpi -vv` validates all parameters end-to-end ______________________________________________________________________ @@ -74,6 +78,7 @@ beta_shape_pnpi/ └── data/ ├── exchange_coeff.csv # Tabulated coefficients for X(Z,W), Z=2..120 └── custom_input_example.json # Sample JSON input file +├── output/ # Test run outputs (gitignored except .gitkeep) ``` ______________________________________________________________________ @@ -104,8 +109,11 @@ Defined in `beta_spectrum/spectrum.py`. Orchestrates the calculation: Also in `spectrum.py`. Provides debugging and visualization tools: - `total_spectrum(normalize=True/False)` — computed spectrum array -- `plot_analysis(save_path=None)` — 4-panel matplotlib figure (spectrum, components, cumulative effect, deviations from unity) -- `export_to_csv(filename)` — export via pandas DataFrame +- `plot_analysis(save_path=None, show_components=True)` — plot with two modes: + - `show_components=True` (debug mode): 4-panel figure (spectrum, components, cumulative effect, deviations) + - `show_components=False` (normal mode): single spectrum plot with nuclear data header + - All plots include commit hash and UTC timestamp for traceability +- `export_to_csv(filename)` — export via pandas DataFrame with YAML-style metadata header - `get_data()` — return all numerical data for custom analysis ______________________________________________________________________ @@ -128,8 +136,9 @@ W, E_MeV = spectrum.get_energy_grid(config) values = spectrum(W) analyzer = BetaSpectrumAnalyzer(spectrum, config) -analyzer.plot_analysis() # Show/ save 4-panel figure -analyzer.export_to_csv("output.csv") # Export data to CSV +analyzer.plot_analysis("analysis.png") # Normal mode (single spectrum plot) +analyzer.plot_analysis("debug.png", show_components=True) # Debug mode (4-panel) +analyzer.export_to_csv("spectrum.csv") # Export data to CSV ``` ______________________________________________________________________ diff --git a/TODO.md b/TODO.md index c65bf0f..2716513 100644 --- a/TODO.md +++ b/TODO.md @@ -180,6 +180,9 @@ ______________________________________________________________________ - [x] Add `-q/--quiet` flag to suppress terminal output - [x] Add `./output/` directory for debug verification artifacts (gitignored except `.gitkeep`) - [x] Add debug verification step to development workflow: `bs_pnpi -vv` with parameter consistency checks across all components, documented in DEVELOPMENT.md §4.5 +- [x] Add plot output with ID tracking (commit hash + UTC timestamp) and two display modes: + - Normal mode (default): single spectrum plot with nuclear data header + - Debug mode (-vv): 4-panel view with all correction factors and deviations ______________________________________________________________________ @@ -207,6 +210,6 @@ ______________________________________________________________________ **Version:** 0.3.0\ **Implemented:** Phase space, Fermi function, finite size, screening, exchange, radiative corrections (with delta_cut resummation). Detector response module with analytical models (Gaussian, Gaussian+tail, Tikhonov), convolution API, declarative config integration. χ² curve fitting framework (CurveFitter) with confidence intervals, profile likelihood, and correlation analysis. C(W) shape factor extraction pipeline (CWExtractor) with Kurie plot analysis, parametrized fitting, and g_V/g_A extraction. CLI interface (`bs_pnpi`) with paceENSDF integration, structured logging (-v/-vv/-q), --dry-run, --version, --log-file. CSV metadata headers. JSON input with full detector param support. Comprehensive test suite (195 tests). Notebook quality control with nbmake and auto-save plot hooks. -**Completed:** A2 — detector response function and convolution routines. A4 — fitter routine and C(W) extraction pipeline. B2 — input flexibility (JSON input, ENSDF auto-population). B8 — CLI & output improvements (logging, CSV headers, dry-run, version). B8.2 — CLI refinement: removed --mode, --transition-type, --decay-index flags; clarified units (MeV everywhere); enhanced logging (INFO shows components, DEBUG shows internals); CSV headers use element notation (Tc99 -> Ru99). B8.3 — debug verification framework: `./output/` directory for artifacts, development workflow step 4.5 with `-vv` parameter consistency checks across all components. +**Completed:** A2 — detector response function and convolution routines. A4 — fitter routine and C(W) extraction pipeline. B2 — input flexibility (JSON input, ENSDF auto-population). B8 — CLI & output improvements (logging, CSV headers, dry-run, version). B8.2 — CLI refinement: removed --mode, --transition-type, --decay-index flags; clarified units (MeV everywhere); enhanced logging (INFO shows components, DEBUG shows internals); CSV headers use element notation (Tc99 -> Ru99). B8.3 — debug verification framework: `./output/` directory for artifacts, development workflow step 4.5 with `-vv` parameter consistency checks across all components. B8.4 — plot output with ID tracking (commit hash + UTC timestamp) and two display modes (normal spectrum plot with nuclear data header; debug 4-panel view with all corrections). **Next immediate step:** A3 — data processing pipeline for experimental spectra (background subtraction, energy calibration, dead-time correction, pulse pile-up correction).