Python package for neutron spectrum unfolding from measurements obtained with Bonner Sphere Spectrometer (BSS)
Project description
BSSunfold - Neutron Spectrum Unfolding Package for Bonner Sphere Spectrometers
🔍 Overview
BSSUnfold is a Python package for neutron spectrum unfolding from measurements obtained with Bonner Sphere Spectrometers (BSS). The package implements several mathematical algorithms for solving the inverse problem of unfolding neutron energy spectra from detector readings, with applications in radiation protection, nuclear physics research, and accelerator facilities.
Contents
- Features
- Installation
- Quick start
- Project structure
- Technical requirements
- Authors
- Citing
- Documentation
- Publications
📦 Features
-
Multiple Unfolding Algorithms:
- Tikhonov regularization with convex optimization (CVXPY)
- Landweber iterative method
- Combined approach for improved accuracy
-
Radiation Dose Calculations:
- Effective dose calculations for different irradiation types based on conversion coefficients from 116 publication of International commission on radiological protection (ICRP)
-
Comprehensive Data Management:
- Automatic response function processing
- Uncertainty quantification via Monte Carlo methods
-
Advanced Visualization:
- Spectrum plotting with uncertainty bands
- Detector reading comparison
📥 Installation
Using uv (recommended)
uv add bssunfold
Using pip
pip install bssunfold
Using conda
conda install conda-forge::bssunfold
From Source
git clone https://github.com/radiationsafety/bssunfold.git
cd bssunfold
pip install -e .
🎯 Quick Start
Open in interactive notebooks:
import pandas as pd
from bssunfold import Detector
# Load response functions
rf_df = pd.read_csv("../data/response_functions/rf_GSF.csv")
# Initialize detector
detector = Detector(rf_df)
# Provide detector readings [reading per second]
readings = {
"0in": 0.0003,
"2in": 0.0099,
"3in": 0.0536,
"5in": 0.1841,
"6in": 0.2196,
"8in": 0.2200,
"10in": 0.172,
"12in": 0.120,
"15in": 0.066,
"18in": 0.034,
}
# Unfold spectrum using convex optimization
result = detector.unfold_cvxpy(
readings,
regularization=1e-4,
calculate_errors=True
)
# Visualize results
detector.plot_with_uncertainty(result, plot_style == 'errorbar')
# Calculate and display dose rates
print("Dose rates [pcSv/s]:", result['doserates'])
📊 Input Data Structure
Response Functions
Response functions must be provided as a CSV file with the following format:
E_MeV,0in,2in,3in,5in,8in,10in,12in
1.00E-09,0.001,0.005,0.01,0.02,0.03,0.04,0.05
1.00E-08,0.002,0.006,0.012,0.022,0.032,0.042,0.052
...
Detector Readings
Readings should be provided as a dictionary mapping sphere names to measured values:
readings = {
'sphere_0in': 150.2, # Bare detector
'sphere_2in': 120.5, # 2-inch polyethylene sphere
'sphere_3in': 95.7, # 3-inch polyethylene sphere
# ... additional spheres
}
⚙️ Available Methods
1. unfold_cvxpy()
Tikhonov regularization with convex optimization for stable spectrum reconstruction.
result = detector.unfold_cvxpy(
readings,
regularization=1e-4, # Regularization parameter
norm=2, # L2 norm for regularization
calculate_errors=True, # Monte Carlo uncertainty estimation
save_result=True # Store result in history
)
2. unfold_landweber()
Iterative Landweber method with convergence control.
result = detector.unfold_landweber(
readings,
max_iterations=1000, # Maximum iterations
tolerance=1e-6, # Convergence tolerance
calculate_errors=True, # Monte Carlo uncertainty
save_result=True
)
3. unfold_mlem_odl()
Iterative Maximum likelihood expectation maximization (MLEM).
result = detector.unfold_mlem_odl(
readings,
max_iterations=1000, # Maximum iterations
calculate_errors=True, # Monte Carlo uncertainty
save_result=True
)
4. unfold_qpsolvers()
Iterative Maximum likelihood expectation maximization (MLEM).
result = detector.unfold_qpsolvers(
readings,
solver="osqp",
regularization=1e-4,
noise_level=noise_level,
n_montecarlo=n_montecarlo,
save_result=False,
calculate_errors=True,
)
5. unfold_doroshenko()
Iterative Doroshenko algorithm.
result = detector.unfold_doroshenko(
readings
)
6. unfold_kaczmarz()
Iterative Kaczmarz algorithm.
result = detector.unfold_kaczmarz(
readings
)
7. unfold_lmfit()
Unfold neutron spectrum using lmfit with L1/L2/Elastic regularization, lmfit solver = leastsq, newton, tnc, cg, bfgs, lbfgsb. Regularization model: elastic, lasso, ridge, default: "elastic".
result = detector.unfold_lmfit(
readings
)
8. unfold_combined()
Combination (pipeline) of algorithms cvxpy → Landweber with selection of parameters for each method.
result = det.unfold_combined(
readings=readings,
pipeline=[
{
'method': 'cvxpy',
'params': {'regularization': 1e-4},
},
{
'method': 'landweber',
'params': {
'max_iterations': 2000,
},
},
],
calculate_errors=False,
verbose=True,
)
📈 Output Data
The package provides comprehensive output in standardized formats:
Spectrum Results
- Energy grid in MeV
- Unfolded neutron spectrum for the grid of energy bins
- Uncertainty estimates (if calculated)
Dose Calculations
- Effective dose rates for different geometries:
- AP (Anterior-Posterior)
- PA (Posterior-Anterior)
- LLAT (Left Lateral)
- RLAT (Right Lateral)
- ROT (Rotational)
- ISO (Isotropic)
Quality Metrics
- Residual norm
- Iteration counts
📝 Application Areas
Nuclear Research Facilities
- Neutron spectroscopy at particle accelerators
- Reactor neutron field characterization
- Fusion device diagnostics
Radiation Protection
- Workplace monitoring at nuclear power plants
- Medical accelerator facilities
- Industrial radiography installations
Scientific Research
- Space radiation studies
- Cosmic ray neutron measurements
- Nuclear physics experiments
🔬 Advanced Features
Result Management
# List all saved results
results = detector.list_results()
print(f"Available results: {results}")
# Retrieve specific result
result = detector.get_result('20240115_143022_cvxpy')
# Create comprehensive report
report = detector.create_summary_report(
save_path='unfolding_report.json'
)
# Clear results history
detector.clear_results()
Custom Uncertainty Analysis
# Custom Monte Carlo parameters
result = detector.unfold_cvxpy(
readings,
calculate_errors=True,
n_montecarlo=500, # Number of samples
noise_level=0.02 # 2% measurement noise
)
# Access uncertainty data
uncert_mean = result['spectrum_uncert_mean']
📂 Project Structure
bssunfold/
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── data
│ └── response_functions
│ └── rf_GSF.csv
├── docs
│ ├── conf.py
│ ├── detector.rst
│ ├── examples.rst
│ ├── index.rst
│ ├── make.bat
│ ├── makefile
│ └── requirements.txt
├── examples
├── favicon.ico
├── LICENSE
├── pyproject.toml
├── README.md
├── requirements.txt
├── src
│ └── bssunfold
│ ├── constants.py
│ ├── detector.py
│ ├── __init__.py
├── tests
│ ├── __init__.py
│ └── test_detector.py
└── uv.lock
🔧 Technical Requirements
Requirements
- Python 3.11 - 3.13
- cvxpy[ecos]
- NumPy
- SciPy
- Pandas
- Matplotlib
- odl
- qpsolvers with open source solvers
- pytikhonov
- lmfit
Available package versions see in pyproject.toml.
Performance
- Matrix Operations: Optimized NumPy operations for response matrices
📖 Citation
If you use BSSUnfold in your research, please cite paper:
@article{chizhov2024neutron,
title={Neutron spectra unfolding from Bonner spectrometer readings by the regularization method using the Legendre polynomials},
author={Chizhov, K and Beskrovnaya, L and Chizhov, A},
journal={Physics of Particles and Nuclei},
volume={55},
number={3},
pages={532--534},
year={2024},
publisher={Springer}
}
or software:
@misc{konstantin_radiationsafetybssunfold_2025,
title = {Radiationsafety/bssunfold},
copyright = {GNU General Public License v3.0 only},
shorttitle = {Radiationsafety/bssunfold},
url = {https://zenodo.org/doi/10.5281/zenodo.18056376},
abstract = {first published version of package},
urldate = {2026-01-12},
publisher = {Zenodo},
author = {Chizhov, Konstantin},
month = dec,
year = {2025},
doi = {10.5281/ZENODO.18056376},
}
💬 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
📘 Documentation
Documentation and API reference is available in /docs folder. Theory and methodology in the research paper, examples of usage in /examples folder. Check the https://bssunfold.readthedocs.io/en/latest/
📄 License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
💬 Support
For questions, bug reports, or feature requests:
- Open an issue on GitHub
- Contact: kchizhov@jinr.ru
💻 Authors
- Konstantin Chizhov
- Alexei Chizhov
- Dmitry Borschev
- Maria Akimochkina
🌐 Acknowledgments
- ICRP and IAEA for data
- Contributors and testers
- Joint Institure for Nuclear Research (JINR)
- University "Dubna", School of Big Data Analytics
🎓 Publications
- Чижов К.А., Чижов А.В., Борщев Д.С., Акимочкина М.А. Методы решения обратных задач для обработки результатов измерений на примере восстановления спектра нейтронов, Тридцать третья международная конференция "Математика. Компьютер. Образование, г. Дубна, 26 – 31 января 2026 г., https://mce.su
- Chizhov, K., Chizhov, A. Optimization of the Neutron Spectrum Unfolding Algorithm Using Shifted Legendre Polynomials Based on Weighted Tikhonov Regularization. Phys. Part. Nuclei 56, 1395–1399 (2025). https://doi.org/10.1134/S106377962570056X
- Chizhov K., Beskrovnaya L., Chizhov A. Neutron spectrum unfolding method based on shifted Legendre polynomials, its application to the IREN facility // Phys. Part. Nucl. Lett. — 2025. — V. 22, no. 2. — P. 337–340. — DOI: https://doi.org/10.1134/S154747712470239X
- Chizhov K., Beskrovnaya L., Chizhov A. Neutron spectra unfolding from Bonner spectrometer readings by the regularization method using the Legendre polynomials // Phys. Part. Nucl. — 2024. — V. 55. — P. 532–534. — DOI: https://doi.org/10.1134/S1063779624030298
- Chizhov K., Chizhov A. Optimization approach to neutron spectra unfolding with Bonner multi-sphere spectrometer // Math. Model. — 2024. — V. 7. — P. 89–90.
- Чижов А. В., Чижов К. А. Восстановление спектров опорных нейтронных полей на Фазотроне (ОИЯИ) на основе показаний многошарового спектрометра Боннера методом усеченного сингулярного разложения Тезисы Трудов LXI Всероссийской конференции по физике РУДН 19 - 23 мая 2025.
- Chizhov, K., Chizhov, A., TSVD-based neutron spectra unfolding by Bonner multi-sphere spectrometer readings with iteration procedure, proceedings of the International Conference "Distributed Computing and Grid-technologies in Science and Education".
- Белый А.А., Стариковская М.Д., Чижов К.А. Разработка веб-приложения для эксперимента по восстановлению спектра нейтронов с применением алгоритмов нейронный сетей. Системный анализ в науке и образовании. 2025;(2):49–57.
- Starikovskaya MD, Chizhov KA. Neutron spectrum unfolding based on random forest algorithm and generated training sample. In Российский университет дружбы народов им. П. Лумумбы; 2025 [cited 2025 Dec 25]. p. 389–94. Available from: https://www.elibrary.ru/item.asp?id=83014906
- Chizhov KA, Bely AA, Starikovskaia MD, Volkov EN. Восстановление энергетического спектра потока нейтронного излучения с помощью алгоритма машинного обучения «случайный лес». Современные информационные технологии и ИТ-образование. 2024 Dec 15 [cited 2025 Apr 9]; 20(4). Available from: http://sitito.cs.msu.ru/index.php/SITITO/article/view/1167
📘 References
- Compendium of neutron spectra and detector responses for radiation protection purposes: supplement to technical reports series no. 318. — Vienna: International Atomic Energy Agency, 2001. — Technical reports series no. 403. — STI/DOC/010/403. — ISBN 92-0-102201-8.
- Diamond, S. and Boyd, S., 2016. CVXPY: A Python-embedded modeling language for convex optimization. Journal of Machine Learning Research, 17(83), pp.1-5.
BSSUnfold - Professional neutron spectrum unfolding for radiation science and nuclear applications.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bssunfold-0.4.1.tar.gz.
File metadata
- Download URL: bssunfold-0.4.1.tar.gz
- Upload date:
- Size: 6.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b96ccb1d84db87c84200aff625cc81fe2d0b0a8383c5059fafbf3062d1a8bbb
|
|
| MD5 |
94c2cff9efe351261395539328084e5f
|
|
| BLAKE2b-256 |
99483dae65096ff6eac7f1aa42ad7faac600f98d69fd897d9797e64095f1e5cb
|
File details
Details for the file bssunfold-0.4.1-py3-none-any.whl.
File metadata
- Download URL: bssunfold-0.4.1-py3-none-any.whl
- Upload date:
- Size: 67.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
183c8e4dff03842ab8e7ac1eda389d954b54e93093deb107ceb46b0ad55d549f
|
|
| MD5 |
b419d640637b2fe0636c6116fdd0e172
|
|
| BLAKE2b-256 |
c7775df56bf9343de2205f1fe84acdc831cda553988422c733ad3b9b4c99c2c5
|