Page History
...
...
Comparison of Algorithm #4 with Algorithm #6
These two common mode algorithms were compared for exp=xcs06016:run=37 with the default parameters. The plot is shown below. Algorithm #4 has a mean of 141.535 ± 0.067 with a sigma of 8.754 while algorithm #6 has a mean of 142.153 ± 0.067 with a sigma 8.773.
The code used to produce this plot is shown below.
Code Block |
---|
from psana import *
from ImgAlgos.PyAlgos import PyAlgos
import matplotlib.pyplot as plt
import numpy as np
ds = DataSource('exp=xcs06016:run=37:smd')
det = Detector('epix_2')
tl, th = 10, 30
r, r0, dr = 1, 3.3, 0
alg4, alg6 = PyAlgos(), PyAlgos()
all_44, all_46 = np.array([]), np.array([])
for nevent, evt in enumerate(ds.events()):
if nevent == 10: break
nda6 = det.calib(evt, cmpars = [6], rms = det.rms(evt))
nda4 = det.calib(evt)
peaks_v44 = alg4.peak_finder_v4r2(nda4, thr_low=tl, thr_high=th,
rank=r, r0=r0, dr=dr)
all_44 = np.append(all_44, peaks_v44)
peaks_v46 = alg6.peak_finder_v4r2(nda6, thr_low=tl, thr_high=th,
rank=r, r0=r0, dr=dr)
all_46 = np.append(all_46, peaks_v46)
low_lim, hi_lim = 100, 180
## Cuts off data between low_lim and hi_lim
all_44 = all_44.reshape(-1, 17)
all_44 = all_44[(all_44[:, 5] > low_lim) & (all_44[:, 5] < hi_lim)]
all_46 = all_46.reshape(-1, 17)
all_46 = all_46[(all_46[:, 5] > low_lim) & (all_46[:, 5] < hi_lim)]
hist_44, bin_edge_44 = np.histogram(all_44[:, 5], 100)
hist_46, bin_edge_46 = np.histogram(all_46[:, 5], 100)
plt.figure()
plt.plot(bin_edge_44[:-1], hist_44, linestyle='--', marker='x',
label='Common Mode #4')
plt.plot(bin_edge_46[:-1], hist_46, linestyle='--', marker='^',
label='Common Mode #6')
plt.legend()
plt.xlim(low_lim, hi_lim)
plt.show() |
Overview
Content Tools