This repository contains some code to study filtering of the SiPM output. It produces all the figures of my thesis, https://github.com/Gattocrucco/thesis.
Developed on Python 3.8.2 (should work with Python >= 3.6), required modules
with version numbers are listed in requirements.txt
. To set up a python
environment you could do:
$ python3.8 -m venv python38venv
$ . python38venv/bin/activate
(python38venv) $ pip install --requirement requirements.txt
I always run the scripts in an IPython shell. If you run them with a vanilla
python interpreter the figures would close before you had a chance to look at
them (although this can be fixed by replacing fig.show()
with plt.show()
),
and some scripts expect you to call functions interactively after running the
script. Example in the terminal:
(python38venv) $ pip install ipython
(python38venv) $ ipython
Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: %pylab
Using matplotlib backend: MacOSX
Populating the interactive namespace from numpy and matplotlib
In [2]: run myscript.py
Some python files are designed to be imported. If you grab them, place them in
the same directory of your code, example: if the module file is
ciappimodule.py
, you can import it with import ciappimodule
.
Some scripts need large data files which I could not commit to the repository. Some of these work without source files by using committed caches of what they need, others can't.
There are LNGS liquid nitrogen laser test wav files and Proto0 root files. I have received the Proto0 root files directly from someone so I can't link a source for them. The LNGS wav files I used are found at the addresses http://ds50tb.lngs.infn.it colon 2180/SiPM/Tiles/FBK/NUV/MB2-LF-3x/ and http://ds50tb.lngs.infn.it colon 2180/SiPM/Tiles/LFOUNDRY/pre-production-test/.
A command to automatically download all wav files in a directory could be:
$ wget --recursive --no-parent --no-directories --reject '*' --accept '*.wav' <directory url>
All the scripts expect the working directory to be the root directory of the repository. Example: instead of
In [1]: cd mydir
In [2]: run myscript.py
You should do:
In [1]: run mydir/myscript.py
They also expect to find the large data files in a directory named darksidehd
.
The scripts in figthesis/
save figures in ../thesis/figures
.
-
DS_proto_runs_nov_2019.csv
: Proto0 metadata, dated February 2021. -
figthesis/figspectra.npz
: spectra saved byfigspectra.py
. -
noises/merged_000886-adc_W201_Ch00.npz
: branchadc_W201_Ch00
frommerged_000866.root
, to be loaded withtoy.DataCycleNoise
. -
noises/nuvhd_lf_3x_tile57_77K_64V_6VoV_1-noise.npz
: noise fromnuvhd_lf_3x_tile57_77K_64V_6VoV_1.wav
, to be loaded withtoy.DataCycleNoise
. -
templates/nuvhd_lf_3x_tile57_77K_64V_6VoV_1-template.npz
: template made fromnuvhd_lf_3x_tile57_77K_64V_6VoV_1.wav
, to be loaded withtemplate.Template
.
-
afterpulse_tile15_ap.py
: (OUTDATED) measure dcr and afterpulse in tile 15. -
afterpulse_tile15.py
: (OUTDATED) measure dcr in tile 15. -
afterpulse_tile21.py
: measure dcr, afterpulse and cross talk in tile 21. -
afterpulse_tile57.py
: (OUTDATED) count afterpulses in tile 57. -
figthesis/fig*.py
: scripts for figures in my thesis. -
fdiffrate.py
: count threshold crossings for filtered finite difference on a Proto0 or LNGS file. -
fdrall.py
: runfdiffrate.py
on all files specified. -
fdrallplot.py
: plot results fromfdrall.py
. -
fingerplot_tile21.py
: a quick fingerplot of tile 21 files. -
fingerplot.py
: do a fingerplot with an LNGS wav. -
fingersnr.py
: compute the filtered SNR on an LNGS wav. -
fingersnrmf.py
: (OUTDATED) test forfingersnr.py
. -
hist2d.py
: do a 2D histogram of an LNGS or Proto0 file. -
hist2dall.py
: runhist2d
on a series of files saving plots. -
lngshist.py
: (DEPRECATED) do a 2D histogram of an LNGS wav. -
manine.py
: (OUTDATED) test forfingersnr.py
. -
plotevent.py
: plot a single event from a Proto0 or LNGS file. -
plotwav.py
: plot a pair of things to check an LNGS wav. -
plotwav2.py
: a single plot for the 2020-11-03 slides. -
savenoise.py
: extract and save noise data from some files. -
savenoise2.py
: like above for other files. -
savetemplate.py
: compute and save a template from an LNGS wav. -
simplefilter.py
: (OUTDATED) signal finding. -
spec.py
: plot the spectrum of a LNGS/Proto0 file. -
spectrum.py
: (DEPRECATED) compute the noise spectra from some files. -
templateplot.py
: plot a template saved bysavetemplate.py
. -
tile21gap.py
: determine the size of events in tile 21 files. -
toy1gsa-plot.py
: do the plots for the script below. -
toy1gsa.py
: temporal resolution at 1 GSa/s. -
toy1gvs125m-plot.py
: do the plots for the script below. -
toy1gvs125m.py
: comparison of temporal resolution at different sampling frequencies. -
toycomparison-plot.py
: do the plots for the script below. -
toycomparison.py
: temporal resolution at 125 MSa/s (also with windowing). -
toytest.py
: (OUTDATED) some functions to test thetoy.py
module. -
triggerhist.py
: histogram the trigger leading edge position.
-
afterpulse.py
: class to analyze an LNGS wav file. -
argminrelmin.py
: index of the minimum local minimum. -
breaklines.py
: function to break lines in a string. -
colormap.py
: make an approximately perceptually uniform colormap. -
correlate.py
: (DEPRECATED) compute the cross correlation. -
downcast.py
: downcast a numpy data type recursively. -
fighelp.py
: (DEPRECATED) convenience functions for matplotlib figures. -
figlatex.py
: write LaTeX command for including a matplotlib figure. -
firstbelowthreshold.py
: index of first array element below a threshold. -
integrate.py
: filter an LNGS wav. -
make_template.py
: (DEPRECATED) make a template for the cross correlation filter from an LNGS wav. -
maxprominencedip.py
: find max prominence negative peaks. -
meanmedian.py
: mean of the median over strided subarrays. -
npzload.py
: class to serialize objects to numpy archives. -
num2si.py
: format a number using SI suffixes. -
peaksampl.py
: separate summed signals. -
poissonsup.py
: compute upper confidence limits for the poisson. -
read.py
: read a Proto0 or LNGS file with a single interface. -
readroot.py
: read a Proto0 run2 root file. -
readwav.py
: read an LNGS wav; see also sstracka/dsfe on bitbucket. -
runsliced.py
: do something in batches with a progressbar. -
single_filter_analysis.py
: make a fingerplot and compute the SNR. -
template.py
: class to make signal templates. -
textbox.py
: write text in a box on plots. -
textmatrix.py
: format tables for LaTeX. -
toy.py
: simulation to measure temporal resolution.
-
figures/
: miscellaneous figures made with the scripts. -
fingersnr-changebaseline/
: (OUTDATED) the output fromfingersnr.py
for the 2020-11-03 slides. -
fingersnr-changebaseline-mf/
: the same after adding the matched filter. -
fingersnr-mftemplate/
: plot of the matched filter template and its spectrum. -
min_snr_ratio.py
: (OUTDATED) saved ratios filtered SNR/unfiltered SNR. -
slides-2020-11-03/
: filtered SNR. -
slides-2020-12-01/
: temporal resolution. -
slides-2020-12-10/
: effect of waveform truncation. -
slides-2021-03-11/
: DCR and afterpulses of LF_TILE15. -
slides-2021-04-02/
: (OUTDATED) DCR, afterpulses and crosstalk of LF_TILE21 (internal meeting). -
slides-2021-04-12/
: (OUTDATED) afterpulses and crosstalk of LF_TILE21 (photoelectronics meeting). -
slides-2021-04-20/
: DCR, afterpulses and crosstalk of LF_TILE21 (simulation meeting). -
slides-2021-xx-xx/
: pulse finder fake rate. -
slides-2021-yy-yy/
: (OUTDATED) DCR, afterpulses and crosstalk of LF_TILE21 (unrevised long version). -
toy1gsa/
: figures made withtoy1gsa-plot.py
. -
toy1gvs125m/
: figures made withtoy1gvs125m-plot.py
. -
toycomparison/
: figures made withtoycomparison-plot.py
. -
toycomparison-old/
: (OUTDATED) like above, but before taking a smaller window for filtering and localizing the signal.
The code is covered by the MIT license, while the slides by the CC-BY 4.0. In practice you can do almost anything provided you cite the source.