From 0faf880785e965566b4948272c8f14c4a40040fd Mon Sep 17 00:00:00 2001 From: sfop Date: Wed, 3 May 2017 10:24:28 +0200 Subject: [PATCH] Startup --- devices/CurrentCamera.properties | 16 ++++----- devices/WireScanner motor.properties | 2 +- plugins/WireScan.java | 3 ++ script/Diagnostics/WireScan.py | 51 +++++++++++++++------------- 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 332dbe1..a805f89 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,10 +1,10 @@ -#Tue May 02 13:16:18 CEST 2017 +#Wed May 03 09:40:49 CEST 2017 colormap=Flame colormapAutomatic=true -colormapMax=0.0 +colormapMax=800.0 colormapMin=0.0 -flipHorizontally=true -flipVertically=true +flipHorizontally=false +flipVertically=false grayscale=false imageHeight=2160 imageWidth=2560 @@ -21,9 +21,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=localhost\:10000 -spatialCalOffsetX=-1292.0 -spatialCalOffsetY=-1062.0 -spatialCalScaleX=-8.784773060029282 -spatialCalScaleY=-8.854454897620366 +spatialCalOffsetX=-649.4689449397814 +spatialCalOffsetY=-522.5163272053469 +spatialCalScaleX=-8.737659608697616 +spatialCalScaleY=-8.83489815158259 spatialCalUnits=mm transpose=false diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties index 09aebe8..1eddbb4 100644 --- a/devices/WireScanner motor.properties +++ b/devices/WireScanner motor.properties @@ -1,4 +1,4 @@ -#Tue May 02 15:46:31 CEST 2017 +#Tue May 02 18:33:33 CEST 2017 defaultSpeed=282.842712474619 estbilizationDelay=0 hasEnable=false diff --git a/plugins/WireScan.java b/plugins/WireScan.java index 8946a84..97a2f5a 100644 --- a/plugins/WireScan.java +++ b/plugins/WireScan.java @@ -747,6 +747,7 @@ public class WireScan extends Panel { } } parameters.add(blms); + parameters.add(10); //BG parameters.add(plot); try { @@ -756,6 +757,7 @@ public class WireScan extends Panel { showException((Exception) ex); } else { //SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput()); + /* JPanel pn = new JPanel(new BorderLayout()); ((BorderLayout) pn.getLayout()).setHgap(5); pn.add(new JLabel("Generated data file:"), BorderLayout.NORTH); @@ -764,6 +766,7 @@ public class WireScan extends Panel { tf.setEditable(false); pn.add(tf, BorderLayout.SOUTH); JOptionPane.showOptionDialog(WireScan.this, pn, "Success", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null); + */ } return ret; }); diff --git a/script/Diagnostics/WireScan.py b/script/Diagnostics/WireScan.py index 9b5a7fb..e047322 100644 --- a/script/Diagnostics/WireScan.py +++ b/script/Diagnostics/WireScan.py @@ -9,11 +9,12 @@ BPM_SENSORS = [("x","X1"), ("y","Y1"), ("q","Q1")] #(logic name sufix, channel s prefix = args[0] if is_panel else "S30CB09-DWSC440" #"SINDI01-DWSC090" scan_type = args[1] if is_panel else WireScanner.WireX1 scan_range = args[2] if is_panel else [-200, 200, -200, 200] -cycles = args[3] if is_panel else 5 +cycles = args[3] if is_panel else 2 velocity = args[4] if is_panel else 200 bpms = args[5] if is_panel else get_wire_scanners_bpms(prefix) blms = args[6] if is_panel else get_wire_scanners_blms(prefix) -plt = args[7] if is_panel else plot(None, title = "Wire Scan")[0] +bkgrd = args[7] if is_panel else 10 +plt = args[8] if is_panel else plot(None, title = "Wire Scan")[0] print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, cycles, bpms @@ -32,25 +33,30 @@ if prefix not in get_wire_scanners(): scanner = WireScanner(prefix, scan_range, cycles, velocity, True) scanner.set_selection(get_scan_selection(scan_type)) scanner.init() -scanner.waitValue("At start", 60000) - +scanner.waitValue("At start", 60000) #List of stream channels channels = [("m_pos", scanner.motor_bs_readback.get_name()), ("cur_cycle", scanner.curr_cycl.get_name()), - ("scanning", scanner.status_channels[0].get_name())] + ("scanning", scanner.status_channels[0].get_name())] for i in range (len(blms)): channels.append (("blm" + str(i+1), blms[i] + ":B1_LOSS")) - plt.addSeries(LinePlotSeries(blms[i], None, min(i+1, 2))) - + plt.addSeries(LinePlotSeries(blms[i], None, min(i+1, 2))) for i in range (len(bpms)): for sensor in BPM_SENSORS: channels.append (("bpm" + str(i+1) + "_" + sensor[0], bpms[i] + ":" + sensor[1])) +#Metadata +set_attribute("/", "Wire Scanner", prefix) +set_attribute("/", "Scan Type", scan_type) +set_attribute("/", "Range", scan_range) +set_attribute("/", "Cycles", cycles) +set_attribute("/", "Motor Velocity", velocity*math.sqrt(2)) +set_attribute("/", "Wire Velocity", velocity) + #Stream creation print "Starting stream..." st = Stream("pulse_id", dispatcher) -scanner.curr_cycl.write(0) st.setFilter(scanner.curr_cycl.get_name() + ">0") #scanner.status_channels[0].get_name() + ">0" not used because we must the transition to know when the finished for c in channels: st.addScalar(c[0], c[1], 10, 0) @@ -58,6 +64,8 @@ st.initialize() st.start() st.waitCacheChange(10000) #Wait stream be running before starting scan + + #Pseudo-device returning the wire position class w_pos(Readable): def read(self): @@ -82,17 +90,10 @@ def check_end_scan(record, scan): cur_cycle = record[3] get_context().dataManager.splitScanData(scan) -#Metadata -set_attribute("/", "Wire Scanner", prefix) -set_attribute("/", "Scan Type", scan_type) -set_attribute("/", "Range", scan_range) -set_attribute("/", "Cycles", cycles) -set_attribute("/", "Motor Velocity", velocity*math.sqrt(2)) -set_attribute("/", "Wire Velocity", velocity) - #Scan - def do_scan(): + scanner.curr_cycl.write(0) + time.sleep(1.0) global scan_complete, cur_cycle scan_complete=False cur_cycle = 1 @@ -111,17 +112,20 @@ def do_scan(): img_file = os.path.abspath(get_exec_pars().path + "_" + get_exec_pars().group[0:1] + ".png") time.sleep(0.1) #Give some time to plot finish (async) plt.saveSnapshot(img_file, "png") - snapshots.append(img_file) - - + snapshots.append(img_file) print "Starting scan..." try: + #Background + if bkgrd>0: + set_exec_pars(group = "background") + scanner.curr_cycl.write(1) #To Free the filter + mscan (st, st.getReadables(), bkgrd) + set_exec_pars(group= "y_{count}" if scan_type in [WireScanner.WireY1, WireScanner.WireY1] else "x_{count}"); do_scan() if scan_type in [WireScanner.Set1, WireScanner.Set2]: scanner.set_selection(get_scan_selection(scan_type)) - scanner.curr_cycl.write(0) scanner.set_selection(get_scan_selection(scan_type, 1)) scanner.init() scanner.waitValue("At start", 60000) @@ -134,8 +138,9 @@ try: gsa_log_msg = gsa_log_msg + "\nRange: " + str(scan_range) gsa_log_msg = gsa_log_msg + "\nCycles: " + str(cycles) gsa_log_msg = gsa_log_msg + "\nWire Velocity: " + str(velocity) - - elog("Wire Scan", gsa_log_msg, snapshots) + + if get_option("Generated data file:\n" + get_exec_pars().path +"\n\nSave to ELOG?", "YesNo") == "Yes": + elog("Wire Scan", gsa_log_msg, snapshots) finally: