Fitting of Single Photoelectron Spectra.
Project description
spefit
Optimised framework for the fitting of Single Photoelectron Spectra (SPE) in order to characterize the properties of photomultipliers which influence the measured illumination response.
- Supported Python versions: 3.9+
- Supported platforms: Linux, OSX
- Source: https://gitlab.cta-observatory.org/cta-consortium/aswg/tools/spefit
- License: BSD-3-Clause
- Citation: pending
Package Features
- Basic numpy API
- Runtime-selectable Probability Density Functions (PDFs), optimised using numba
- PDFs for the SPE spectra of both Photomultiplier Tubes and Silicon Photomultipliers
- Configuration of PDFs for the case where no pedestal peak exists (e.g. dark counting)
- Estimation of SPE parameters for improved initial fit values
- Runtime-selectable minimization cost definitions, optimised using numba
- Simultaneous fitting of multiple datasets (e.g. containing different average illuminations) for better parameter constraining
- Minimization provided by iminuit - Python frontend to the MINUIT2 C++ library
- Calculation of parameter errors and resulting p-value
- Extendable to allow the inclusion of any additional SPE description and minimization cost definitions
- Compatible with other minimization routines
- Convenience class provided for the parallel processing of cameras containing multiple photomultiplier pixels
Currently Implemented:
SPE formula:
- PMT Single Gaussian
- SiPM Gentile
- SiPM Modified Poisson
Minimization Cost functions:
- Unbinned Negative Log-likelihood
- Binned Negative Log-likelihood
- Least Squares
Installation
The package is available via pypi:
pip install spefit
Alternatively, this package is installable via pip directly from this repository (via https or ssh), e.g.:
pip install 'git+https://gitlab.cta-observatory.org/cta-consortium/aswg/tools/spefit.git#egg=spefit'
Also see the Makefile for development commands.
Optional Dependencies
Utilisation of Intel's short vector math library (SVML) for improved performance provided by numba:
conda install -c numba icc_rt
Usage
With a numpy array of size (n_events) called charge_array, containing the measured charges from the low illumination of a photomultiplier, the parameters of the SPE spectra can be extracted with:
from spefit.dataset import Dataset
from spefit.pdf import PMTSingleGaussian
from spefit.cost import BinnedNLL
from spefit.fitter import minimize_with_iminuit
charges = [Dataset(charge_array, n_bins=100, range_=(-3, 6))]
pdf = PMTSingleGaussian()
cost = BinnedNLL(pdf, charges)
values, errors = minimize_with_iminuit(cost)
Jupyter notebook demonstrations are provided in tutorials.
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
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 spefit-3.0.0.tar.gz.
File metadata
- Download URL: spefit-3.0.0.tar.gz
- Upload date:
- Size: 384.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afbe5b2610796a769e57a3504fa67672503b9bf895b4bbe408ddfa3182934f2a
|
|
| MD5 |
541b7e9e5b17bef68b988ff5fa1196d3
|
|
| BLAKE2b-256 |
33423b0b7a163eca5cf1f5c5685f9067d027d34b50b9c1cde7bad7e8a91b97d0
|
File details
Details for the file spefit-3.0.0-py3-none-any.whl.
File metadata
- Download URL: spefit-3.0.0-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b597d1e7c97390f33b9870b63197120124b018a3667ac0948e1e2268e187fcb
|
|
| MD5 |
bf21f6762233540e04198f599c60c8a6
|
|
| BLAKE2b-256 |
85380809713999020365e4053c3f56544e2b7bc7f029d1470cd77559b87f4ff0
|