From b4467724cd7acab04ba27e7121161a30acf17351 Mon Sep 17 00:00:00 2001 From: Tobias Quadfasel <tobias.loesche@studium.uni-hamburg.de> Date: Fri, 20 Jan 2023 14:14:14 +0100 Subject: [PATCH] Adding README.md file. Some minor corrections of TODOs/comments inside the code. --- PeakOTron.py | 3 +-- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/PeakOTron.py b/PeakOTron.py index 3aa2bf7..d46ee85 100644 --- a/PeakOTron.py +++ b/PeakOTron.py @@ -4,7 +4,7 @@ from HelperFunctions import (GP_gain, GP_lbda, GP_mu, from Model import epsilon from HelperFunctions import LatexFormat, Linear from LossFunctions import BinnedLH, HuberRegression -from Model import DRM, P_Ap, dP_Ap, sigmak, Beta +from Model import DRM, P_Ap, dP_Ap from iminuit import Minuit from scipy.interpolate import (interp1d, UnivariateSpline, InterpolatedUnivariateSpline) @@ -1172,7 +1172,6 @@ class PeakOTron: sigma_0=self._prefit_values_bin["sigma_0"], sigma_1=self._prefit_values_bin["sigma_1"], tau_Ap=self._prefit_values_bin["tau_Ap"], - # TODO: Linter says epsilon() is not defined! p_Ap=epsilon(), DCR=epsilon(), tau=self._prefit_values_bin["tau"], diff --git a/README.md b/README.md new file mode 100644 index 0000000..738bd8e --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# PeakOTron: A `python` module for fitting charge spectra of silicon photomultipliers + +This repository contains the code for the analysis of silicon photomultiplier (SiPM) charge spectra, as described in "PeakOTron: A Python Module for Fitting Charge Spectra of Silicon Photomultipliers" by J. Rolph et. al. (preprint submitted to Nuclear Instruments and Methods A). + +The code implements the detector response model (DRM) described in [1], adding the correct treatment of non-Gaussian pedestals as well as a correct treatment of afterpulses. + +## Recommended software stack +`PeakOTron` is entirely `python`-based. The required modules to run the program are: + +- astropy (v3.0.2) +- iminuit (v2.17.0) +- joblib (v0.13.2) +- matplotlib (v3.1.3) +- numba (v0.45.1) +- numpy (v1.17.2) +- pandas (v1.1.3) +- scipy (v1.3.1) + +We have included a `requirements.txt` file in this repository that can be used to install the necessary packages in the current `python` environment using `pip`: + +``` +pip install -r requirements.txt +``` + +Alternatively, we have also tested the program using an [`anaconda`](https://anaconda.org/) environment. We recommend using packages from the [`conda-forge` channel](https://anaconda.org/conda-forge) using the following command in the current `anaconda` environment: + +``` +conda install -c conda-forge numba astropy iminuit joblib matplotlib numpy pandas scipy +``` + + +## Getting started + +In order to get acquainted with the program, you can either take a look at the `example.py` script, which takes a set of measured SiPM spectra (contained inside the `data` directory), runs the fit iteratively over each of them and produces the resulting outputs: The plots of the fits as well as the dumped `PeakOTron` objects as `joblib` files in the `Results` sub-directory and a `csv` file which is created from a `pandas.DataFrame` containing the results of the fit parameters and their respective errors for each spectrum. + +We also provide a [`jupyter`](https://jupyter.org/) notebook (`Introduction.ipynb`) that shows the usage of the program as well as an extensive description of the additional input parameters that need to be set by the user for the fit to produce accurate results. In the notebook, it is also shown how to get plots for both the final fit results and the determination of the pre-fit initial values. + +## References + +[1] V. Chmill et al., On the characterisation of SiPMs from pulse-height spectra, Nucl. Instrum. Methods Phys. Res. A 854 (2017) 70–81. [doi:10.1016/j.nima.2017.02.049](https://doi.org/10.1016/j.nima.2017.02.049). \ No newline at end of file -- GitLab