Skip to main content

Fitting of Single Photoelectron Spectra.

Project description

spefit

pipeline status coverage report Code style: black 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 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


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.0.0.tar.gz (384.2 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.0.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

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

Hashes for spefit-3.0.0.tar.gz
Algorithm Hash digest
SHA256 afbe5b2610796a769e57a3504fa67672503b9bf895b4bbe408ddfa3182934f2a
MD5 541b7e9e5b17bef68b988ff5fa1196d3
BLAKE2b-256 33423b0b7a163eca5cf1f5c5685f9067d027d34b50b9c1cde7bad7e8a91b97d0

See more details on using hashes here.

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

Hashes for spefit-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b597d1e7c97390f33b9870b63197120124b018a3667ac0948e1e2268e187fcb
MD5 bf21f6762233540e04198f599c60c8a6
BLAKE2b-256 85380809713999020365e4053c3f56544e2b7bc7f029d1470cd77559b87f4ff0

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