From cf9bc7acfacab584087104a60eae1f74a27ef044 Mon Sep 17 00:00:00 2001 From: gobbo_a Date: Wed, 6 Mar 2019 14:14:42 +0100 Subject: [PATCH] Startup --- config/config.properties | 4 +++- config/devices.properties | 12 +++++------ config/setup.properties | 3 ++- devices/apu44x.properties | 3 ++- devices/apu44y.properties | 3 ++- devices/cam_server.properties | 3 ++- devices/m1ba.properties | 3 ++- devices/m1bb.properties | 3 ++- devices/m2rx.properties | 3 ++- devices/pbpg_mx.properties | 3 ++- devices/pbpg_my.properties | 3 ++- devices/pbps53_mx.properties | 3 ++- devices/pbps53_my.properties | 3 ++- devices/posi.properties | 9 +++++++++ script/PbpgPosXScan.py | 9 ++++++++- script/PbpgSlowXScan.py | 38 +++++++++++++++++++++++++++++++++++ script/PbpgSlowYScan.py | 38 +++++++++++++++++++++++++++++++++++ 17 files changed, 124 insertions(+), 19 deletions(-) create mode 100644 devices/posi.properties create mode 100644 script/PbpgSlowXScan.py create mode 100644 script/PbpgSlowYScan.py diff --git a/config/config.properties b/config/config.properties index 10400f9..72d04ee 100644 --- a/config/config.properties +++ b/config/config.properties @@ -1,5 +1,6 @@ -#Wed Jan 24 10:56:20 CET 2018 +#Tue Feb 12 14:33:52 CET 2019 autoSaveScanData=true +commandExecutionEvents=false createSessionFiles=false dataLayout=default dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name} @@ -16,6 +17,7 @@ logLevel=Fine logLevelConsole=Off logPath={logs}/{date}_{time} notificationLevel=null +saveCommandStatistics=false scanStreamerPort=-1 serverEnabled=false serverPort=8095 diff --git a/config/devices.properties b/config/devices.properties index 304a0cc..27393e3 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,17 +1,17 @@ +pbpg_slow_x=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:SLOW-X|Read||true +pbpg_slow_y=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:SLOW-Y|Read||true dispatcher=ch.psi.pshell.bs.Dispatcher|https://dispatcher-api.psi.ch/sf||| cam_server=ch.psi.pshell.bs.PipelineServer|sf-daqsync-01:8889||| pbps53_mx=ch.psi.pshell.epics.Motor|SARFE10-PBPS053:MOTOR_X1|||true apu44x=ch.psi.pshell.epics.Motor|SARFE10-OAPU044:MOTOR_X|||true -pbps53_ypos=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPS053:YPOS|||true -pbps53_xpos=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPS053:XPOS|||true +pbps53_ypos=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPS053:YPOS|Read||true +pbps53_xpos=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPS053:XPOS|Read||true pbps53_my=ch.psi.pshell.epics.Motor|SARFE10-PBPS053:MOTOR_Y1|||true apu44y=ch.psi.pshell.epics.Motor|SARFE10-OAPU044:MOTOR_Y|||true m1ba=ch.psi.pshell.epics.Motor|SAROP21-OOMV092:BA|||false m1bb=ch.psi.pshell.epics.Motor|SAROP21-OOMV092:BB||| -xbpm_x=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:XBPM-XPOS|||true -xbpm_y=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:XBPM-YPOS|||true -hamp_x=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:HAMP-XPOS|||true -hamp_y=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:HAMP-YPOS|||true +hamp_x=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:HAMP-XPOS|Read||true +hamp_y=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:HAMP-YPOS|Read||true pbpg_mx=ch.psi.pshell.epics.Motor|SARFE10-PBPG050:MOTOR_X|||true pbpg_my=ch.psi.pshell.epics.Motor|SARFE10-PBPG050:MOTOR_Y|||true m2rx=ch.psi.pshell.epics.Motor|SAROP21-OOMV096:W_RX|||true diff --git a/config/setup.properties b/config/setup.properties index e36f005..59403a7 100644 --- a/config/setup.properties +++ b/config/setup.properties @@ -1,7 +1,8 @@ -#Tue Aug 29 16:56:43 CEST 2017 +#Tue Feb 12 14:33:52 CET 2019 configFile={config}/config.properties configFileDevices={config}/devices.properties configFilePlugins={config}/plugins.properties +configFileSettings={config}/settings.properties configFileTasks={config}/tasks.properties configPath={home}/config contextPath={outp}/context diff --git a/devices/apu44x.properties b/devices/apu44x.properties index 446909c..007480c 100644 --- a/devices/apu44x.properties +++ b/devices/apu44x.properties @@ -1,4 +1,4 @@ -#Wed Oct 18 13:40:45 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=1.0 estbilizationDelay=1 hasEnable=false @@ -12,5 +12,6 @@ precision=2 resolution=0.01 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/apu44y.properties b/devices/apu44y.properties index 6000794..7cf057b 100644 --- a/devices/apu44y.properties +++ b/devices/apu44y.properties @@ -1,4 +1,4 @@ -#Wed Oct 18 13:40:45 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=1.0 estbilizationDelay=1 hasEnable=false @@ -12,5 +12,6 @@ precision=2 resolution=0.1 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/cam_server.properties b/devices/cam_server.properties index 64554c9..7d1e4b4 100644 --- a/devices/cam_server.properties +++ b/devices/cam_server.properties @@ -1,6 +1,7 @@ -#Wed Sep 06 09:26:00 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 colormap=Flame colormapAutomatic=true +colormapLogarithmic=false colormapMax=NaN colormapMin=NaN flipHorizontally=false diff --git a/devices/m1ba.properties b/devices/m1ba.properties index 05d3a41..8fbc5e4 100644 --- a/devices/m1ba.properties +++ b/devices/m1ba.properties @@ -1,4 +1,4 @@ -#Wed Oct 18 13:40:45 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=0.05 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=3 resolution=1.0E-6 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/m1bb.properties b/devices/m1bb.properties index 05d3a41..8fbc5e4 100644 --- a/devices/m1bb.properties +++ b/devices/m1bb.properties @@ -1,4 +1,4 @@ -#Wed Oct 18 13:40:45 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=0.05 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=3 resolution=1.0E-6 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/m2rx.properties b/devices/m2rx.properties index 329c8e2..61a519f 100644 --- a/devices/m2rx.properties +++ b/devices/m2rx.properties @@ -1,4 +1,4 @@ -#Wed Oct 18 13:40:45 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=100.0 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=6 resolution=0.001 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mrad diff --git a/devices/pbpg_mx.properties b/devices/pbpg_mx.properties index dc9fb4b..75f8a1f 100644 --- a/devices/pbpg_mx.properties +++ b/devices/pbpg_mx.properties @@ -1,4 +1,4 @@ -#Mon Nov 06 13:38:48 CET 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=1.5 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=3 resolution=0.01 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/pbpg_my.properties b/devices/pbpg_my.properties index bd02d46..75f8a1f 100644 --- a/devices/pbpg_my.properties +++ b/devices/pbpg_my.properties @@ -1,4 +1,4 @@ -#Mon Nov 06 13:39:15 CET 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=1.5 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=3 resolution=0.01 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/pbps53_mx.properties b/devices/pbps53_mx.properties index 95f3882..5ac0f37 100644 --- a/devices/pbps53_mx.properties +++ b/devices/pbps53_mx.properties @@ -1,4 +1,4 @@ -#Wed Oct 18 13:40:45 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=1.5 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=3 resolution=1.953125E-5 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/pbps53_my.properties b/devices/pbps53_my.properties index 95f3882..5ac0f37 100644 --- a/devices/pbps53_my.properties +++ b/devices/pbps53_my.properties @@ -1,4 +1,4 @@ -#Wed Oct 18 13:40:45 CEST 2017 +#Tue Oct 30 09:54:17 CET 2018 defaultSpeed=1.5 estbilizationDelay=0 hasEnable=false @@ -12,5 +12,6 @@ precision=3 resolution=1.953125E-5 rotation=false scale=1.0 +sign_bit=0 startRetries=1 unit=mm diff --git a/devices/posi.properties b/devices/posi.properties new file mode 100644 index 0000000..259c87a --- /dev/null +++ b/devices/posi.properties @@ -0,0 +1,9 @@ +#Thu May 03 14:21:20 CEST 2018 +maxValue=NaN +minValue=NaN +offset=0.0 +precision=-1 +resolution=NaN +rotation=false +scale=1.0 +unit=null diff --git a/script/PbpgPosXScan.py b/script/PbpgPosXScan.py index e367caf..b868d59 100644 --- a/script/PbpgPosXScan.py +++ b/script/PbpgPosXScan.py @@ -17,10 +17,17 @@ r=lscan(pbpg_mx, [av_hamp_x, av_xbpm_x], -1.5, 1.5, 100, latency = 0.0) #Fitting values = to_array(r.getReadable(0), 'd') positions = r.getPositions(0) -pars_polynomial = (a0, a1) = fit_polynomial(values, positions, 1) +try: + pars_polynomial = fit_polynomial(values, positions, 1) +except: + print "Fit error" + raise +print "Plolynomial pars: ", pars_polynomial +(a0, a1) = pars_polynomial #Writing metadata to data file path = get_exec_pars().scanPath +print "Scn path: ", path set_attribute(path, "a0", a0) set_attribute(path, "a1", a1) #set_attribute(path, "a2", a2) diff --git a/script/PbpgSlowXScan.py b/script/PbpgSlowXScan.py new file mode 100644 index 0000000..e2a2df6 --- /dev/null +++ b/script/PbpgSlowXScan.py @@ -0,0 +1,38 @@ +from mathutils import fit_polynomial +from mathutils import PolynomialFunction +import math +from plotutils import plot_function +print "Starting" + + +#Creating averaging devices +avg_x = create_averager(pbpg_slow_x, count = 30, interval = 1, name = "avg_x") + +#The actuals scan +r=lscan(pbpg_mx, avg_x, -1.5, 1.5, 30, latency = 0.0) + +#Fitting +values = to_array(r.getReadable(0), 'd') +positions = r.getPositions(0) +try: + pars_polynomial = fit_polynomial(values, positions, 1) +except: + print "Fit error" + raise + +print "Plolynomial pars: ", pars_polynomial +(a0, a1) = pars_polynomial +#Writing metadata to data file +path = get_exec_pars().scanPath +print "Scn path: ", path +set_attribute(path, "a0", a0) +set_attribute(path, "a1", a1) +#set_attribute(path, "a2", a2) + +#Plotting fit and writing fitting parameters +outp = "a0="+ ("%0.4f" % a0) + "a1="+ ("%0.4f" % a1) +print outp +p = get_plots()[0] +p.addText((min(positions) + max(positions))/2, max(values), outp, Color.BLACK) +plot_function(p, PolynomialFunction(pars_polynomial), "Fit",positions, show_points = False, show_lines = True, color = Color.BLUE) + diff --git a/script/PbpgSlowYScan.py b/script/PbpgSlowYScan.py new file mode 100644 index 0000000..5f8854f --- /dev/null +++ b/script/PbpgSlowYScan.py @@ -0,0 +1,38 @@ +from mathutils import fit_polynomial +from mathutils import PolynomialFunction +import math +from plotutils import plot_function +print "Starting" + + +#Creating averaging devices +avg_y = create_averager(pbpg_slow_y, count = 30, interval = 1, name = "avg_y") + +#The actuals scan +r=lscan(pbpg_my, avg_y, -1.5, 1.5, 30, latency = 0.0) + +#Fitting +values = to_array(r.getReadable(0), 'd') +positions = r.getPositions(0) +try: + pars_polynomial = fit_polynomial(values, positions, 1) +except: + print "Fit error" + raise + +print "Plolynomial pars: ", pars_polynomial +(a0, a1) = pars_polynomial +#Writing metadata to data file +path = get_exec_pars().scanPath +print "Scn path: ", path +set_attribute(path, "a0", a0) +set_attribute(path, "a1", a1) +#set_attribute(path, "a2", a2) + +#Plotting fit and writing fitting parameters +outp = "a0="+ ("%0.4f" % a0) + "a1="+ ("%0.4f" % a1) +print outp +p = get_plots()[0] +p.addText((min(positions) + max(positions))/2, max(values), outp, Color.BLACK) +plot_function(p, PolynomialFunction(pars_polynomial), "Fit",positions, show_points = False, show_lines = True, color = Color.BLUE) +