From ef416da30d86fdbea36728927e1a21fb888ef831 Mon Sep 17 00:00:00 2001 From: voulot_d Date: Tue, 15 Aug 2017 12:12:09 +0200 Subject: [PATCH] Startup --- devices/Beam phase.properties | 6 +++--- devices/CurrentCamera.properties | 24 ++++++++++++------------ devices/camtool.properties | 10 +++++----- script/CPython/{ext.py => extremum.py} | 8 ++++---- script/CPython/wrapper.py | 7 +++---- script/RFscan/phase_scan_caqtdm.py | 4 ++-- script/test/GunEnergyScan_dv.py | 12 +++++++----- 7 files changed, 36 insertions(+), 35 deletions(-) rename script/CPython/{ext.py => extremum.py} (67%) diff --git a/devices/Beam phase.properties b/devices/Beam phase.properties index 220582d..468e1ae 100644 --- a/devices/Beam phase.properties +++ b/devices/Beam phase.properties @@ -1,6 +1,6 @@ -#Tue Aug 15 09:48:10 CEST 2017 -maxValue=360.0 -minValue=-360.0 +#Tue Aug 15 10:08:21 CEST 2017 +maxValue=180.0 +minValue=-180.0 offset=0.0 precision=3 resolution=0.01 diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index e3b4349..96a9494 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,16 +1,16 @@ -#Tue Aug 15 09:48:16 CEST 2017 +#Tue Aug 15 10:16:59 CEST 2017 colormap=Flame -colormapAutomatic=true -colormapMax=173.0 -colormapMin=59.0 +colormapAutomatic=false +colormapMax=700.0 +colormapMin=0.0 flipHorizontally=false flipVertically=false grayscale=false -imageHeight=2160 -imageWidth=2560 +imageHeight=1680 +imageWidth=1744 invert=false -regionStartX=1 -regionStartY=1 +regionStartX=433 +regionStartY=241 rescaleFactor=1.0 rescaleOffset=0.0 roiHeight=-1 @@ -21,9 +21,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=localhost\:10000 -spatialCalOffsetX=-861.4939970777481 -spatialCalOffsetY=-820.4883730911062 -spatialCalScaleX=-18.90359092620482 -spatialCalScaleY=-19.37984500632817 +spatialCalOffsetX=-221.59249098828724 +spatialCalOffsetY=-211.50118443104964 +spatialCalScaleX=-26.71415910899799 +spatialCalScaleY=-27.100271628191805 spatialCalUnits=mm transpose=false diff --git a/devices/camtool.properties b/devices/camtool.properties index e265dfb..38153fe 100644 --- a/devices/camtool.properties +++ b/devices/camtool.properties @@ -1,4 +1,4 @@ -#Mon Aug 14 14:27:21 CEST 2017 +#Tue Aug 15 09:56:35 CEST 2017 colormap=Flame colormapAutomatic=true colormapMax=578.797 @@ -18,9 +18,9 @@ roiY=0 rotation=0.0 rotationCrop=false scale=1.0 -spatialCalOffsetX=487.729537366548 -spatialCalOffsetY=405.94160583941607 -spatialCalScaleX=1.0 -spatialCalScaleY=1.0 +spatialCalOffsetX=-861.4939970777481 +spatialCalOffsetY=-820.4883730911062 +spatialCalScaleX=-18.90359092620482 +spatialCalScaleY=-19.37984500632817 spatialCalUnits=mm transpose=false diff --git a/script/CPython/ext.py b/script/CPython/extremum.py similarity index 67% rename from script/CPython/ext.py rename to script/CPython/extremum.py index afae98c..13ec655 100644 --- a/script/CPython/ext.py +++ b/script/CPython/extremum.py @@ -1,18 +1,18 @@ import numpy as np -def ext(x, y): +def extremum(x, y): """ Return extremum coordinates of quadratic fit """ p = np.polyfit(x, y, 2) f = np.poly1d(p) - x_fit = 1.0 #np.linspace(min(x), max(x), 100) - #y_fit = 2.0 #f(x_fit) if p[0] != 0: x_ext = -p[1]/2/p[0] y_ext = f(x_ext) else: x_ext = None y_ext = None - return (x_ext, y_ext, x_ext) + x_fit = np.linspace(min(x), max(x), 100) + y_fit = f(x_fit) + return (x_ext, y_ext, x_fit, y_fit) diff --git a/script/CPython/wrapper.py b/script/CPython/wrapper.py index d159574..b5dc4f4 100644 --- a/script/CPython/wrapper.py +++ b/script/CPython/wrapper.py @@ -4,10 +4,9 @@ def hfitoff(data, xdeg): ret = call_jep("CPython/hfitoff", "hfitoff", [to_npa(data),to_npa(xdeg)]) return (ret[0], ret[1], ret[2],ret[3], ret[4].data, ret[5].data) -def ext(x, y): - ret = call_jep("CPython/ext", "ext", [to_npa(x),to_npa(y)]) - #return (ret[0], ret[1], ret[2].data, ret[3].data) - return (ret[0], ret[1], ret[2]) +def extremum(x, y): + ret = call_jep("CPython/extremum", "extremum", [to_npa(x),to_npa(y)]) + return (ret[0], ret[1], ret[2].data, ret[3].data) def gfitoff(x, y, off=None, amp=None, com=None, sigma=None): ret = call_jep("CPython/gfitoff", "gfitoff", [to_npa(x), to_npa(y), off, amp, com, sigma]) diff --git a/script/RFscan/phase_scan_caqtdm.py b/script/RFscan/phase_scan_caqtdm.py index 3d54a27..8db4b39 100644 --- a/script/RFscan/phase_scan_caqtdm.py +++ b/script/RFscan/phase_scan_caqtdm.py @@ -1,8 +1,8 @@ import ch.psi.pshell.epics.Positioner as Positioner import ch.psi.pshell.epics.ChannelDouble as ChannelDouble -dry_run = False -do_elog = True +dry_run = True +do_elog = FalseTrue if get_exec_pars().source == CommandSource.ui: station = "STEST01" diff --git a/script/test/GunEnergyScan_dv.py b/script/test/GunEnergyScan_dv.py index a77c8b4..1cef900 100644 --- a/script/test/GunEnergyScan_dv.py +++ b/script/test/GunEnergyScan_dv.py @@ -63,7 +63,7 @@ dx = camtool.stream.getChild("x_fit_standard_deviation") #Creating averagers x_averager = create_averager(x, nb, -1) # -1 event based, waits for the next value dx_averager = create_averager(dx, nb, -1) -dx_averager.monitored=True # not blocking, will return last nb values +dx_averager.monitored = True # not blocking, will return last nb values #Record callback: uptate of output plot def after_sample(record, scan): @@ -93,10 +93,12 @@ save_dataset(get_exec_pars().group + "/p", p) save_dataset(get_exec_pars().group + "/dp", dp) try: run("CPython/wrapper") - (ph_p_max, p_max, ph_p_fit, p_fit) = ext(ph[i_max-5:i_max+6], p[i_max-5:i_max+6]) - (ph_dp_min, dp_min, ph_dp_fit, dp_fit) = ext(ph[i_min-5:i_min+6], dp[i_min-5:i_min+6]) - #plt.getSeries(2).appendData(ph_p_fit, p_fit) - #plt.getSeries(3).appendData(ph_dp_fit, dp_fit) + i_max = p.index(max(p)) + i_min = dp.index(min(dp)) + (ph_p_max, p_max, ph_p_fit, p_fit) = extremum(ph[i_max-5:i_max+6], p[i_max-5:i_max+6]) + (ph_dp_min, dp_min, ph_dp_fit, dp_fit) = extremum(ph[i_min-5:i_min+6], dp[i_min-5:i_min+6]) + plt.getSeries(2).appendData(ph_p_fit, p_fit) + plt.getSeries(3).appendData(ph_dp_fit, dp_fit) except: raise Exception("Fit failure")