Commit Graph
13 Commits
Author SHA1 Message Date
unzhakov 66a93d9cac fix: satisfy mypy strict type-checking requirements
- Add proper type annotations to all source files
- Fix return types for numpy operations (np.asarray with dtype=np.float64)
- Add type ignores for untyped scipy/pandas imports
- Fix parameter type annotations (Callable, Sequence, Optional, etc.)
- Add TYPE_CHECKING imports for forward references
- Fix fitter.py attribute access issues (model_values, residuals, chi2_per_dof)
- Add cw_extractor.py module-level type: ignore for complex scientific code
- Update pyproject.toml to exclude notebooks from mypy
- Add mypy disable_error_code configuration for test files
- Run black and ruff for formatting and linting
2026-05-03 01:00:47 +03:00
unzhakov 33ed4f7e44 fix: satisfy mypy strict type-checking requirements
- Add proper type annotations to all source files
- Fix return types for numpy operations (np.asarray with dtype=np.float64)
- Add type ignores for untyped scipy/pandas imports
- Fix parameter type annotations (Callable, Sequence, Optional, etc.)
- Add TYPE_CHECKING imports for forward references
- Fix fitter.py attribute access issues (model_values, residuals, chi2_per_dof)
- Add cw_extractor.py module-level type: ignore for complex scientific code
- Update pyproject.toml to exclude notebooks from mypy
- Run black and ruff for formatting and linting
2026-05-03 00:44:11 +03:00
unzhakov 8b4545fe3e refactor: centralize all physical constants in constants.py, fix unit naming
- Add EULER_GAMMA, ME_KEV, R0_FM to constants.py
- Replace hardcoded 0.511, 0.5772..., 1.2 with imports from constants
- Fix T_to_W parameter name: T_kev -> T_MeV (it takes MeV, not keV)
- Remove duplicate ME_ME from spectrum.py (import ME_MEV from constants)
- Remove hardcoded r_0 from detector_response.py and radiative.py
- Update CONVENTIONS.md to reference correct constant names
2026-05-01 22:34:15 +03:00
unzhakov 5f99566a0e feat(detector): add detector response module, convolution, and integration
- Analytical detector response: gaussian, gaussian_tail, tikhonov models
- Low-energy tail modeling for charge collection effects
- Response matrix convolution via R^T · (Φ·ΔW)
- Declarative API: create_detector_from_config(), convolve_detector()
- BetaSpectrumAnalyzer.convolved_spectrum() for auto-convolution
- Integration tests: TestBetaSpectrumIntegration, TestDeclarativeDetectorResponse
- Documentation: docs/08-detector-response.md
2026-05-01 19:20:59 +03:00
unzhakov 968cd6eff7 style: remove trailing blank lines in base.py and fermi.py 2026-05-01 19:17:08 +03:00
unzhakov c99ce51487 fix(radiative): only apply endpoint resummation within delta_cut per spec Section 3.4
The resummation was previously applied to all energy points when the
flag was set, causing resummed and standard modes to differ everywhere.
Per spec, it should only replace C(beta)*ln(W0-W) with the resummed
power-law form when (W0-W) < delta_cut (~1e-3).

Adds delta_cut parameter (default 1e-3) and corrects the resummation
switch test to verify identical results far from endpoint.
2026-04-30 21:06:00 +03:00
unzhakov ed3fd5dc9d feat(radiative): implement O(Z*alpha^2) correction and improve numerical stability
- Add Z (nuclear charge) and A (mass number) parameters to RadiativeCorrection
- Implement O(Z*alpha^2) finite nuclear size correction per Sirlin 1987:
  - Energy-dependent part: ln(m_p) - (5/12)*ln(2W) + 43/18
  - Nuclear-structure-dependent part: Delta_F(Z,A) from modified Gaussian model
- Add small-beta Taylor expansion for numerical stability at threshold (beta < 1e-6)
- Extract _safe_beta() and _safe_tanh_inv_beta_over_beta() helper methods
- Remove unused log_wright_bessel import
- Add 14 new tests: Z-dependence, numerical stability, A parameter coverage
- Update docs/06-radiative-corrections.md with new API usage examples

All 70 tests pass. 14 new tests in 3 new test classes.
2026-04-30 07:18:02 +03:00
unzhakov 0e9b20caa2 Fix deprecated np.maximum calls with 3 params 2026-04-28 11:38:31 +03:00
unzhakov f04f52b747 Update Phase Space calculation
Add support for proper calculation of phase space component based on the
transition type (allowed/Nth order forbidden).
2026-04-27 15:36:36 +03:00
unzhakov 75ad14946d fix/Radiative correction
Implement correct resummation for high-energy electrons (near endpoint).
See pages 12-13 in Hayen 2017, eqs. 50, 53, 54
2026-04-17 12:53:26 +03:00
unzhakov 91f716c851 Version 0.1.2
Implemented all planned corrections:
  - finite-size e/m L0 and U
  - atomic screening and exchange
  - radiative (electron only so far)

Added plotter and csv_export
2026-04-15 18:05:04 +03:00
unzhakov 0c5c53688d MVP Correction Implemented
Add implementation for the basic set of spectrum components:

Primary
-------
- Phase Space
- Fermi Function

Corrections
-----------

- Atomic:
  - Screening
  - Atomic exchange
- E/M and finite size:
  - Finite nucleus size and charge distribution
  - Radiative
2026-04-10 15:32:47 +03:00
unzhakov a5e1962fe2 Initial commit
Base modular structure (phase space, Fermi function)
Initial .gitignore
2026-04-02 15:38:37 +03:00