Script execution
This commit is contained in:
@@ -160,20 +160,32 @@ finally:
|
||||
st.close()
|
||||
|
||||
|
||||
for i in range (cycles):
|
||||
for j in range(len(blms)):
|
||||
bg = get_attributes("background/" + str(j+1))["Mean"]
|
||||
path = wire+"_" + ("%04d" % (i+1)) + "/blm" + str(j+1)
|
||||
d = load_data(path)
|
||||
d = blm_remove_spikes(d)
|
||||
if bkg_mean is not None:
|
||||
d = [v-bg for v in d]
|
||||
[com, rms] = profile_rms_stats(x, nor,noise_std=0, n_sigma=3.5)
|
||||
set_attribute(path, "RMS", rms)
|
||||
set_attribute(path, "RMS centroid", com)
|
||||
[off, amp, com, sigma] = profile_gauss_stats(x, nor, off=None, amp=None, com=None, sigma=None)
|
||||
set_attribute(path, "Gauss COM", com)
|
||||
set_attribute(path, "Gauss Sigma", sigma)
|
||||
|
||||
|
||||
for i in range(len(blms)):
|
||||
path_back = "background/blm" + str(i+1)
|
||||
bg = get_attributes(path_back)["Mean"]
|
||||
for cycle in range (cycles):
|
||||
pos = load_data(wire+"_" + ("%04d" % (cycle+1)) + "/w_pos")
|
||||
path = wire+"_" + ("%04d" % (cycle+1)) + "/blm" + str(i+1)
|
||||
data = load_data(path)
|
||||
sp = blm_remove_spikes(data)
|
||||
sig = sp if bg is None else [v-bg for v in sp]
|
||||
|
||||
[com, rms] = profile_rms_stats(pos, sig,noise_std=0, n_sigma=3.5)
|
||||
set_attribute(path, "RMS", float("nan") if (rms is None) else rms)
|
||||
set_attribute(path, "RMS centroid", float("nan") if (com is None) else com)
|
||||
#print [com, rms]
|
||||
[off, amp, com, sigma] = profile_gauss_stats(pos, sig, off=None, amp=None, com=None, sigma=None)
|
||||
set_attribute(path, "Gauss COM", float("nan") if (com is None) else com)
|
||||
set_attribute(path, "Gauss Sigma", float("nan") if (sigma is None) else sigma)
|
||||
#print [off, amp, com, sigma]
|
||||
|
||||
from mathutils import Gaussian
|
||||
g = Gaussian(amp, com, sigma)
|
||||
gauss = [g.value(v)+off for v in pos]
|
||||
plot([data, sp, sig, gauss], ["data", "sp", "signal", "gauss", ], xdata = pos, title="Fit blm" + str(i+1) + " - " + str(cycle+1))
|
||||
|
||||
|
||||
# save the entry in the logbook
|
||||
if do_elog:
|
||||
|
||||
Reference in New Issue
Block a user