From d16273f3b400bcfeab09962d243b693b78320aae Mon Sep 17 00:00:00 2001 From: sfop Date: Wed, 24 May 2017 11:02:20 +0200 Subject: [PATCH] Startup --- devices/CurrentCamera.properties | 14 ++++---- devices/camtool.properties | 10 +++--- script/Alignment/Gun_solenoid_alignment.py | 2 ++ script/local.py | 41 ++++++++++++++++++++++ 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 8e3e28f..c28690a 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,10 +1,10 @@ -#Mon May 22 15:31:27 CEST 2017 +#Wed May 24 10:37:50 CEST 2017 colormap=Flame colormapAutomatic=true -colormapMax=0.0 +colormapMax=20.0 colormapMin=0.0 flipHorizontally=false -flipVertically=false +flipVertically=true grayscale=false imageHeight=1200 imageWidth=1246 @@ -21,9 +21,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=localhost\:10000 -spatialCalOffsetX=-630.5060320164276 -spatialCalOffsetY=-612.5104241897614 -spatialCalScaleX=-26.761820720381525 -spatialCalScaleY=-26.595744663521685 +spatialCalOffsetX=-642.0 +spatialCalOffsetY=-609.0 +spatialCalScaleX=-26.85765443151298 +spatialCalScaleY=-27.124773960217 spatialCalUnits=mm transpose=false diff --git a/devices/camtool.properties b/devices/camtool.properties index 89f7fc3..b4c6b11 100644 --- a/devices/camtool.properties +++ b/devices/camtool.properties @@ -1,4 +1,4 @@ -#Thu May 11 11:13:46 CEST 2017 +#Wed May 24 10:23:44 CEST 2017 colormap=Flame colormapAutomatic=true colormapMax=578.797 @@ -18,9 +18,9 @@ roiY=0 rotation=0.0 rotationCrop=false scale=1.0 -spatialCalOffsetX=-630.5060320164276 -spatialCalOffsetY=-612.5104241897614 -spatialCalScaleX=-26.761820720381525 -spatialCalScaleY=-26.595744663521685 +spatialCalOffsetX=-642.5156395013756 +spatialCalOffsetY=-609.5079128412647 +spatialCalScaleX=-26.85765405371486 +spatialCalScaleY=-27.12477275985196 spatialCalUnits=mm transpose=false diff --git a/script/Alignment/Gun_solenoid_alignment.py b/script/Alignment/Gun_solenoid_alignment.py index 07abcc4..b779dcd 100755 --- a/script/Alignment/Gun_solenoid_alignment.py +++ b/script/Alignment/Gun_solenoid_alignment.py @@ -86,6 +86,8 @@ try: sensors = [image_stats.com_x_mean, image_stats.com_y_mean, image_stats.com_x_stdev, image_stats.com_y_stdev] else: sensors = get_camtool_stats(number_images, good_region=use_good_region) + + if plot_image: sensors.append(camtool.getDataMatrix()) r = lscan(gun_solenoid, sensors , I1, I2, dI, settling_time, before_read = before_sample, after_read = after_sample) diff --git a/script/local.py b/script/local.py index 7582319..83ebf81 100755 --- a/script/local.py +++ b/script/local.py @@ -230,17 +230,58 @@ class CamtoolImage(ReadableMatrix): def wait_camtool_message(number_messages = 1, timeout = 10000): for i in range (number_messages): if not camtool.stream.waitCacheChange(timeout): raise Exception("Timeout receiving from Camtool") + + +#Temporary wokarounbd + +class CamtoolComX(ReadonlyRegisterBase): + def doRead(self): + v = camtool.getValue("x_profile") + x = camtool.getValue("x_axis") + s = 0 + p = 0 + for i in range(len(v)): + s += x[i]*v[i] + p += v[i] + return s / p + +class CamtoolComY(ReadonlyRegisterBase): + def doRead(self): + v = camtool.getValue("y_profile") + x = camtool.getValue("y_axis") + s = 0 + p = 0 + for i in range(len(v)): + s += x[i]*v[i] + p += v[i] + return s / p + +class CamtoolComErrorX(ReadonlyRegisterBase): + def doRead(self): + return 0.0 + +class CamtoolComErrorY(ReadonlyRegisterBase): + def doRead(self): + return 0.0 + def get_camtool_stats(number_images=1, async = True, interval=-1, good_region = False): #return [CamtoolValue("gr_x_fit_mean"), CamtoolValue("gr_y_fit_mean"), CamtoolValue("gr_x_fit_standard_deviation"), CamtoolValue("gr_y_fit_standard_deviation")] ret = [] wait_camtool_message() prefix = "gr_" if good_region else "" + """ for ident in [prefix+"x_fit_mean", prefix+"y_fit_mean", prefix+"x_fit_standard_deviation", prefix+"y_fit_standard_deviation"]: child = camtool.stream.getChild(ident) av = create_averager(child, number_images, interval) av.monitored = async ret.append(av) + """ + for dev in [CamtoolComX(), CamtoolComY(), CamtoolComErrorX(), CamtoolComErrorY()]: + dev.initialize() + av = create_averager (dev, number_images, 1/2.5)#(dev, number_images, interval) + #av.monitored = async + ret.append(av) return ret