From afc2e08082adfeedd8a74ae6491144f6e2bfe2f3 Mon Sep 17 00:00:00 2001 From: follath_r Date: Fri, 1 Sep 2017 16:50:53 +0200 Subject: [PATCH] Startup --- devices/camtool.properties | 24 ++++++++++++++++++++++++ devices/pbps53_mx.properties | 15 +++++++++++++++ devices/pbps53_my.properties | 15 +++++++++++++++ script/PbpsPosXScan.py | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 devices/camtool.properties create mode 100644 devices/pbps53_mx.properties create mode 100644 devices/pbps53_my.properties create mode 100644 script/PbpsPosXScan.py diff --git a/devices/camtool.properties b/devices/camtool.properties new file mode 100644 index 0000000..c936e02 --- /dev/null +++ b/devices/camtool.properties @@ -0,0 +1,24 @@ +#Fri Sep 01 16:50:52 CEST 2017 +colormap=Grayscale +colormapAutomatic=false +colormapMax=NaN +colormapMin=NaN +flipHorizontally=false +flipVertically=false +grayscale=false +invert=false +rescaleFactor=1.0 +rescaleOffset=0.0 +roiHeight=-1 +roiWidth=-1 +roiX=0 +roiY=0 +rotation=0.0 +rotationCrop=false +scale=1.0 +spatialCalOffsetX=NaN +spatialCalOffsetY=NaN +spatialCalScaleX=NaN +spatialCalScaleY=NaN +spatialCalUnits=mm +transpose=false diff --git a/devices/pbps53_mx.properties b/devices/pbps53_mx.properties new file mode 100644 index 0000000..810f1dc --- /dev/null +++ b/devices/pbps53_mx.properties @@ -0,0 +1,15 @@ +#Fri Sep 01 16:45:14 CEST 2017 +defaultSpeed=1.5 +estbilizationDelay=0 +hasEnable=false +homingType=None +maxSpeed=NaN +maxValue=1.0 +minSpeed=NaN +minValue=-1.0 +offset=0.0 +precision=3 +resolution=1.953125E-5 +rotation=false +scale=1.0 +unit=mm diff --git a/devices/pbps53_my.properties b/devices/pbps53_my.properties new file mode 100644 index 0000000..810f1dc --- /dev/null +++ b/devices/pbps53_my.properties @@ -0,0 +1,15 @@ +#Fri Sep 01 16:45:14 CEST 2017 +defaultSpeed=1.5 +estbilizationDelay=0 +hasEnable=false +homingType=None +maxSpeed=NaN +maxValue=1.0 +minSpeed=NaN +minValue=-1.0 +offset=0.0 +precision=3 +resolution=1.953125E-5 +rotation=false +scale=1.0 +unit=mm diff --git a/script/PbpsPosXScan.py b/script/PbpsPosXScan.py new file mode 100644 index 0000000..480a08e --- /dev/null +++ b/script/PbpsPosXScan.py @@ -0,0 +1,35 @@ +from mathutils import fit_polynomial +from mathutils import PolynomialFunction +import math +from plotutils import plot_function +print "Starting" + + +#Creating averaging devices +av_hamp_x = create_averager(hamp_x, count = 10, interval = -1, name = "av_hamp_x") +av_xbpm_x = create_averager(xbpm_x, count = 10, interval = -1, name = "av_xbpm_x") +#av_hamp_x.monitored = True +av_xbpm_x.monitored = True + +#The actuals scan +r=lscan(pbpg_mx, [av_hamp_x, av_xbpm_x], -0.5, 0.5, 20, latency = 0.0) + +#Fitting +values = to_array(r.getReadable(0), 'd') +positions = r.getPositions(0) +pars_polynomial = (a0, a1) = fit_polynomial(values, positions, 1) + +#Writing metadata to data file +path = get_exec_pars().scanPath +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) + +