Matze 4 ani în urmă
părinte
comite
0889b13433

+ 1 - 0
.gitignore

@@ -39,3 +39,4 @@ nosetests.xml
 .idea
 
 backup.kcf
+/told

+ 45 - 25
KCG/base/backend/board/sequences/sequences_7.json

@@ -4,11 +4,12 @@
     "sequence_names": [
                         "reset_sequence", 
                         "PLL_sequence",
+                        "PLL_sequenceswitch",
                         "PLL_sequence500",
                         "PLL_sequence_1G",
                         "synchronisation_sequence",
-                        "adc_autosync",
                         "calibartion_sequence",
+                        "adc_autosync",
                         "adc_pdown",
                         "adc_normal",
                         "adc_test"],
@@ -60,8 +61,8 @@
             ]
         ]
     }, 
-    "PLL_sequence500": {
-        "Comment": "PLL init SR:500MHz, ref:500MHz",
+    "PLL_sequence": {
+        "Comment": "PLL init SR:500MHz, ref:125MHz",
         "status_val" : "PLL500M",
         "sequence": [
             [
@@ -87,10 +88,10 @@
                 "delay_330_adc_2", "1"
             ],
             [
-                "0x302000C2", "0x9060", 
+                "0x30140302", "0x9060", 
                 "",
                 "CASCADE delay to +0*330ps",
-                "delay_cascade", "5"
+                "delay_cascade", "0"
             ],
             [
                 "0x301800C3", "0x9060", 
@@ -99,9 +100,10 @@
                 "delay_330_fpga", "1"
             ],
             [
-                "0x80140184", "0x9060",
+                "0x301800C4", "0x9060",
                 "",
-                ""
+                "FPGA OUTPUT new KaptureBoard",
+                "delay_330_fpga", "1"
             ],
             [
                 "0x301400C5", "0x9060",
@@ -117,10 +119,10 @@
                 "delay_25_adc_2", "10"
             ],
             [
-                "0x015001A7", "0x9060",
+                "0x015001C7", "0x9060",
                 "",
-                "CASCADE delay to +13*25ps",
-                "delay_cascade_25", "13"
+                "CASCADE delay to +14*25ps",
+                "delay_cascade_25", "14"
             ],
             [
                 "0x03010008", "0x9060",
@@ -188,7 +190,7 @@
                 ""
             ],
             [
-                "0x0080021C", "0x9060",
+                "0x0020021C", "0x9060",
                 "",
                 ""
             ],
@@ -198,7 +200,7 @@
                 ""
             ],
             [
-                "0x0300005E", "0x9060",
+                "0x0600009E", "0x9060",
                 "",
                 ""
             ],
@@ -208,9 +210,28 @@
                 ""
             ]
         ]
+    },
+    "PLL_sequenceswitch": {
+        "Comment": "PLL switch to ref:500MHz",
+        "status_val" : "PLL500M",
+        "sequence": [
+           
+            [
+                "0x302000C2", "0x9060", 
+                "",
+                "CASCADE delay to +0*330ps",
+                "delay_cascade", "5"
+            ],
+            [
+                "0x301800C3", "0x9060", 
+                "",
+                "FPGA OUTPUT",
+                "delay_330_fpga", "1"
+            ]
+        ]
     }, 
-    "PLL_sequence": {
-        "Comment": "PLL init SR:500MHz, ref:125MHz",
+    "PLL_sequence500": {
+        "Comment": "PLL init SR:500MHz, ref:500MHz",
         "status_val" : "PLL500M",
         "sequence": [
             [
@@ -236,10 +257,10 @@
                 "delay_330_adc_2", "1"
             ],
             [
-                "0x30140302", "0x9060", 
+                "0x302000C2", "0x9060", 
                 "",
                 "CASCADE delay to +0*330ps",
-                "delay_cascade", "0"
+                "delay_cascade", "5"
             ],
             [
                 "0x301800C3", "0x9060", 
@@ -248,10 +269,9 @@
                 "delay_330_fpga", "1"
             ],
             [
-                "0x301800C4", "0x9060",
+                "0x80140184", "0x9060",
                 "",
-                "FPGA OUTPUT new KaptureBoard",
-                "delay_330_fpga", "1"
+                ""
             ],
             [
                 "0x301400C5", "0x9060",
@@ -267,10 +287,10 @@
                 "delay_25_adc_2", "10"
             ],
             [
-                "0x015001C7", "0x9060",
+                "0x015001A7", "0x9060",
                 "",
-                "CASCADE delay to +14*25ps",
-                "delay_cascade_25", "14"
+                "CASCADE delay to +13*25ps",
+                "delay_cascade_25", "13"
             ],
             [
                 "0x03010008", "0x9060",
@@ -338,7 +358,7 @@
                 ""
             ],
             [
-                "0x0020021C", "0x9060",
+                "0x0080021C", "0x9060",
                 "",
                 ""
             ],
@@ -348,7 +368,7 @@
                 ""
             ],
             [
-                "0x0600009E", "0x9060",
+                "0x0300005E", "0x9060",
                 "",
                 ""
             ],
@@ -358,7 +378,7 @@
                 ""
             ]
         ]
-    },
+    }, 
     "PLL_sequence_1G": {
         "Comment": "PLL init SR:1GHz, ref:125MHz",
         "status_val" : "PLL1G",

+ 6 - 0
KCG/config.py

@@ -93,6 +93,11 @@ 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])
@@ -110,6 +115,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')
                 error = True
 
         return not error

+ 10 - 9
KCG/widgets/CorrelationCorrection.py

@@ -119,11 +119,12 @@ class CorrelationCorrection(QtCore.QObject):
     def __init__(self, path, scanX, scanY, delays, workingChannels=[0,1,2,3,4,5,6,7]):
         super(CorrelationCorrection, self).__init__()
         self.host = "ibpt-kapture1"
-        self.remotepath = "/home/ws/uadse/Kapture-GPU-Analyse/PeakReconstruction/"
+        self.remotepath = "/home/kapture/Kapture-GPU-Analyse/PeakReconstruction/"
 
-        self.dirToReconstruction = '../PeakReconstruction/'
+        #self.dirToReconstruction = '../PeakReconstruction/'
 
         self.workingChannels = workingChannels
+        print(workingChannels)
 
         self.scanX  = scanX
         self.scanY  = scanY
@@ -141,7 +142,7 @@ class CorrelationCorrection(QtCore.QObject):
                 if int(file[-6:-4]) >= self.nr:
                     self.nr = int(file[-6:-4])+1
 
-        #self.nr-=1
+        self.nr-=1
         self.file = 'simu_{:02d}.out'.format(self.nr)
         self.fileMuster = 'simu_{:02d}.npy'.format(self.nr)
 
@@ -153,7 +154,7 @@ class CorrelationCorrection(QtCore.QObject):
         self.process.finished.connect(self._processFinished)
         self.process.error.connect(self._processError)
     
-        self.process.setWorkingDirectory(self.dirToReconstruction)
+        self.process.setWorkingDirectory(self.remotepath)
         self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
 
 
@@ -172,7 +173,7 @@ class CorrelationCorrection(QtCore.QObject):
         self.deltaVarianz = 15
         self.deltaMean    = 10
 
-        self._generateSimulationData(plotting)
+        #self._generateSimulationData(plotting)
         self._runReconstruction()
         self._calculateCorrections(plotting)
         if plotting:
@@ -255,7 +256,7 @@ class CorrelationCorrection(QtCore.QObject):
         f.write('\tNumber of Skipped Turns: 0\n')
         f.write('\tBeam Current (mA): 10\n')
         f.write('\tADC Delays: [0, 0, 0, 0, 0, 0, 0, 0]\n\tT/H Delay: 0\n\t25ps Delay: 0\n\tT/H Delay 2: 0\n\t25ps Delay 2: 0\n\tDelay Cascade: 0\n')
-        f.write('\tdatax: ['+', '.join(str(x) for x in dataxb) + ']\n\n')
+        f.write('\tdatax: ['+', '.join(str(x) for x in dataxb) + ']\n')
         f.write('\tWorking Channels: ['+', '.join(str(x) for x in self.workingChannels) + ']\n\n')
         f.close()
 
@@ -310,7 +311,7 @@ class CorrelationCorrection(QtCore.QObject):
             import paramiko
             ssh = paramiko.SSHClient()
             ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
-            ssh.connect(self.host, username='uadse', password='Mkp!007?')
+            ssh.connect(self.host, username='kapture', password='kapture123')
             
             print('put')
 
@@ -320,12 +321,12 @@ class CorrelationCorrection(QtCore.QObject):
 
             
             scp = ssh.open_sftp()
-            scp.put(localfile, remotefile, progress)
+            #scp.put(localfile, remotefile, progress)
             scp.put(os.path.join(localpath, 'Measurement_board_6028.log'), self.remotepath+'simulationData/Measurement_board_6028.log', progress)
 
             print('calc')
 
-            stdin, stdout, stderr = ssh.exec_command("cd {} ; python3 -u {} -f {} -c d".format(self.remotepath, "PeakReconstuction.py", remotefile))
+            stdin, stdout, stderr = ssh.exec_command("cd {} ; python3 -u {} -f {} -c d -v -o '' ".format(self.remotepath, "PeakReconstruction.py", remotefile))
             #stdout.channel.recv_exit_status()
             while not stdout.channel.exit_status_ready():
                 o = stdout.readline()

+ 7 - 2
KCG/widgets/CorrelationWidget.py

@@ -274,7 +274,7 @@ class CorrelationWidget(kcgw.KCGWidgets):
         self.processbarWidget = WaitingWidget(self)
 
         scanx, scany, scane = self.timeScan.getScanOverTime(0, True, True)
-        self.updater = CorrelationCorrection(os.path.dirname(self.timeScan.fileName), scanx, scany, self.delays)
+        self.updater = CorrelationCorrection(os.path.dirname(self.timeScan.fileName), scanx, scany, self.delays, workingChannels=self.workingChannels)
         self.thread.register(self.updater)
         self.thread.connect('stopSignal', self._threadStop)
         self.thread.start('run')
@@ -290,11 +290,14 @@ class CorrelationWidget(kcgw.KCGWidgets):
         """ 
 
     def on_save(self, param):
+        print('save')
         if self.thread.running:
+            print('thread still running')
             return
 
         if self.running:
-            self.updater.save()
+            print('save')
+            self.updater.save(os.path.join(os.path.dirname(self.dataSet.fileName), 'correlation.hdf'))
             self.running = False
         pass
 
@@ -307,8 +310,10 @@ class CorrelationWidget(kcgw.KCGWidgets):
         pass
 
     def _threadStop(self):
+        self.thread.stop()
         if self.processbarWidget is not None:
             self.processbarWidget.close()
+
         self.plot()
 
     def updateTimeScan(self, timeScan):