Skip to main content

Tools for radiation spectral analysis.

Project description

Ruff

PyPI version

PyPI pyversions

PyPI license

tests

Coverage Status

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

pandas.

Developers require additional requirements which are listed in

requirements-dev.txt. We use pytest for unit testing, ruff for

code formatting and linting, and are planning to eventually support

numpydoc docstrings.

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-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.)

Linting, formatting, and other checks

We use pre-commit to automatically run various checks and formatting tools in the CI. If pre-commit is installed, it will automatically run when committing new code, and it can also be run at any time using the following command:

pre-commit run --all

or run on any files not yet committed to the repository using

pre-commit run --files <filename1> <filename2> ...

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.

Checklist for code contributions

  • Branch off of main
  • Develop the feature or fix
  • Write tests to cover all use cases
  • Ensure all checks pass (pre-commit)
  • Ensure all tests pass (pytest)
  • Ensure test coverage is >95%
  • Push branch to GitHub and create a pull request to main

Copyright Notice

becquerel (bq) Copyright (c) 2017-2025, 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

IPO@lbl.gov.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

becquerel-0.7.0.tar.gz (103.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

becquerel-0.7.0-py2.py3-none-any.whl (112.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file becquerel-0.7.0.tar.gz.

File metadata

  • Download URL: becquerel-0.7.0.tar.gz
  • Upload date:
  • Size: 103.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for becquerel-0.7.0.tar.gz
Algorithm Hash digest
SHA256 a322a405b5b15a104436483732770b0da440afe650e3da6342378d3f67b142d6
MD5 3fc6816dc9535c2a17e542ce32a6765d
BLAKE2b-256 2f773ecbe9d20277d16796c5b6a8c0846e08ce950640f04a2aa2aaa6a298d9ca

See more details on using hashes here.

File details

Details for the file becquerel-0.7.0-py2.py3-none-any.whl.

File metadata

  • Download URL: becquerel-0.7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 112.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for becquerel-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f12fefd467eeed51c226714ed5d13f06b81496531fb457aba1e4b411f244bbd8
MD5 289ed3f58d24193ffeb041e08fa0704b
BLAKE2b-256 fdde9350e5793e8e030572af7af494a65af1464787a84fd3b0e24df2e80e7608

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page