Skip to main content

spefit

pipeline status coverage report Binder

Optimised framework for the fitting of Single Photoelectron Spectra (SPE) in order to characterize the properties of photomultipliers which influence the measured illumination response.

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

Metadata

Release files for spefit 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spefit 3.1.0
File Size Uploaded Provenance Actions
spefit-3.1.0.tar.gz 20.3 kB Without provenance Details for spefit-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spefit 3.1.0
File Interpreter ABI Platform Actions
spefit-3.1.0-py3-none-any.whl Python 3 none any Details for spefit-3.1.0-py3-none-any.whl

Total release size: 41.8 kB

Release files / spefit-3.1.0.tar.gz

Download URL spefit-3.1.0.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
81e0c78ee49f05d8b96374199adb499c065f0d07eb741c8ed6e7c4cf28d9cfb6
BLAKE2b-256 checksum
How to use checksums
d8328c558c9dfe7ed566fa6985d3fe3a7e545a884eb70169aa47a92adc0bdba2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release files / spefit-3.1.0-py3-none-any.whl

Download URL spefit-3.1.0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2d6fe03f7844734a54dced7215097c5d1cd09db583fcf469135cb1ad8327cd6
BLAKE2b-256 checksum
How to use checksums
077de643616b496a15a70f786bafdd0a9f566a5c6071dba1729ccf4899cbc837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Security for spefit 3.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page