From 1600bd1206b8fa545e262115dacfabe4231ab548 Mon Sep 17 00:00:00 2001 From: sfop Date: Tue, 5 Sep 2017 08:47:06 +0200 Subject: [PATCH] Startup --- devices/CurrentCamera.properties | 24 +++++++++--------- devices/cam_server.properties | 14 +++++------ script/test/PBPGMonitor.py | 27 +++++++++++--------- script/test/didier.py | 33 ------------------------ script/test/scan_example_dv.py | 43 ++++++++++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 64 deletions(-) delete mode 100644 script/test/didier.py create mode 100644 script/test/scan_example_dv.py diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 2dab3d0..182663e 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,16 +1,16 @@ -#Fri Sep 01 16:03:41 CEST 2017 -colormap=Grayscale +#Mon Sep 04 15:36:49 CEST 2017 +colormap=Flame colormapAutomatic=true -colormapMax=65535.0 -colormapMin=68.0 +colormapMax=450.0 +colormapMin=70.0 flipHorizontally=false flipVertically=false grayscale=false -imageHeight=494 -imageWidth=659 +imageHeight=2148 +imageWidth=2272 invert=false -regionStartX=0 -regionStartY=0 +regionStartX=129 +regionStartY=7 rescaleFactor=1.0 rescaleOffset=0.0 roiHeight=-1 @@ -21,9 +21,9 @@ rotation=0.0 rotationCrop=false scale=1.0 serverURL=localhost\:10000 -spatialCalOffsetX=-640.5003909304144 -spatialCalOffsetY=-512.5004887585533 -spatialCalScaleX=-8.4375 -spatialCalScaleY=-8.49609375 +spatialCalOffsetX=-50.075987841945285 +spatialCalOffsetY=-50.10141987829615 +spatialCalScaleX=-1.0 +spatialCalScaleY=-1.0 spatialCalUnits=mm transpose=false diff --git a/devices/cam_server.properties b/devices/cam_server.properties index 5f065ec..947034b 100644 --- a/devices/cam_server.properties +++ b/devices/cam_server.properties @@ -1,6 +1,6 @@ -#Tue Aug 29 17:11:34 CEST 2017 -colormap=Grayscale -colormapAutomatic=false +#Mon Sep 04 11:07:31 CEST 2017 +colormap=Flame +colormapAutomatic=true colormapMax=NaN colormapMin=NaN flipHorizontally=false @@ -16,9 +16,9 @@ roiY=0 rotation=0.0 rotationCrop=false scale=1.0 -spatialCalOffsetX=NaN -spatialCalOffsetY=NaN -spatialCalScaleX=NaN -spatialCalScaleY=NaN +spatialCalOffsetX=-50.075987841945285 +spatialCalOffsetY=-50.10141987829615 +spatialCalScaleX=-1.0 +spatialCalScaleY=-1.0 spatialCalUnits=mm transpose=false diff --git a/script/test/PBPGMonitor.py b/script/test/PBPGMonitor.py index 33f0be2..e3a948f 100644 --- a/script/test/PBPGMonitor.py +++ b/script/test/PBPGMonitor.py @@ -1,19 +1,22 @@ +#Creating the raw channel device and the averager #ch1 = Channel("SARFE10-PBPG050:HAMP-INTENSITY",'d',alias="CH1") ch1 = create_channel_device("SARFE10-PBPG050:HAMP-INTENSITY", type='d', size=None, deviceName="CH1" ) av1 = create_averager(ch1, count = 30, interval = 1.0, name="AV1") ch1.monitored = True av1.monitored = True - -class StDev(ReadonlyRegisterBase): - def doRead(self): - global av1 - return av1.getStdev().read() - - -stdev1 = StDev() -stdev1.initialize() -stdev1.setPolling(0.1) - add_device(ch1, True) add_device(av1, True) -add_device(stdev1, True) + +#Creating a pseudo-device reading the stdev +class StDev(ReadonlyRegisterBase): + def doRead(self): + return AV1.stdev.read() +sd1= StDev("SD1") +add_device(sd1, True) + +#Forwarding the change events of the averager to the psudo-device so stripchart is updated +class MyListener (DeviceListener): + def onCacheChanged(self, device, value, former, timestamp, valueChange): + SD1.update() +l1 = MyListener() +av1.addListener(l1) \ No newline at end of file diff --git a/script/test/didier.py b/script/test/didier.py deleted file mode 100644 index a0ea99f..0000000 --- a/script/test/didier.py +++ /dev/null @@ -1,33 +0,0 @@ -import ch.psi.pshell.epics.ChannelDouble as ChannelDouble -A1 = ChannelDouble("Actuator1", "SINSB03-RSYS:GET-BEAM-PHASE") -A2 = ChannelDouble("Actuator2", "SINSB04-RSYS:GET-BEAM-PHASE") -S1 = ChannelDouble("Sensor1", "SARFE10-PBPG050:HAMP-INTENSITY") -S2 = ChannelDouble("Sensor2", "SARFE10-PBPG050:PHOTON-ENERGY-PER-SECOND-US") -A1.initialize() -A2.initialize() -S1.initialize() -S2.initialize() -A1_0 = A1.read() -A2_0 = A2.read() -start = 0.0 -stop = 10.0 -step = 0.1 -nb = 2 -lat = 0.080 -try: - S1_averager = create_averager(S1, nb, lat) - S2_averager = create_averager(S2, nb, lat) - S2_averager.monitored=True - r = lscan((A1, A2), (S1_averager, S2_averager), start, stop, step, latency=lat) - Act1 = r.getPositions(0) - Act2 = r.getPositions(1) - S1mean = [val.mean for val in r.getReadable(0)] - S1rms = [val.stdev for val in r.getReadable(0)] - S2mean = [val.mean for val in r.getReadable(1)] - S2rmsn = [val.stdev for val in r.getReadable(1)] -finally: - A1.write(A1_0) - A2.write(A2_0) - A1.close() - S1.close() - S2.close() \ No newline at end of file diff --git a/script/test/scan_example_dv.py b/script/test/scan_example_dv.py new file mode 100644 index 0000000..2c3bc5d --- /dev/null +++ b/script/test/scan_example_dv.py @@ -0,0 +1,43 @@ +import ch.psi.pshell.epics.ChannelDouble as ChannelDouble +A1 = ChannelDouble("Actuator1", "SINEG01-RSYS:SET-BEAM-PHASE-SIM") +A2 = ChannelDouble("Actuator2", "SINEG01-RSYS:SET-BEAM-PHASE-SIM") +S1 = ChannelDouble("Sensor1", "SINEG01-DICT215:B1_CHARGE-SIM") +S2 = ChannelDouble("Sensor2", "SINEG01-RSYS:SET-VSUM-PHASE-SIM") +A1.initialize() +A2.initialize() +S1.initialize() +S2.initialize() +A1_init = A1.read() +A2_init = A2.read() +A1i = -10.0 +A1f = 150.0 +A2i = -10.0 +A2f = 150.0 +nstep = 10 +lat = 0.150 +nav = 10 +plt = plot(None, title="Output")[0] +plt.clear() +plt.setStyle(plt.Style.ErrorY) +plt.addSeries(LinePlotErrorSeries("Sensor1", Color.red)) +plt.addSeries(LinePlotErrorSeries("Sensor2", Color.blue)) +def after_sample(record, scan): + plt.getSeries(0).appendData(record.positions[0], record.values[0].mean, record.values[0].stdev) + plt.getSeries(1).appendData(record.positions[0], record.values[1].mean, record.values[1].stdev) +try: + S1_averager = create_averager(S1, nav, lat) + S2_averager = create_averager(S2, nav, lat) + S2_averager.monitored=True + r = lscan((A1, A2), (S1_averager, S2_averager), (A1i, A2i), (A1f, A2f), nstep, latency=lat, after_read = after_sample) + Act1 = r.getPositions(0) + Act2 = r.getPositions(1) + S1mean = [val.mean for val in r.getReadable(0)] + S1rms = [val.stdev for val in r.getReadable(0)] + S2mean = [val.mean for val in r.getReadable(1)] + S2rmsn = [val.stdev for val in r.getReadable(1)] +finally: + A1.write(A1_init) + A2.write(A2_init) + A1.close() + S1.close() + S2.close() \ No newline at end of file