2 İşlemeler 1a2dfba53c ... e172aa56dc

Yazar SHA1 Mesaj Tarih
  Matze e172aa56dc docu update 4 yıl önce
  Matze 0675ee378d removed debug prints 4 yıl önce

BIN
Docu/Kapture2 Docu.pdf


+ 22 - 21
Docu/chapters/part01-use.tex

@@ -3,7 +3,27 @@
 \chapter{Using Kapture 2}
 \label{ch:use}
 %% ==============================
-
+\section{Measurement in a nutshell}
+\begin{itemize}
+	\item start-up procedure: Boot PC, switch HighFlex off and on, reboot PC
+	\item Prepare Board can always be used to reset the board
+	\item check that PLL lock LEDs are on
+	\item use internal pilot bunch
+	\item activate HEADER
+	\item T/H FMC2 25ps to 4 is no offset
+	
+	\item Using 500\,MHz reference
+	\begin{enumerate}	
+		\item connect the 125\,MHz 
+		\item do normal init with 125\,MHz reference
+		\item connect the 500\,MHz
+		\item run \textit{PLL swap 125 to 500}, \textit{PLL Synch}, \textit{ADC Synch}
+		\item now it should be working. If log is missing redo step 4. 
+		\item do not run \textit{Board Reset} or other \textit{PLL Init}! Then you would need to redo from beginning.
+		\item If a DMA error etc happens try \textit{soft reset}
+	\end{enumerate}	
+	\item shutdown: Just turn off the PC and the two switches for the T/H.
+\end{itemize}
 
 \section{start}
 \Grafik[H]{1}{Kapture.png}
@@ -137,26 +157,7 @@ Changes will only be done in the config file by \textit{apply + save}. With \tex
 \Grafik[H]{0.8}{Widgets/Epics2.PNG}
 
 
-\chapter{Important notes for measurements}
-\begin{itemize}
-	\item start-up procedure: Boot PC, switch HighFlex off and on, reboot PC
-	\item Prepare Board can always be used to reset the board
-	\item check that PLL lock LEDs are on
-	\item use internal pilot bunch
-	\item activate HEADER
-	\item T/H FMC2 25ps to 4 is no offset
-	
-	\item Using 500\,MHz reference
-	\begin{enumerate}	
-		\item connect the 125\,MHz 
-		\item do normal init with 125\,MHz reference
-		\item connect the 500\,MHz
-		\item run \textit{PLL swap 125 to 500}, \textit{PLL Synch}, \textit{ADC Synch}
-		\item now it should be working. If log is missing redo step 4. 
-		\item do not run \textit{Board Reset} or other \textit{PLL Init}! Then you would need to redo from beginning.
-		\item If a DMA error etc happens try \textit{soft reset}
-	\end{enumerate}	
-\end{itemize}
+
 
 
 %\section{CUDA}

+ 9 - 1
Docu/chapters/part02-develope.tex

@@ -111,13 +111,21 @@ there are by now:
 	\item SingleReadWidget
 	\item TimeingWidget
 	\item TimescanWidget
-	\item EpicsWidget
+	\item EpicsWidget\\
+		Has one speciality: it is initialized in \textit{base/kcg} via
+		\begin{lstlisting}
+		if config.use_epics:
+			from ..widgets import EpicsWidget
+			EpicsWidget.epicsConfig = EpicsWidget.EpicsConfig()
+	   \end{lstlisting}
 	\item AdcWidget
 	\item UpdateCalibrationWidget
 	\item CorrelationWidget
 \end{itemize}
 To activate a widget put the module name in widgets/\_\_init\_\_.py
 
+\subsubsection*{config.py}
+Module to handle the config file. It also provides some helperfunctions for accessing the current working path as well as the installation path. Also is it the place where the colors for the Plotwidget are defined.
 
 
 

+ 11 - 14
KCG/base/backend/CalibrationUpdater.py

@@ -131,7 +131,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
         self.adc_checkbox_layout = QtGui.QHBoxLayout()
         self.group = QtGui.QButtonGroup()
         self.group.setExclusive(False)
-        print(self.workingChannels)
+        #print(self.workingChannels)
         for i in range(self.adc_number):
             self.adcCheckBox.append(self.createCheckbox(text="ADC "+str(i+1), connect=self.changeWorking))
             self.adc_checkbox_layout.addWidget(self.adcCheckBox[i])
@@ -243,7 +243,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
                     if int(file[-2:]) >= ctr:
                         ctr = int(file[-2:])+1
 
-            print('rename')
+            #print('rename')
             os.rename(self.old_id, self.old_id+'.old{:02d}'.format(ctr))
             os.rename(self.calibId, self.old_id)
 
@@ -267,7 +267,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
         for i in range(self.adc_number):
             if self.adcCheckBox[i].isChecked():
                 self.workingChannels.append(i)
-        print(self.workingChannels)
+        #print(self.workingChannels)
         self.originalnotplotted = True
         self.plot()
 
@@ -295,7 +295,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
             #print(self.grpY[str(i)][0])
             self.grpY[str(i)][...] = [[float(str(self.adcBaselineBox[i].text())),  float(str(self.adcScalingBox[i].text()))]]
             self.grpX[str(i)]['offset'][...] = float(str(self.adcOffsetBox[i].text()))*1e-12
-            print(i, self.grpY[str(i)][0], self.grpX[str(i)]['offset'][()])
+            #print(i, self.grpY[str(i)][0], self.grpX[str(i)]['offset'][()])
         pass
         self.plot()
 
@@ -377,7 +377,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
         fittype =  self.fitSelect.currentIndex()+EGAUSS
         useFirst = self.useFirst.value()
 
-        print(typ, fittype, useFirst)
+        #print(typ, fittype, useFirst)
         
         if typ in [0,1]: #Peak
             self.updateY(typ, fittype, useFirst)
@@ -449,7 +449,7 @@ class CalibrationUpdater(kcgw.KCGWidgets):
                     y = scany[np.argsort(scanx)]
                     baseline = np.mean(y[:useFirst])
                     print('baseline ', baseline)
-                print(scanx.shape, scany.shape)
+                #print(scanx.shape, scany.shape)
                 popt, perr, fitFun, pcov, label, x = self.doFit(scanx, scany, fittype, baseline=baseline, findMin=isNegativ)
                 phase, A = self.findMax(scanx, popt, fitFun, findMin=isNegativ)
             except:
@@ -472,13 +472,13 @@ class CalibrationUpdater(kcgw.KCGWidgets):
             if phase0 == 0:
                 phase0 = phase
             grpX[str(i)]['offset'][...] = phase0 - phase
-            print(phase, A, popt[4])
+            #print(phase, A, popt[4])
             A -= popt[4]
             if A0 == 0:
                 A0 = A
             if isNegativ:
                 A *= -1
-            print(phase, phase0 - phase, A)
+            #print(phase, phase0 - phase, A)
             try:
                 grpY[str(i)][...] = data=np.array([[popt[4], A/A0]], dtype=np.float64)
                 grpY['{}popt'.format(i)][...] = popt
@@ -901,15 +901,14 @@ class CalibrationUpdater(kcgw.KCGWidgets):
             sel = np.where((tmpy < y+tol) & (tmpy > y-tol))
             tmp = tmp[sel]
             tmpy = tmpy[sel]
-        
-            if i%(24) == 0: print('tol ', tol, len(res))
+            #if i%(24) == 0: print('tol ', tol, len(res))
+
         if len(res) > 1:
-        
             res = [res[len(res)//2]]
         if len(res) == 0:
             print('bad',x, y)
             res= [x]
-        if i%(24) == 0: print(res[0]-x)
+        
         return res[0]-x
 
     def doFit(self, x,y, type, p0=None, baseline=0, findMin=False):
@@ -951,7 +950,6 @@ class CalibrationUpdater(kcgw.KCGWidgets):
             fitFun = expgauss
             p0 = (23e-12, startx, 7e-8, 0.02e12, 2040)
             if findMin:
-                print('min')
                 p0 = (23e-12, startx, -7e-8, 0.02e12, 2040)
             label = ['  s  ', '  m  ', '  a  ', '  l  ', '  b  ']
         elif type == EGAUSSB:
@@ -978,7 +976,6 @@ class CalibrationUpdater(kcgw.KCGWidgets):
             p0 = p0[:-1]
 
         if p0 is not None:
-            print(x.shape, y.shape)
             popt, pcov = curve_fit(fitFun, x, y, p0=p0)
         else:
             popt, pcov = curve_fit(fitFun, x, y)

+ 4 - 6
KCG/base/backend/DataSet.py

@@ -168,11 +168,9 @@ class DataSet(object):
             return self.datax*1e-12
             
         out = []
-        print(self.c330, self.c25, self.c25b, self.f)
         for i,v in enumerate(self.f):
-            #print(i, v)
             out.append(theCalibration.calibrateX(i, self.c330, self.c25, v, self.c25b))
-        #print(out)
+        
         return np.array(out)
 
 
@@ -343,7 +341,7 @@ class DataSet(object):
             array = array.reshape(-1)
             orig_xs = orig_xs.reshape(-1)
 
-        print(adc)
+        #print(adc)
         ret = [np.array([orig_xs, array])]
 
         if adc not in selector:
@@ -366,8 +364,8 @@ class DataSet(object):
 
     def loadFromRawData(self, rawData):
         print('loadfromrawdata')
-        self.printData(rawData[:32+32])
-        print('-------------------')
+        #self.printData(rawData[:32+32])
+        #print('-------------------')
         headerInfo = self.dataHasHeader(rawData)
         if True in headerInfo:
             #logging.vinfo("Header detected.")

+ 7 - 8
KCG/base/backend/board/board_config.py

@@ -283,9 +283,9 @@ class BoardConfiguration(QtGui.QWidget):
         """
         Set observers that are always used
         """
-        def obsprint(x,y):
-            print(x, y)
-        self.observe_all(obsprint)
+        #def obsprint(x,y):
+        #    print(x, y)
+        #self.observe_all(obsprint)
         self.observe_write(self._update_header, 'header')
         self.observe_write(self._update_pilot_bunch, 'pilot_bunch')
         
@@ -531,7 +531,7 @@ class BoardConfiguration(QtGui.QWidget):
         _values = []
         for value in values[:4]:
             _values.append(self.make_uint(value, self.get('chip_delay_max'), 'ADC_Value'))
-        print("ADC1: ", values, _values)
+        #print("ADC1: ", values, _values)
         reg_value = ''
         mask = ''
         # Chip Delays are stored as 'ADC_4 ADC_3 ADC_2 ADC_1' in the register.
@@ -559,7 +559,7 @@ class BoardConfiguration(QtGui.QWidget):
             _values = []
             for value in values[4:]:
                 _values.append(self.make_uint(value, self.get('chip_delay_max'), 'ADC_Value'))
-            print("ADC 2", values, _values)
+            #print("ADC 2", values, _values)
             reg_value = ''
             mask = ''
             # Chip Delays are stored as 'ADC_4 ADC_3 ADC_2 ADC_1' in the register.
@@ -672,7 +672,7 @@ class BoardConfiguration(QtGui.QWidget):
             self.update('delay_330_adc_2', 0)
 
     def set_startup(self):
-        print('board_config setting startup')
+        #print('board_config setting startup')
         #self.update('delay_330_th', 0)
         #sleep(0.1)
         #self.update('delay_25_th', 0)
@@ -706,9 +706,8 @@ class BoardConfiguration(QtGui.QWidget):
             if adc_number > 4:
                 val = val + pci.read(self.identifier, reg='9084')[0]
             tmp = np.zeros(adc_number)
-            print(val)
+            
             for i in range(adc_number):
-                print(i, val[(adc_number-1-i)*2:(adc_number-i)*2])
                 selector = [3,2,1,0,7,6,5,4]
                 tmp[selector[i]] = int(val[(adc_number-1-i)*2:(adc_number-i)*2], 16)
             self.update('chip_delay', tmp , write=False)    

+ 1 - 2
KCG/base/backendinterface.py

@@ -458,7 +458,7 @@ def _bif_iterate_spectrograms(board_id, path):
     :param path: where to built the spectrogram
     :return: -
     """
-    print('_bif_iterate_spectrograms')
+    #print('_bif_iterate_spectrograms')
     return  # because it is broken
     if not os.path.isdir(str(path)):
         return
@@ -1056,7 +1056,6 @@ def _bif_start_wait_on_trigger(board_id, num_of_acquisitions=None, skip=None, ti
             self._quit = True
 
         def __del__(self):
-            print('quite')
             board.pci.write(board_id, '0', '9024')
             time.sleep(0.1)
             board.pci.write(board_id, '0', '902C')

+ 1 - 1
KCG/base/kcgwidget.py

@@ -424,7 +424,7 @@ class KCGWidgets(QtGui.QWidget):
         if connect:
             cb.clicked.connect(connect)
         if color is not None:
-            print("color: rgb({},{},{});".format(color.red(), color.green(), color.blue()))
+            #print("color: rgb({},{},{});".format(color.red(), color.green(), color.blue()))
             cb.setStyleSheet("color: rgb({},{},{}); background-color: white".format(color.red(), color.green(), color.blue()))
             #plt = QtGui.QPalette(color)            
             #cb.setPalette(plt);

+ 2 - 6
KCG/config.py

@@ -93,11 +93,7 @@ class ConfSection(object):
         """
         error = False
         for conf in self._settings:
-            try:
-                print(conf, leval(self._conf_obj.get(self._section, conf)))
-            except Exception as e:
-                print(conf, 'not')
-                pass
+            
             if conf in self._arg_dict:
                 try:
                     globals()[conf] = leval(self._arg_dict[conf])
@@ -115,7 +111,7 @@ class ConfSection(object):
                     print("Using default configuration value for " + conf)
                 globals()[conf] = leval(self._def_conf_obj.get(self._section, conf))
             else:
-                print('error')
+                #print('error')
                 error = True
 
         return not error

+ 7 - 19
KCG/widgets/CorrelationWidget.py

@@ -303,7 +303,7 @@ class CorrelationWidget(kcgw.KCGWidgets):
             return
 
         if self.running:
-            print('save')
+            #print('save')
             self.updater.save(os.path.join(os.path.dirname(self.dataSet.fileName), 'correlation.hdf'))
             self.running = False
         pass
@@ -312,14 +312,14 @@ class CorrelationWidget(kcgw.KCGWidgets):
     def on_cancel(self, param):
         if self.thread.running:
             self.thread.stop()
-            print('on_cancel')
+            #print('on_cancel')
             self.parent.updater=None
         #self.close()
         pass
 
     def _threadStop(self):
         self.thread.stop()
-        print('_threadStop')
+        #print('_threadStop')
         self.popup.close()
         if self.processbarWidget is not None:
             self.processbarWidget.close()
@@ -336,7 +336,7 @@ class CorrelationWidget(kcgw.KCGWidgets):
         self.updateLabels()
 
     def updateDelay(self, dataSet):
-        print('updateDelay')
+        #print('updateDelay')
         self.dataSet = dataSet
         self.delays  = dataSet.getCalibratedDelay()
         self.updater = None
@@ -345,7 +345,7 @@ class CorrelationWidget(kcgw.KCGWidgets):
         #self.originalnotplotted = True
         self.plot()
         self.updateLabels()
-        print('updateDelay done', self.delays)
+        #print('updateDelay done', self.delays)
 
     def plot(self):
         """
@@ -370,7 +370,7 @@ class CorrelationWidget(kcgw.KCGWidgets):
                         self.multiBunchSelector.hide()
                         self.multiBunchSelectorLabel.hide()
                     
-                    print('plot timeScan')
+                    #print('plot timeScan')
                     self.all_plot_widget.plotItem.clear()
                     
                     for i in self.workingChannels:
@@ -408,7 +408,7 @@ class CorrelationWidget(kcgw.KCGWidgets):
 
 
             if self.delays is not None:
-                print('plot delays')
+                #print('plot delays')
                 if self.scanyAll == []:
                     self.scanyAll.extend([0,1])
                     self.scanxAll.extend([0,1])
@@ -510,7 +510,6 @@ class CorrelationWidget(kcgw.KCGWidgets):
             fitFun = expgauss
             p0 = (23e-12, startx, 7e-8, 0.02e12, 2040)
             if findMin:
-                print('min')
                 p0 = (23e-12, startx, -7e-8, 0.02e12, 2040)
             label = ['  s  ', '  m  ', '  a  ', '  l  ', '  b  ']
         elif type == EGAUSSB:
@@ -529,17 +528,6 @@ class CorrelationWidget(kcgw.KCGWidgets):
             print('Fit type unknown ', type)
             return 0,0, lambda x: x , 0
 
-        #bounds = np.reshape(np.repeat((-np.inf, np.inf),len(p0)),(2,-1))
-        
-        #if baseline != 0:
-        #    bounds[0][-1] = baseline-10
-        #    p0[-1] = baseline
-        #    bounds[1][-1] = baseline+10
-        #    bounds[0][0] = 10e-12
-        #    bounds[1][0] = 26e-12
-        #    bounds[0][3] = 10e-12
-        #    bounds[1][3] = 80e-12
-        #print('bounds', bounds)
         if baseline != 0:
             print('baseline', baseline)
             fitFunOrg = fitFun

+ 3 - 3
KCG/widgets/PlotWidget.py

@@ -643,7 +643,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
                 valmax = np.max(y)
                 valmin = np.min(y)
                 positive = np.abs(valmax) > np.abs(valmin)
-                print('positive', positive)
+                #print('positive', positive)
 
                 
                 tmp = y.T
@@ -653,7 +653,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
                     else:
                         baseline.append(np.mean(line[np.where(line > -15)]))
                 
-                print(baseline)
+                #print(baseline)
                 y = y-baseline
                 
                 def gauss(x, sigma, mu, A):
@@ -956,7 +956,7 @@ class PlotWidget(kcgw.KCGWidgets):
                 self.adcCheckBox[0].setChecked(True)
         else:
             self.adc = self.group.checkedId()-1
-        print(self.adc)
+        
         self.change_identifier_text()
         self.plot(self.theType)
 

+ 7 - 7
KCG/widgets/TimescanWidget.py

@@ -198,9 +198,9 @@ class ScanThread(QtCore.QObject):
         
             data = DataSet(rawData=data_raw, shiftFMC2=config.shiftFMC2)
             
-            print('{:4.3f} emit Plot'.format(time.time()-self.startTime))
+            #print('{:4.3f} emit Plot'.format(time.time()-self.startTime))
             self.plotSignal.emit(data)
-            print('{:4.3f} emit Plot done'.format(time.time()-self.startTime))
+            #print('{:4.3f} emit Plot done'.format(time.time()-self.startTime))
 
         except Exception as e:
             print(e)
@@ -256,13 +256,13 @@ class ScanThread(QtCore.QObject):
 
             
         if c25_step_b == 4 and c_step_b == 0:
-            print('{:4.3f} emit pbar'.format(time.time()-self.startTime))
+            #print('{:4.3f} emit pbar'.format(time.time()-self.startTime))
             tmpScan = copy.deepcopy(self.timescan)
             self.pbarSignal.emit(tmpScan, 
                                  ((c_step-self.c_min)*(self.c25_max-self.c25_min+1.0) * (self.f_max-self.f_min+1.0) + (c25_step-self.c25_min)*(self.f_max-self.f_min+1.0) + (f_step-self.f_min))/
                                  ((self.c_max-self.c_min+1.0) * (self.c25_max-self.c25_min+1.0) * (self.f_max-self.f_min+1.0))
                                 )
-            print('{:4.3f} emit pbar done'.format(time.time()-self.startTime))
+            #print('{:4.3f} emit pbar done'.format(time.time()-self.startTime))
 
     def finished(self, c_step=0, c25_step=0, f_step=0):
         '''Method to handle the end of the thread'''
@@ -472,7 +472,7 @@ class ScanPlotWidget(kcgw.KCGWidgets):
 
 
     def setADCdelays(self, value):
-        print('set ADC Delays')
+        #print('set ADC Delays')
         self.delays = np.zeros(self.adc_number)
         id = 'None'
         if self.useCalib.isChecked():
@@ -818,7 +818,7 @@ class ScanPlotWidget(kcgw.KCGWidgets):
         #popt = p0
         perr = np.sqrt(np.absolute(np.diag(pcov)))
 
-        print(popt)
+        #print(popt)
         return popt, perr, fitFun, pcov, label, x
 
     ##################################################################################
@@ -1375,7 +1375,7 @@ class TimeScanWidget(kcgw.KCGWidgets):
 
     def update(self, timescan, prozent):
         #   print(c_step, f_step, data, prozent)
-        print('update')
+        #print('update')
         self.openPlotWidget()
         self.plotWidget.new_data(timescan)
         self.progressbar.setValue(prozent*1000)