-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathGN_Nov_19_2025_Analysis.py
More file actions
executable file
·77 lines (63 loc) · 2.59 KB
/
Copy pathGN_Nov_19_2025_Analysis.py
File metadata and controls
executable file
·77 lines (63 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
TODO
Created on Mon Nov 12 2025
@author: Ed van Bruggen <evanbruggen@umass.edu>
"""
import matplotlib.pyplot as plt
from src.MeasurementInfo import MeasurementInfo, get_files
from src.ProcessHistograms import ProcessHist
from src.ProcessWaveforms import ProcessWaveforms
from AnalyzePDE import SPE_data
from multiprocessing import Pool
plt.style.use('misc/nexo.mplstyle')
condition = 'GN'
temperature = 137
#1us, 10x gain, filter on - values from Noahs calibration report
invC_filter = 0.011547
invC_err_filter = 0.000098
path = '../data/20251114_SPE_GN_137K/'
files, biases, run_spe_pre_bd = get_files(path)
def proc(file):
return ProcessWaveforms([path+file], do_filter=True,
baseline_correct=True, poly_correct=True,
upper_limit=-1, prominence=.002)
with Pool(len(files)+1) as p:
runs = p.map(proc, iter(files))
measurments = []
for run in runs:
m = MeasurementInfo(condition, temperature, run, run_spe_pre_bd)
m.plot_histogram() # Plot preliminary histogram
measurments.append(m)
# Fit Gauss to peaks and find the best value for peak location
savefig = True
first_pe = [5.0, 5.2, 5.5, 5.9, 6.6, 7.0, 7.4, 7.8, 8.3]
lower_cutoff = [3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.4, 4.7]
num_pes = [4, 4, 5, 5, 5, 6, 6, 6, 6, ]
outpath = '/home/evanbruggen_umass_edu/0vbb/20251114/20251118_'
campaign_spe = []
for i in range(len(measurments)):
wp_spe = ProcessHist(measurments[i],
baseline_correct=True,
peaks='all',
# peaks='dark',
# peaks='LED',
cutoff=(lower_cutoff[i]/1000, .1),
# cutoff=(lower_cutoff[i]/1000, upper_cutoff[i]/1000),
first_pe=first_pe[i],
background_linear=False,
peak_range=(1,num_pes[i]))
wp_spe.process_spe()
wp_spe.plot_peak_histogram(log_scale=True,
savefig=savefig, path=outpath+f"{measurments[i].bias}_hist.png")
wp_spe.plot_spe(fit_origin=False,
savefig=savefig, path=outpath+f"{measurments[i].bias}_spe.png")
wp_spe.plot_ca(outpath+f"{measurments[i].bias}_ca.png" if savefig else None)
campaign_spe.append(wp_spe)
spe = SPE_data(campaign_spe, invC_filter, invC_err_filter, filtered=True)
spe.plot_spe(in_ov=False, absolute=True)
spe.plot_spe(in_ov=False, absolute=False)
spe.plot_spe(in_ov=True, absolute=True)
spe.plot_spe(in_ov=True, absolute=False)
spe.plot_CA()