Update docs and TODOs for CLI & plot improvements

- README.md: Add features for plot modes, traceability, debug workflow
- README.md: Update BetaSpectrumAnalyzer docs with show_components param
- README.md: Update Quick Start with both plot modes
- README.md: Add output/ to project structure
- TODO.md: Mark B8.4 plot output as completed
- TODO.md: Update Current Status with B8.4
This commit is contained in:
2026-05-05 14:35:11 +03:00
parent 5ac004352b
commit 4a3d31de83
2 changed files with 17 additions and 5 deletions
+13 -4
View File
@@ -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 - Selective inclusion of higher-order corrections via `SpectrumConfig` toggles
- Clean, composable component architecture - Clean, composable component architecture
- Built-in visualization and CSV export via `BetaSpectrumAnalyzer` - 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/) - 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/ └── data/
├── exchange_coeff.csv # Tabulated coefficients for X(Z,W), Z=2..120 ├── exchange_coeff.csv # Tabulated coefficients for X(Z,W), Z=2..120
└── custom_input_example.json # Sample JSON input file └── 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: Also in `spectrum.py`. Provides debugging and visualization tools:
- `total_spectrum(normalize=True/False)` — computed spectrum array - `total_spectrum(normalize=True/False)` — computed spectrum array
- `plot_analysis(save_path=None)` — 4-panel matplotlib figure (spectrum, components, cumulative effect, deviations from unity) - `plot_analysis(save_path=None, show_components=True)` — plot with two modes:
- `export_to_csv(filename)` — export via pandas DataFrame - `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 - `get_data()` — return all numerical data for custom analysis
______________________________________________________________________ ______________________________________________________________________
@@ -128,8 +136,9 @@ W, E_MeV = spectrum.get_energy_grid(config)
values = spectrum(W) values = spectrum(W)
analyzer = BetaSpectrumAnalyzer(spectrum, config) analyzer = BetaSpectrumAnalyzer(spectrum, config)
analyzer.plot_analysis() # Show/ save 4-panel figure analyzer.plot_analysis("analysis.png") # Normal mode (single spectrum plot)
analyzer.export_to_csv("output.csv") # Export data to CSV analyzer.plot_analysis("debug.png", show_components=True) # Debug mode (4-panel)
analyzer.export_to_csv("spectrum.csv") # Export data to CSV
``` ```
______________________________________________________________________ ______________________________________________________________________
+4 -1
View File
@@ -180,6 +180,9 @@ ______________________________________________________________________
- [x] Add `-q/--quiet` flag to suppress terminal output - [x] Add `-q/--quiet` flag to suppress terminal output
- [x] Add `./output/` directory for debug verification artifacts (gitignored except `.gitkeep`) - [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 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\ **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. **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). **Next immediate step:** A3 — data processing pipeline for experimental spectra (background subtraction, energy calibration, dead-time correction, pulse pile-up correction).