From aa4f229f80f02c9fa2588b7193b2326c6266223f Mon Sep 17 00:00:00 2001 From: Giulio Gaio <giulio.gaio@elettra.eu> Date: Fri, 21 Jan 2022 23:29:29 +0100 Subject: [PATCH] Fixed circular buffer shift direction --- src/CalcStats.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/CalcStats.py b/src/CalcStats.py index f8a3d66..cb513e2 100755 --- a/src/CalcStats.py +++ b/src/CalcStats.py @@ -497,36 +497,36 @@ class DeviceObj: attribute = self.prefix()+'{:03d}_MinMax_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.minmax; selfseq_dev.write_attribute(attribute,val) - if self.tag == SENSOR_TAG: - for target in target_dev: - if target.enable == True: - if self.enable_targets & (1 << target.index): + if self.tag == SENSOR_TAG: + for target in target_dev: + if target.enable == True: + if self.enable_targets & (1 << target.index): attribute='s{:03d}_t{:03d}_Corr'.format(self.index+1,target.index+1) - selfseq_dev.write_attribute(attribute,self.corr[target.index]); + selfseq_dev.write_attribute(attribute,self.corr[target.index]); attribute='s{:03d}_t{:03d}_CorrFiltAbs'.format(self.index+1,target.index+1) - selfseq_dev.write_attribute(attribute,self.lp_filter_corr[target.index]); + selfseq_dev.write_attribute(attribute,self.lp_filter_corr[target.index]); attribute='s{:03d}_t{:03d}_CorrHigh'.format(self.index+1,target.index+1) - selfseq_dev.write_attribute(attribute,self.corr_high[target.index]); + selfseq_dev.write_attribute(attribute,self.corr_high[target.index]); attribute='s{:03d}_t{:03d}_CorrLow'.format(self.index+1,target.index+1) - selfseq_dev.write_attribute(attribute,self.corr_low[target.index]); + selfseq_dev.write_attribute(attribute,self.corr_low[target.index]); attribute='s{:03d}_t{:03d}_Direction'.format(self.index+1,target.index+1) selfseq_dev.write_attribute(attribute,self.sensor_direction[target.index]); - + # History for Corr, CorrFiltAbs, CorrLow, CorrHigh # corr - attribute = self.prefix()+'s{:03d}_t{:03d}_Corr_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute ='s{:03d}_t{:03d}_Corr_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.corr[target.index]; selfseq_dev.write_attribute(attribute,val) # corrfiltabs - attribute = self.prefix()+'s{:03d}_t{:03d}_CorrFiltAbs_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute = 's{:03d}_t{:03d}_CorrFiltAbs_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.lp_filter_corr[target.index]; selfseq_dev.write_attribute(attribute,val) # corrlow - attribute = self.prefix()+'s{:03d}_t{:03d}_CorrLow_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute = 's{:03d}_t{:03d}_CorrLow_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.corr_low[target.index]; selfseq_dev.write_attribute(attribute,val) # corrhigh - attribute = self.prefix()+'s{:03d}_t{:03d}_CorrHigh_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute = 's{:03d}_t{:03d}_CorrHigh_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.corr_high[target.index]; selfseq_dev.write_attribute(attribute,val) elif self.tag == TARGET_TAG: @@ -546,19 +546,19 @@ class DeviceObj: # History for Corr, CorrFiltAbs, CorrLow, CorrHigh # corr - attribute = self.prefix()+'t{:03d}_t{:03d}_Corr_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute = 't{:03d}_t{:03d}_Corr_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.corr[target.index]; selfseq_dev.write_attribute(attribute,val) # corrfiltabs - attribute = self.prefix()+'t{:03d}_t{:03d}_CorrFiltAbs_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute = 't{:03d}_t{:03d}_CorrFiltAbs_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.lp_filter_corr[target.index]; selfseq_dev.write_attribute(attribute,val) # corrlow - attribute = self.prefix()+'t{:03d}_t{:03d}_CorrLow_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute = 't{:03d}_t{:03d}_CorrLow_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.corr_low[target.index]; selfseq_dev.write_attribute(attribute,val) # corrhigh - attribute = self.prefix()+'t{:03d}_t{:03d}_CorrHigh_History'.format(self.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value + attribute = 't{:03d}_t{:03d}_CorrHigh_History'.format(self.index+1,target.index+1); val = selfseq_dev.read_attribute(attribute); val = val.value val = np.roll(val, -1);val[-1] = self.corr_high[target.index]; selfseq_dev.write_attribute(attribute,val) -- GitLab