Browse Source

Correct naming of CalibrationHandle.py and Bugfix in CorrelationWidget

Matze 4 years ago
parent
commit
ca7df386e4

+ 3 - 3
Docu/chapters/part02-develope.tex

@@ -129,11 +129,11 @@ Class to read and generate timescans files.
 
 This Class is also used outside the KCG.
 
-\subsubsection*{base/backend/CalibrationHandel} 
-This Class handels the Calibration Files and is used by the \code{DataSet} and \code{TimeScan}. 
+\subsubsection*{base/backend/CalibrationHandle} 
+This Class Handles the Calibration Files and is used by the \code{DataSet} and \code{TimeScan}. 
 It contains also an instance of itself which should be used. So don't create a new one.
 \begin{lstlisting}
-		theCalibration = CalibrationHandel()
+		theCalibration = CalibrationHandle()
 \end{lstlisting}
 
 When ever one cals \code{theCalibration.openFile(...)} it returns a identifier. 

+ 35 - 35
KCG/base/backend/CalibrationHandel.py → KCG/base/backend/CalibrationHandle.py

@@ -8,19 +8,19 @@ import traceback
 import datetime
 
 
-class CalibrationHandel(object):
-    """docstring for CalibrationHandel
-    This Class Handels the CalibrationFiles. 
+class CalibrationHandle(object):
+    """docstring for CalibrationHandle
+    This Class Handles the CalibrationFiles. 
     ! You may not make your own instance !
     There is one called 'theCalibration' so just use:
-    'from CalibrationHandel import theCalibration'
+    'from CalibrationHandle import theCalibration'
 
     """
     def __init__(self):
-        super(CalibrationHandel, self).__init__()
-        self.fileHandel = None
+        super(CalibrationHandle, self).__init__()
+        self.fileHandle = None
         self.calibrationFile = ""
-        self.handelList = {}
+        self.HandleList = {}
 
     def openFile(self, calibrationFile, force=False, write=False):
         """
@@ -29,33 +29,33 @@ class CalibrationHandel(object):
         :param force: default False - a already opened file will not be opened again. set True to force reopnening.
         :param write: default False - for internal use only
         """
-        if self.calibrationFile == calibrationFile and not force and self.fileHandel is not None:
+        if self.calibrationFile == calibrationFile and not force and self.fileHandle is not None:
             return calibrationFile
 
-        if calibrationFile in self.handelList.keys():                
+        if calibrationFile in self.HandleList.keys():                
             self.calibrationFile = calibrationFile
-            self.fileHandel = self.handelList[calibrationFile]
+            self.fileHandle = self.HandleList[calibrationFile]
             
             if force:
-                self.fileHandel.close()
+                self.fileHandle.close()
             else:
                 return calibrationFile
 
         if os.path.isfile(calibrationFile):
             try:
-                self.fileHandel = h5py.File(calibrationFile, 'r+' if write else 'r')
-                self.grpX = self.fileHandel['x']
-                self.grpY = self.fileHandel['y']
+                self.fileHandle = h5py.File(calibrationFile, 'r+' if write else 'r')
+                self.grpX = self.fileHandle['x']
+                self.grpY = self.fileHandle['y']
                 self.calibrationFile = calibrationFile
-                self.handelList[self.calibrationFile] = self.fileHandel
+                self.HandleList[self.calibrationFile] = self.fileHandle
                 return calibrationFile
-                #self.handelList["current"] = self.fileHandel
+                #self.HandleList["current"] = self.fileHandle
             except:
                 print('error opening file "{}"'.format(calibrationFile))
-                #self.fileHandel = None    
+                #self.fileHandle = None    
         else:
             print('file "{}" not found'.format(calibrationFile))
-            #self.fileHandel = None
+            #self.fileHandle = None
             return 'None'
         return 'current'
 
@@ -63,15 +63,15 @@ class CalibrationHandel(object):
         if name == "None":
             return
             
-        if len(self.handelList.keys()) == 0:
+        if len(self.HandleList.keys()) == 0:
             raise Exception('No Calibration File Opened!')
 
-        if name in self.handelList.keys() and name != "current":   
+        if name in self.HandleList.keys() and name != "current":   
             self.calibrationFile = name
-            self.fileHandel = self.handelList[name]
-            self.grpX = self.fileHandel['x']
-            self.grpY = self.fileHandel['y']
-            #self.handelList["current"] = self.fileHandel
+            self.fileHandle = self.HandleList[name]
+            self.grpX = self.fileHandle['x']
+            self.grpY = self.fileHandle['y']
+            #self.HandleList["current"] = self.fileHandle
 
         elif name != "current":
             self.openFile(name)
@@ -81,12 +81,12 @@ class CalibrationHandel(object):
             self.openFile(self.calibrationFile, force=True)
 
     def closeHandle(self, name):
-        if name in self.handelList.keys() and name != "current":   
+        if name in self.HandleList.keys() and name != "current":   
             self.setHandle(name)
-            self.fileHandel.close()
-            self.handelList.pop(name)
-            if len(self.handelList):
-                self.setHandle(list(self.handelList.keys())[0])
+            self.fileHandle.close()
+            self.HandleList.pop(name)
+            if len(self.HandleList):
+                self.setHandle(list(self.HandleList.keys())[0])
 
     def getCalibrationValues(self, id='current'):
         if id == 'None':
@@ -112,13 +112,13 @@ class CalibrationHandel(object):
             return 34
         self.setHandle(id)
         try:
-            return self.fileHandel['info']['Sigma']
+            return self.fileHandle['info']['Sigma']
         except:
             return 34
 
     def calibrateY(self, data, adc, id='current'):
         self.setHandle(id)
-        if (self.fileHandel is None) or (id =='None'):
+        if (self.fileHandle is None) or (id =='None'):
             return data
 
         popt = self.grpY[str(adc)][0]
@@ -126,7 +126,7 @@ class CalibrationHandel(object):
 
     def calibrateX(self, adc, c330, c25, f, c25b=4, id='current'):
         self.setHandle(id)
-        if (self.fileHandel is None) or (id == 'None'):
+        if (self.fileHandle is None) or (id == 'None'):
             cascade=0
             if adc < 4:
                 cascade = (c25b-4)*25
@@ -144,7 +144,7 @@ class CalibrationHandel(object):
 
     def correctorX(self, adc, c330, c25, f, c25b=4, id='current'):
         self.setHandle(id)
-        if (self.fileHandel is None) or (id =='None'):
+        if (self.fileHandle is None) or (id =='None'):
             return 0
         try:
             corr=  (self.grpX[str(adc)]['330'][c330] + 
@@ -163,7 +163,7 @@ class CalibrationHandel(object):
 
     def _calibrateX(self, adc, c330, c25, f, c25b=4, id='current'):
         self.setHandle(id)
-        if (self.fileHandel is None) or (id =='None'):
+        if (self.fileHandle is None) or (id =='None'):
             return c330*330 + c25*25 + f*3
 
         x = c330*self.grpX['d330'] + c25*self.grpX['d25'] + f*self.grpX['d3']
@@ -174,4 +174,4 @@ class CalibrationHandel(object):
         return x
 
     
-theCalibration = CalibrationHandel()
+theCalibration = CalibrationHandle()

+ 6 - 6
KCG/base/backend/CalibrationUpdater.py

@@ -27,7 +27,7 @@ try:
     from ... import config
     from ...config import colours, coloursTrans
     from .. import kcgwidget as kcgw
-    from .CalibrationHandel import theCalibration
+    from .CalibrationHandle import theCalibration
     from .constants import KARA
     from .TimeScan import TimeScan
 except:
@@ -35,7 +35,7 @@ except:
     import config
     from config import colours, coloursTrans
     import kcgwidget as kcgw
-    from CalibrationHandel import theCalibration
+    from CalibrationHandle import theCalibration
     from constants import KARA
     from TimeScan import TimeScan
 
@@ -403,7 +403,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
     def updateY(self, isNegativ=0, fittype=EGAUSSB, useFirst=0):
         
         try:
-            self.generateYCalibration(theCalibration.fileHandel, isNegativ, fittype, useFirst)
+            self.generateYCalibration(theCalibration.fileHandle, isNegativ, fittype, useFirst)
         except:
             print('error Calibrating Y')
             traceback.print_exc()
@@ -508,8 +508,8 @@ class CalibrationUpdater(kcgw.KCGWidgets):
     def updateX(self):
         
         try:
-            self.generateXCalibration(theCalibration.fileHandel)
-            self.generateMap(theCalibration.fileHandel)
+            self.generateXCalibration(theCalibration.fileHandle)
+            self.generateMap(theCalibration.fileHandle)
         except:
             
             print('error Calibrating X')
@@ -519,7 +519,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
         print('all Done')
         self.displayParameter()
         self.plot()
-        #self.plotWidget.finetune(peakScanFile, self.fileHandel)
+        #self.plotWidget.finetune(peakScanFile, self.fileHandle)
 
     def generateXCalibration(self, fh):
         grpX = fh['x']

+ 2 - 2
KCG/base/backend/DataSet.py

@@ -10,10 +10,10 @@ import traceback
 
 try:
     #Compatibility Python3 and Python 2
-    from .CalibrationHandel import theCalibration
+    from .CalibrationHandle import theCalibration
     from .constants import KARA
 except:
-    from CalibrationHandel import theCalibration
+    from CalibrationHandle import theCalibration
     from constants import KARA
 
 

+ 2 - 2
KCG/base/backend/TimeScan.py

@@ -10,10 +10,10 @@ import traceback
 
 try:
     #Compatibility Python3 and Python 2
-    from .CalibrationHandel import theCalibration
+    from .CalibrationHandle import theCalibration
     from .constants import KARA
 except:
-    from CalibrationHandel import theCalibration
+    from CalibrationHandle import theCalibration
     from constants import KARA
 
 

+ 1 - 1
KCG/base/backendinterface.py

@@ -16,7 +16,7 @@ import numpy as np
 from .backend import board
 from .backend.board import available_boards
 from .backend.DataSet import DataSet
-from .backend.CalibrationHandel import theCalibration
+from .backend.CalibrationHandle import theCalibration
 from .groupedelements import Buttons, Elements, live_plot_windows, cuda_windows
 from . import storage
 from .. import config

+ 1 - 1
KCG/base/kcg.py

@@ -15,7 +15,7 @@ from .MultiWidget import MultiWidget
 from .groupedelements import MenuItems, Elements
 from .backend.board import available_boards
 from .backend import board
-from .backend.CalibrationHandel import theCalibration
+from .backend.CalibrationHandle import theCalibration
 from .MultiPage import MultiPage
 from .globals import glob as global_objects
 from . import bitsTable as bt

+ 1 - 1
KCG/widgets/AcquireSettingsWidget.py

@@ -6,7 +6,7 @@ from collections import OrderedDict
 
 from ..base import kcgwidget as kcgw
 from ..base.backend import board
-from ..base.backend.CalibrationHandel import theCalibration
+from ..base.backend.CalibrationHandle import theCalibration
 from ..base.backend.board import available_boards
 from ..base import backendinterface as bif
 from ..base.groupedelements import Elements

+ 3 - 3
KCG/widgets/CorrelationWidget.py

@@ -31,7 +31,7 @@ try:
     from ..base.backend.TimeScan import TimeScan
     from .. import config
     from ..config import colours, coloursTrans
-    from ..base.backend.CalibrationHandel import theCalibration
+    from ..base.backend.CalibrationHandle import theCalibration
     from ..base.globals import glob as global_objects
     from .CorrelationCorrection import CorrelationCorrection
     from ..base import storage
@@ -43,7 +43,7 @@ except:
     import config
     from config import colours, coloursTrans
     import kcgwidget as kcgw
-    from CalibrationHandel import theCalibration
+    from CalibrationHandle import theCalibration
     from constants import KARA
     from TimeScan import TimeScan
     from DataSet  import DataSet
@@ -125,7 +125,7 @@ class CorrelationWidget(kcgw.KCGWidgets):
             self.settingsLayout.addWidget(self.text_label, lineindex-3, 2,1,2)
             self.text_label = QtGui.QLabel(tmp.host)
             self.settingsLayout.addWidget(self.text_label, lineindex-2, 2,1,2)
-            self.text_label = QtGui.QLabel(tmp.remotepath)
+            self.text_label = QtGui.QLabel(tmp.remotePath)
             self.settingsLayout.addWidget(self.text_label, lineindex-1,   2,1,2)
 
         self.oTS_btn = QtGui.QPushButton("Open Timescan")

+ 1 - 1
KCG/widgets/TimescanWidget.py

@@ -23,7 +23,7 @@ from ..base.globals import glob as global_objects
 from .. import config
 from ..config import colours, coloursTrans
 from ..base import storage
-from ..base.backend.CalibrationHandel import theCalibration
+from ..base.backend.CalibrationHandle import theCalibration
 from . import UpdateCalibrationWidget
 from . import CorrelationWidget
 import logging

+ 1 - 1
KCG/widgets/TimingWidget.py

@@ -16,7 +16,7 @@ from ..base.groupedelements import Elements
 from ..base.globals import glob as global_objects
 from .. import config
 from ..base import storage
-from ..base.backend.CalibrationHandel import theCalibration
+from ..base.backend.CalibrationHandle import theCalibration
 
 tr = kcgw.tr
 import os