Script execution
This commit is contained in:
@@ -88,7 +88,6 @@ def check_end_scan(record, scan):
|
||||
cur_cycle = record[3]
|
||||
get_context().dataManager.splitScanData(scan)
|
||||
#for s in plt.getAllSeries(): s.clear()
|
||||
for s in plt.getAllSeries(): s.
|
||||
for i in range (len(blms)):
|
||||
plt.getSeries(i).appendData(position, record[5 + i])
|
||||
|
||||
@@ -148,9 +147,12 @@ def do_scan(index):
|
||||
|
||||
msg = ""
|
||||
def calculate():
|
||||
global msg
|
||||
stats = []
|
||||
for i in range(len(blms)):
|
||||
path_back = "background/blm" + str(i+1)
|
||||
bg = get_attributes(path_back)["Mean"]
|
||||
bg = get_attributes(path_back)["Mean"]
|
||||
samples = [[], [], [], []]
|
||||
for cycle in range (cycles):
|
||||
pos = load_data(wire+"_" + ("%04d" % (cycle+1)) + "/w_pos")
|
||||
path = wire+"_" + ("%04d" % (cycle+1)) + "/blm" + str(i+1)
|
||||
@@ -165,15 +167,21 @@ def calculate():
|
||||
[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)
|
||||
|
||||
samples[0].append(rms_com);samples[1].append(rms);samples[2].append(com);samples[3].append(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))
|
||||
stats.append([])
|
||||
for sample in samples:
|
||||
sample = [v for v in sample if v is not None]
|
||||
stats[i].append( (mean(sample), stdev(sample)) if len(sample)>0 else (float("nan"), float("nan")) )
|
||||
|
||||
for i in range(len(blms)):
|
||||
msg += "Wire " + wire + " - BLM " + str(i) + ":\n"
|
||||
msg += "Wire " + wire + " - BLM " + str(i+1) + ":\n"
|
||||
msg += " RMS: " + "%.4f" % stats[i][0][0] + " " + unichr(0x03C3) + "=" + "%.4f" % stats[i][0][1] + "\n"
|
||||
msg += " RMS COM: " + "%.4f" % stats[i][1][0] + " " + unichr(0x03C3) + "=" + "%.4f" % stats[i][1][1] + "\n"
|
||||
msg += " Gauss COM: " + "%.4f" % stats[i][2][0] + " " + unichr(0x03C3) + "=" + "%.4f" % stats[i][2][1] + "\n"
|
||||
|
||||
Reference in New Issue
Block a user