diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 24e1c39..95e8849 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,16 +1,16 @@ -#Thu May 17 10:31:20 CEST 2018 +#Mon Jun 04 11:01:59 CEST 2018 colormap=Flame colormapAutomatic=true -colormapMax=1000.0 +colormapMax=255.0 colormapMin=0.0 flipHorizontally=false flipVertically=false grayscale=false -imageHeight=2160 -imageWidth=2560 +imageHeight=494 +imageWidth=659 invert=false -regionStartX=1 -regionStartY=1 +regionStartX=0 +regionStartY=0 rescaleFactor=1.0 rescaleOffset=0.0 roiHeight=-1 @@ -21,9 +21,10 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=null -spatialCalOffsetX=-606.4867444313851 -spatialCalOffsetY=-602.502078032311 -spatialCalScaleX=-26.714158979668674 -spatialCalScaleY=-27.100271547904505 +spatialCalOffsetX=-1279.4997788627065 +spatialCalOffsetY=-1079.4997788915095 +spatialCalScaleX=-53.02070816236811 +spatialCalScaleY=-53.02454840203798 spatialCalUnits=null +t= transpose=false diff --git a/devices/Gun Phase.properties b/devices/Gun Phase.properties index cbd131e..be91ea7 100644 --- a/devices/Gun Phase.properties +++ b/devices/Gun Phase.properties @@ -1,9 +1,9 @@ -#Thu May 03 15:36:18 CEST 2018 +#Mon May 28 16:52:27 CEST 2018 maxValue=360.0 minValue=-90.0 offset=0.0 precision=4 -resolution=0.1 +resolution=0.5 rotation=true scale=1.0 unit=deg diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties index 47c59db..3ed70ec 100644 --- a/devices/WireScanner motor.properties +++ b/devices/WireScanner motor.properties @@ -1,5 +1,5 @@ -#Mon May 14 14:06:13 CEST 2018 -defaultSpeed=565.685424949238 +#Sat Jun 02 09:39:17 CEST 2018 +defaultSpeed=6000.0 estbilizationDelay=0 hasEnable=false homingType=None diff --git a/devices/cam_server.properties b/devices/cam_server.properties index db1cf09..cad0e25 100644 --- a/devices/cam_server.properties +++ b/devices/cam_server.properties @@ -1,4 +1,4 @@ -#Mon May 14 18:41:08 CEST 2018 +#Fri Jun 01 12:45:57 CEST 2018 colormap=Flame colormapAutomatic=true colormapMax=NaN @@ -16,9 +16,9 @@ roiY=0 rotation=0.0 rotationCrop=false scale=1.0 -spatialCalOffsetX=-797.0771270584523 -spatialCalOffsetY=-195.9069772960574 -spatialCalScaleX=-18.903591543153755 -spatialCalScaleY=-19.379845197810685 +spatialCalOffsetX=-674.4869939208238 +spatialCalOffsetY=-358.5976650464412 +spatialCalScaleX=-18.903591266257227 +spatialCalScaleY=-19.37984449994783 spatialCalUnits=mm transpose=false diff --git a/script/Diagnostics/WireScan.py b/script/Diagnostics/WireScan.py index 7d1a104..a5c10c6 100644 --- a/script/Diagnostics/WireScan.py +++ b/script/Diagnostics/WireScan.py @@ -21,8 +21,8 @@ bkgrd = args[7] if has_args else 10 plt = args[8] if has_args else plot(None, title = "Wire Scan")[0] save_raw = args[9] if has_args else False bunch = args[10] if has_args else 1 -do_elog = True if (is_panel and (not is_script) and (plt is not None)) else False -print is_panel, do_elog +do_elog = True if (has_args and (not is_script) and (plt is not None)) else False +print has_args, do_elog print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, velocity, bpms, blms, bkgrd, bunch @@ -71,7 +71,9 @@ for i in range (len(bpms)): channels.append (("bpm" + str(i+1) + "_" + sensor[0], bpms[i] + ":" + sensor[1])) if SET_BLM_WS_MODE and (len(blms)>0): - channels.append(("blm1_ws_mode", blms[0] + ":WS_RUNNING")) + channels.append(("blm1_ws_mode", blms[0] + ":WS_RUNNING")) +channels.append(("beam_ok", "SIN-CVME-TIFGUN-EVR0:BEAMOK")) + #Metadata set_attribute("/", "Wire Scanner", prefix) @@ -313,7 +315,7 @@ try: st.getChild("blm1_ws_mode").waitValue(1, SET_BLM_WS_BS_READBACK_TIMEOUT) print "Reading background..." do_background() - 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 + st.setFilter(scanner.curr_cycl.get_name() + ">0 AND SIN-CVME-TIFGUN-EVR0:BEAMOK == 1") #scanner.status_channels[0].get_name() + ">0" not used because we must the transition to know when the finished print "Executing scan 1..." do_scan(0) if scan_type in [WireScanner.Set1, WireScanner.Set2]: diff --git a/script/Diagnostics/WireScanCalibration.py b/script/Diagnostics/WireScanCalibration.py index 02a1190..869c7fd 100644 --- a/script/Diagnostics/WireScanCalibration.py +++ b/script/Diagnostics/WireScanCalibration.py @@ -11,12 +11,14 @@ plt = args[1] if is_panel else plot(None, title = "Wire Scan Calibrati ws_blm = get_wire_scanners_blms(ws_prefix )[0] #S10DI01-DBLM113:AL1-WS-PMT-GAIN -SATURATION = 1000 +SATURATION = 19950 / 10 +MIN_GAIN, MAX_GAIN = 0.5, 1.1 OPT_STEP = 0.01 +SCAN_RANGE_FACTOR = 6.0 #2) Set the number of RF shots (N_shot) to be acquired during a single cycle WSC measurement (e.g.,N_shot=50) -n_shot = 50 +n_shot = 200 #3) Set a test scanning range (e.g.,Xmin=-1000,Xmax=+1000um) x_min, x_max = -1000.0, 1000.0 @@ -29,14 +31,15 @@ ws_speed = (x_max- x_min)*rr/n_shot #5) Proceed with a test scan (1 cycle) according to the above defined motor settings args = [ ws_prefix , WireScanner.WireX1, [x_min, x_max, x_min, x_max], 1, ws_speed, [], [ws_blm], 10, plt, False,1] ret = run("Diagnostics/WireScan", args) +[rms_com, rms_sigma, com, sigma, pos_path, path] = ret #1) Select a BLM to be used in the WSC measurement and enable the WS_START so that it can be extracted out of the MPS and PMT-Gain and attenuation can be adjusted -#start_blm_ws(ws_blm, 600.0) +start_blm_ws(ws_blm, 600.0) #6) Apply a gauss fit to the obtained WSC profile in order to determine X_CoM and standard deviation (sigma_Gauss) -[rms_com, rms_sigma, com, sigma, pos_path, path] = ret + #7) Move the wire to the X_CoM position and optimize the PMT-Gain so that the time-integral of the BLM voltage reaches a value equal to 90% of the Σsat level offset = caget(ws_prefix + ":W1X_U0_SP") @@ -44,49 +47,68 @@ motor_pos=offset - com * math.sqrt(2) caput(ws_prefix+":MOTOR_1.VAL", motor_pos) #DVAL? #LOPR:0.5 HOPR:1.1 -def get_gain(): - return caget(ws_blm + ":WS_PMT_GAIN_VOLTS") - -def set_gain(val): - caput(ws_blm + ":WS_PMT_GAIN_VOLTS", float(val)) - print "Starting stream..." st = Stream("blm_stream", dispatcher) ch = ws_blm + ":B1_LOSS" st.addScalar(ch, ch, int(100.0 / get_repetition_rate()), 0) +st.addScalar("blm1_ws_mode", ws_blm + ":WS_RUNNING", int(100.0 / get_repetition_rate()), 0) st.initialize() st.start() st.waitCacheChange(10000) #Wait stream be running before starting scan -def get_loss(): - return st.getValue(ch) +def get_gain(): + return caget(ws_blm + ":WS_PMT_GAIN_VOLTS") + +def set_gain(val): + caput(ws_blm + ":WS_PMT_GAIN_VOLTS", float(val)) + +def get_loss(): + global ch + samples = [] + for i in range(10): + st.waitCacheChange(-1) + val = st.getValue(ch) + samples.append(val) + return max(samples) start_gain = get_gain() pos = start_val = get_loss() loss = get_loss() -target = SATURATION * 0.9 +target = SATURATION * 0.8 print "Start Gain = ", start_gain print "Start Loss = ", start_val print "Target = ", target +def set_bml_ws_gain(gain): + set_gain(gain) + stop_blm_ws(ws_blm) + start_blm_ws(ws_blm, 600.0) + st.getChild("blm1_ws_mode").waitValue(1, SET_BLM_WS_BS_READBACK_TIMEOUT) + if start_val>target: - for pos in range(start_val, target, -OPT_STEP): - set_gain(pos) + for pos in frange(start_gain, MIN_GAIN, -OPT_STEP, True): + set_bml_ws_gain(pos) loss = get_loss() + print "Pos = ", pos, " Loss = ", loss if loss<=target: break -elif start_val=target: - break + stop_blm_ws(ws_blm) +elif start_val