From b32184d400490f9f9e6a1f989635d0526c918b80 Mon Sep 17 00:00:00 2001
From: Emanuele Laface <emanuele.laface@esss.se>
Date: Wed, 5 Jun 2019 15:16:59 +0200
Subject: [PATCH] Fix FC decimated PV

---
 PythonServer/pos-python-server.py | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/PythonServer/pos-python-server.py b/PythonServer/pos-python-server.py
index d821de3..f6fa4ed 100755
--- a/PythonServer/pos-python-server.py
+++ b/PythonServer/pos-python-server.py
@@ -107,9 +107,7 @@ class epicsQuery(Thread):
         publicpvs['NSO-LCR:Ops:MSL']=epics.PV('NSO-LCR:Ops:MSL', auto_monitor=True) # Shift Leader
         publicpvs['ISrc-010:PBI-BCM-001:AI4-Compressed']=epics.PV('ISrc-010:PBI-BCM-001:AI4-Compressed', auto_monitor=True) # IS BCM
         publicpvs['LEBT-010:PBI-BCM-001:AI5-Compressed']=epics.PV('LEBT-010:PBI-BCM-001:AI5-Compressed', auto_monitor=True) # LEBT BCM
-        publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData']=epics.PV('LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData', auto_monitor=True) # LEBT FC
-        publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-StartR']=epics.PV('LEBT-020:PBI-FC-001:AMC31-AOI11-StartR', auto_monitor=True) # LEBT FC Start
-        publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-SizeR']=epics.PV('LEBT-020:PBI-FC-001:AMC31-AOI11-SizeR', auto_monitor=True) # LEBT FC Size
+        publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayDataComp']=epics.PV('LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayDataComp', auto_monitor=True) # LEBT FC
         publicpvs['LEBT-020:PBI-FC-001:MCU08-PositionR']=epics.PV('LEBT-020:PBI-FC-001:MCU08-PositionR', auto_monitor=True) # FC Position
         publicpvs['ISrc-010:ISS-EVR-Magtr:Event-14-Cnt-I']=epics.PV('ISrc-010:ISS-EVR-Magtr:Event-14-Cnt-I', auto_monitor=True) # Pulse Number
         
@@ -144,9 +142,7 @@ class epicsQuery(Thread):
         instruments['LEBT-020:PBI-NPM-002:VCAM-SCALEFACT']=epics.PV('LEBT-020:PBI-NPM-002:VCAM-SCALEFACT', auto_monitor=True)
         instruments['ISrc-010:PBI-BCM-001:AI4-Compressed']=publicpvs['ISrc-010:PBI-BCM-001:AI4-Compressed']
         instruments['LEBT-010:PBI-BCM-001:AI5-Compressed']=publicpvs['LEBT-010:PBI-BCM-001:AI5-Compressed']
-        instruments['LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData']=publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData']
-        instruments['LEBT-020:PBI-FC-001:AMC31-AOI11-StartR']=publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-StartR']
-        instruments['LEBT-020:PBI-FC-001:AMC31-AOI11-SizeR']=publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-SizeR']
+        instruments['LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayDataComp']=publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayDataComp']
         instruments['LEBT-020:PBI-FC-001:MCU08-PositionR']=publicpvs['LEBT-020:PBI-FC-001:MCU08-PositionR']
         instruments['LNS-ISRC-010:PBI-EMV:BUFF-CURRENT']=epics.PV('LNS-ISRC-010:PBI-EMV:BUFF-CURRENT', auto_monitor=True)
         instruments['LNS-ISRC-010:PBI-EMV:MTR.NPTS']=epics.PV('LNS-ISRC-010:PBI-EMV:MTR.NPTS', auto_monitor=True)
@@ -189,12 +185,10 @@ class epicsQuery(Thread):
                         x_data=list(linspace(0,12.8,len(y_data)))
                         publicpvs_return_dict[pv]['value']=list(zip(x_data,y_data))
                         continue
-                    if pv=='LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData':
-                        fc_start = publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-StartR'].value
-                        fc_size = publicpvs['LEBT-020:PBI-FC-001:AMC31-AOI11-SizeR'].value
-                        fc_resizer = int(fc_size/200)
+                    if pv=='LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayDataComp':
+                        fc_resizer = int(len(y_data)/200)
                         y_data=list(publicpvs[pv].value[::fc_resizer])
-                        x_data=list(linspace(fc_start/10000,(fc_start+fc_size)/10000,len(y_data)))
+                        x_data=list(linspace(0,10,len(y_data)))
                         publicpvs_return_dict[pv]['value']=list(zip(x_data,y_data))
                         continue
                     try:
@@ -309,12 +303,10 @@ class epicsQuery(Thread):
                         x_data=list(linspace(0,12.8,len(y_data)))
                         instruments_return_dict[pv]['value']=list(zip(x_data,y_data))
                         continue
-                    if pv=='LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayData':
-                        fc_start = instruments['LEBT-020:PBI-FC-001:AMC31-AOI11-StartR'].value
-                        fc_size = instruments['LEBT-020:PBI-FC-001:AMC31-AOI11-SizeR'].value
-                        fc_resizer = int(fc_size/200)
+                    if pv=='LEBT-020:PBI-FC-001:AMC31-AOI11-ArrayDataComp':
+                        fc_resizer = int(len(y_data)/200)
                         y_data=list(instruments[pv].value[::fc_resizer])
-                        x_data=list(linspace(fc_start/10000,(fc_start+fc_size)/10000,len(y_data)))
+                        x_data=list(linspace(0,10,len(y_data)))
                         instruments_return_dict[pv]['value']=list(zip(x_data,y_data))
                         continue
                     if pv=='LEBT-010:PBI-NPM-001:HCAMFITS-Y_RBV':
-- 
GitLab