Tools for radiation spectral analysis.
Project description
Becquerel is a Python package for analyzing nuclear spectroscopic
measurements. The core functionalities are reading and writing different
spectrum file types, fitting spectral features, performing detector
calibrations, and interpreting measurement results. It includes tools for
plotting radiation spectra as well as convenient access to tabulated nuclear
data, and it will include fits of different spectral features. It relies
heavily on the standard scientific Python stack of numpy, scipy, matplotlib,
and pandas. It is intended to be general-purpose enough that it can be useful
to anyone from an undergraduate taking a laboratory course to the advanced
researcher.
Installation
pip install becquerel
Features in development (contributions welcome!)
-
Reading additional
Spectrum
file types (N42, CHN, CSV) -
Writing
Spectrum
objects to various standard formats -
Fitting spectral features with Poisson likelihood
If you are interested in contributing or are want to install the package from
source, please see the instructions in CONTRIBUTING.md
.
Reporting issues
When reporting issues with becquerel
, please provide a minimum working example
to help identify the problem and tag the issue as a bug
.
Feature requests
For a feature request, please create an issue and label it as a new feature
.
Dependencies
External dependencies are listed in requirements.txt
and will be installed
automatically with the standard pip
installation. They can also be installed
manually with the package manager of your choice (pip
, conda
, etc).
The dependencies beautifulsoup4
, lxml
and html5lib
are necessary for
Developers require additional requirements which are listed in
requirements-dev.txt
. We use pytest
for unit testing, black
for
code formatting and are converting to numpydoc
.
Contribution guidelines
Contributions to becquerel
are welcome and encouraged, whether it is
reporting bugs, requesting features, or contributing code.
Please follow these guidelines when contributing to this project.
Developer Instructions
pip install -r requirements.txt
pip install -r requirements-dev.txt
python setup.py develop
pip install pre-commit
pre-commit install
(It is more convenient to use develop
so that the code is soft-linked
from the installation directory, and the installed package will always use
the current version of code.)
We use pre-commit
to automatically run black.
Running the tests
(Requires requirements-dev.txt
to be installed)
To run the tests using pytest
, from the root directory of the repo:
pytest
(python setup.py test
is still supported also.)
By default, a code coverage report is printed to the terminal.
Tests marked webtest
or plottest
are by default skipped for the sake of
speed. To run all tests, clear the pre-configured markers option:
pytest -m ""
To produce an HTML code coverage report in directory htmlcov
with line-by-line highlighting:
pytest --cov-report html:htmlcov
Code Style Guide
Use google standards
Linter
The code style/formatting will be checked with
black
and
flake8
in the CI
Checklist for code contributions
- Branch off of
main
- Develop the feature or fix
- Write tests to cover all use cases
- Ensure all tests pass (
pytest
) - Ensure test coverage is >95%
- Autoformat (
black .
) - Spellcheck your code and docstrings
- Push branch to GitHub and create a pull request to
main
Copyright Notice
becquerel (bq) Copyright (c) 2017-2021, The Regents of the University of
California, through Lawrence Berkeley National Laboratory (subject to receipt
of any required approvals from the U.S. Dept. of Energy) and University of
California, Berkeley. All rights reserved.
If you have questions about your rights to use or distribute this software,
please contact Berkeley Lab's Intellectual Property Office at
NOTICE. This Software was developed under funding from the U.S. Department
of Energy and the U.S. Government consequently retains certain rights. As
such, the U.S. Government has been granted for itself and others acting on
its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the
Software to reproduce, distribute copies to the public, prepare derivative
works, and perform publicly and display publicly, and to permit others to do so.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file becquerel-0.6.0.tar.gz
.
File metadata
- Download URL: becquerel-0.6.0.tar.gz
- Upload date:
- Size: 100.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 030ee65e2473fa16a58e4f2a00fd67f4f1ab214ff1472fb69e13c19e93cbaec4 |
|
MD5 | 466d2598743959b5e65afb1a638659be |
|
BLAKE2b-256 | ac0c612d3d97afd495fad55931aefeb46c8fa5efb5c43b2c14fe94f6c35f232a |
File details
Details for the file becquerel-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: becquerel-0.6.0-py3-none-any.whl
- Upload date:
- Size: 109.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65dc9fea875850bf8fabf44f134da91c05e5a6cea6040a738b72e744c26f89a3 |
|
MD5 | f44b8278887791f362bad1e306b91222 |
|
BLAKE2b-256 | 02cbee0c5aeccd022c91c0bbcf1718136d3dd1ef3cc928fbb226eaf3d124b1f7 |