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.

Download files

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

Source Distribution

spefit-3.1.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

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

spefit-3.1.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file spefit-3.1.0.tar.gz.

File metadata

  • Download URL: spefit-3.1.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for spefit-3.1.0.tar.gz
Algorithm Hash digest
SHA256 81e0c78ee49f05d8b96374199adb499c065f0d07eb741c8ed6e7c4cf28d9cfb6
MD5 02b740807bb2dcf05b92d20dc56818b3
BLAKE2b-256 d8328c558c9dfe7ed566fa6985d3fe3a7e545a884eb70169aa47a92adc0bdba2

See more details on using hashes here.

File details

Details for the file spefit-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: spefit-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for spefit-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d6fe03f7844734a54dced7215097c5d1cd09db583fcf469135cb1ad8327cd6
MD5 5bed8ef2b68743cc14c73cb81e3e25f3
BLAKE2b-256 077de643616b496a15a70f786bafdd0a9f566a5c6071dba1729ccf4899cbc837

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.1.0 This release

2 files

3.0.0

2 files

2.0.0

2 files

1.0.2

2 files

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