Closedown

This commit is contained in:
gobbo_a
2017-05-05 17:19:43 +02:00
parent 0f58da669b
commit 412c99fe64
7 changed files with 184 additions and 154 deletions
+4 -5
View File
@@ -24,6 +24,7 @@ print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, cycles, bp
#Plot setup
plt.clear()
plt.removeMarker(None)
plt.getAxis(plt.AxisId.X).setLabel("Position");
plt.getAxis(plt.AxisId.Y).setLabel("");
plt.getAxis(plt.AxisId.Y2).setLabel("");
@@ -134,8 +135,6 @@ def do_scan(index):
if not scan_complete:
raise
finally:
#TODO: Display average of cycles
#Combining data of multiple series
#s=plt.getSeries(0)
#indexes = sorted(range(len(s.x)),key=lambda x:s.x[x])
@@ -163,9 +162,9 @@ def calculate():
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)
[rms_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)
set_attribute(path, "RMS centroid", float("nan") if (rms_com is None) else rms_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)
@@ -184,7 +183,7 @@ def calculate():
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")) )
plt.addMarker(stats[i][2][0], None, "Gcom=" + "%.2f" % stats[i][2][0], plt.getSeries(i).color)
plt.addMarker(stats[i][1][0], None, "Rcom=" + "%.2f" % stats[i][1][0], plt.getSeries(i).color)
plt.addMarker(stats[i][1][0], None, "Rcom=" + "%.2f" % stats[i][1][0], plt.getSeries(i).color.brighter())
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"
+4 -4
View File
@@ -7,22 +7,22 @@ def noise_evaluation(noise):
def blm_remove_spikes(x):
ret = call_jep(MODULE, "blm_remove_spikes", [to_npa(x),])
return None if ret is None else ret.data
return ret if ret is None or is_list(ret) else ret.data
def blm_normalize(x, q):
ret = call_jep(MODULE, "blm_normalize", [to_npa(x), q])
return None if ret is None else ret.data
return ret if ret is None or is_list(ret) else ret.data
def motor_to_wire_cs(pos, ctype = 'u', center_pos = 0.0):
return call_jep(MODULE, "motor_to_wire_cs", [pos, ctype, center_pos ])
def remove_beam_jitter(pos, bpm1, bpm2, d_b1_w=1, d_w_b2=1):
ret = call_jep(MODULE, "remove_beam_jitter", [to_npa(pos),to_npa(bpm1), to_npa(bpm2), d_b1_w, d_w_b2 ])
return None if ret is None else ret.data
return ret if ret is None or is_list(ret) else ret.data
def profile_gauss_stats(x, y, off=None, amp=None, com=None, sigma=None):
ret = call_jep(MODULE, "profile_gauss_stats", [to_npa(x), to_npa(y), off, amp, com, sigma])
return None if ret is None else ret.data
return ret if ret is None or is_list(ret) else ret.data
def profile_rms_stats(x, y, noise_std=0, n_sigma=3.5):
return call_jep(MODULE, "profile_rms_stats", [to_npa(x), to_npa(y), noise_std, n_sigma])
+2 -2
View File
@@ -1,6 +1,6 @@
run("Diagnostics/sig_process_wrapper")
root = "2017/05/04/20170504_182411_WireScan.h5|/"
root = "2017/05/05/20170505_123536_WireScan.h5|/" #"2017/05/04/20170504_182411_WireScan.h5|/"
wire = "x"
blms = ["",""]
cycles = 3
@@ -43,7 +43,7 @@ print stats
msg = ""
for i in range(len(blms)):
msg += "BLM " + str(i) + ":\n"
msg += "Wire " + wire + " - BLM " + str(i) + ":\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"