diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index f8b8215..56c9e99 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,7 +1,7 @@ -#Fri Jun 02 15:29:56 CEST 2017 +#Fri Jun 02 16:04:33 CEST 2017 colormap=Flame colormapAutomatic=false -colormapMax=200.0 +colormapMax=7000.0 colormapMin=10.0 flipHorizontally=false flipVertically=false @@ -21,9 +21,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=localhost\:10000 -spatialCalOffsetX=-1093.4812581603794 -spatialCalOffsetY=-1098.5114274849898 -spatialCalScaleX=-7.617446798629459 -spatialCalScaleY=-7.774538463917676 +spatialCalOffsetX=-308.5490134010733 +spatialCalOffsetY=-258.50687675129035 +spatialCalScaleX=-7.72640887853721 +spatialCalScaleY=-7.804878159918345 spatialCalUnits=mm transpose=false diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties index 5a0e763..fbeae42 100644 --- a/devices/WireScanner motor.properties +++ b/devices/WireScanner motor.properties @@ -1,4 +1,4 @@ -#Fri Jun 02 11:35:28 CEST 2017 +#Fri Jun 02 16:15:44 CEST 2017 defaultSpeed=6000.0 estbilizationDelay=0 hasEnable=false diff --git a/script/RFscan/phase_scan_caqtdm_sim.py b/script/RFscan/phase_scan_caqtdm_sim.py index 8510846..e94dee6 100644 --- a/script/RFscan/phase_scan_caqtdm_sim.py +++ b/script/RFscan/phase_scan_caqtdm_sim.py @@ -12,8 +12,10 @@ stop = caget(station + "-RSYS:SET-SCAN-STOP") step = caget(station + "-RSYS:SET-SCAN-STEP") lat = caget(station + "-RSYS:SET-SCAN-WAIT-TIME") nb = caget(station + "-RSYS:SET-NUM-AVERAGE") -disp = caget(bpm_ch + ":DISPERSION") -energy0 = caget(bpm_ch + ":ENERGY") +#disp = caget(bpm_ch + ":DISPERSION") +#energy0 = caget(bpm_ch + ":ENERGY") +disp = 1 +energy0 = 1000 phase = ControlledVariable("Phase", station + "-RSYS:SET-VSUM-PHASE", station + "-RSYS:SET-VSUM-PHASE") phase.config.minValue =-180.0 @@ -50,19 +52,20 @@ try: energy = [val.mean/1000.0/disp*energy0 for val in r.getReadable(0)] caput(station + "-RSYS:GET-ENERGY-ARRAY", to_array(energy, 'd')) caput(station + "-RSYS:GET-PHASE-ARRAY", to_array(rf_phase,'d')) - phase_fit_max = None try: - (energy_max, angular_frequency, phase0, in_range, phase_fit_max, fit_x, fit_y) = hfit(energy , xdata = rf_phase) + #(energy_max, angular_frequency, phase0, in_range, phase_fit_max, fit_x, fit_y) = hfit(energy , xdata = rf_phase) + (fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y) = hfitoff(energy , rf_phase) except: raise Exception("Fit failure") - caput(station + "-RSYS:GET-ONCREST-VSUM-PHASE", phase_fit_max) + energy_max = fit_amplitude - fit_offset + caput(station + "-RSYS:GET-ONCREST-VSUM-PHASE", ph_crest) caput(station + "-RSYS:GET-ONCREST-E-GAIN", energy_max) caput(station + "-RSYS:GET-FIT-PHASE-ARRAY", fit_x) caput(station + "-RSYS:GET-FIT-ENERGY-ARRAY", fit_y) phase_min, phase_max = min(rf_phase), max(rf_phase) - if not (phase_min <= phase_fit_max <= phase_max): + if not (phase_min <= ph_crest <= phase_max): raise Exception("Fit maximum outside scan range") - phase.write(phase_fit_max) + phase.write(ph_crest) time.sleep(lat) Ampl = V.read() Power = P.read() @@ -78,7 +81,7 @@ finally: print ("------------------------------------") print ("Valid fit") -phase_offset = 90 - phase_fit_max +phase_offset = 90 - ph_crest amplitude_scale = energy_max / Ampl power_scale = Power / math.pow(Ampl,2) diff --git a/script/test/TestHarmonicFitOffset.py b/script/test/TestHarmonicFitOffset.py index 14346fb..567c8b9 100644 --- a/script/test/TestHarmonicFitOffset.py +++ b/script/test/TestHarmonicFitOffset.py @@ -6,4 +6,4 @@ x = [0,10,20,30,40,50, 60, 70, 80, 90, 100] r = hfitoff(y, x) print r -plot([y,r[6]], ["data", "fit"], [x, r[5]]) +plot([y,r[5]], ["data", "fit"], [x, r[4]]) diff --git a/script/test/WireScanEncoderTest.py b/script/test/WireScanEncoderTest.py index af30c2a..db631e6 100644 --- a/script/test/WireScanEncoderTest.py +++ b/script/test/WireScanEncoderTest.py @@ -1,22 +1,33 @@ run("Devices/Elements") run("Devices/WireScanner") -prefix = "S30CB09-DWSC440" -scanner = WireScanner(prefix, [-200, 200, -200, 200], 3, 200, True) +#devices = [ "S30CB09-DWSC440"] +#devices = ["S20SY03-DWSC090"] +devices = ["S20SY03-DWSC090", "S30CB09-DWSC440"] + + +scanners = [] +plots = [] st = Stream("pulse_id", dispatcher) -st.addScalar("m_pos", prefix + ":ENC_1_BS", 1, 0) +for d in devices: + st.addScalar(d + " enc", d + ":ENC_1_BS", 1, 0) + plots.append(d + " enc") + scanners.append(WireScanner(d, [-200, 200, -200, 200], 3, 200, True)) st.initialize() -setup_plotting(enable_plots = "m_pos",domain = "pulse_id") +setup_plotting(enable_plots = plots,domain = "pulse_id") -scanner.set_selection(WireScanner.W1X) -scanner.init(wait=False) +for scanner in scanners: + scanner.set_selection(WireScanner.W1X) + scanner.init(wait=False) bscan(st, 650) -scanner.park(wait=False) - +for scanner in scanners: + scanner.park(wait=False) + bscan(st, 650, title = "Back") -scanner.wait_in_selection() \ No newline at end of file +for scanner in scanners: + scanner.wait_in_selection() \ No newline at end of file diff --git a/script/tmp.py b/script/tmp.py index 581aeeb..bb5ed9f 100644 --- a/script/tmp.py +++ b/script/tmp.py @@ -1,5 +1,12 @@ -run("hfitoff_wrapper") -y = [0,2,5,8,15,25, 20, 16,4,-2,-5] -x = [0,10,20,30,40,50, 60, 70, 80, 90, 100] +y = [ -1.36633487e+01, -1.13808691e+01, -8.92628692e+00, -6.53052299e+00, \ + -5.26897045e+00, -5.75429171e+00, -1.75746114e+00, -1.39318500e-01, \ + -1.04863080e+00, 1.46985567e-02, 1.04432984e+00, 1.14839620e+00, \ + -1.45837648e+00, -2.62571957e+00, -4.64780802e+00, -4.02915206e+00, \ + -6.94357281e+00, -1.02403468e+01, -1.30960565e+01, -1.55355021e+01] +x = [ 50.0, 51.05263158, 52.10526316, 53.15789474, 54.21052632, \ + 55.26315789, 56.31578947, 57.36842105, 58.42105263, 59.47368421, \ + 60.52631579, 61.57894737, 62.63157895, 63.68421053, 64.73684211, \ + 65.78947368, 66.84210526, 67.89473684, 68.94736842, 70. ] + r = hfitoff(y, x) -plot([y,r[6]], ["data", "fit"], [x, r[5]]) +plot([y,r[5]], ["data", "fit"], [x, r[4]]) diff --git a/script/tmp1.py b/script/tmp1.py new file mode 100644 index 0000000..2e01b53 --- /dev/null +++ b/script/tmp1.py @@ -0,0 +1,12 @@ +y = [ -1.36633487e+01, 1.13808691e+01, -8.92628692e+00, 6.53052299e+00, \ + -5.26897045e+00, 5.75429171e+00, -1.75746114e+00, 1.39318500e-01, \ + -1.04863080e+00, 1.46985567e-02, -1.04432984e+00, 1.14839620e+00, \ + -1.45837648e+00, 2.62571957e+00, -4.64780802e+00, 4.02915206e+00, \ + -6.94357281e+00, 1.02403468e+01, -1.30960565e+01, 1.55355021e+01] +x = [ 50.0, 51.05263158, 52.10526316, 53.15789474, 54.21052632, \ + 55.26315789, 56.31578947, 57.36842105, 58.42105263, 59.47368421, \ + 60.52631579, 61.57894737, 62.63157895, 63.68421053, 64.73684211, \ + 65.78947368, 66.84210526, 67.89473684, 68.94736842, 70. ] + +r = hfitoff(y, x) +plot([y,r[5]], ["data", "fit"], [x, r[4]])