Browse Source

Serialisation improvements

HEAD
T-bone 6 years ago
parent
commit
ed66281a9e
1 changed files with 17 additions and 18 deletions
  1. 17
    18
      akvo/gui/akvoGUI.py

+ 17
- 18
akvo/gui/akvoGUI.py View File

@@ -35,14 +35,13 @@ version = pkg_resources.require("Akvo")[0].version
35 35
 import yaml
36 36
 # Writes out numpy arrays into Eigen vectors as serialized by Lemma
37 37
 class MatrixXr(yaml.YAMLObject):
38
-    yaml_tag = u'!MatrixXr'
39
-    def __init__(self, name, hp, ac, attacks):
40
-        self.name = name
41
-        self.hp = hp
42
-        self.ac = ac
43
-        self.attacks = attacks
44
-        def __repr__(self):
45
-            return "%s(name=%r, hp=%r, ac=%r, attacks=%r)" % (self.__class__.__name__, self.name, self.hp, self.ac, self.attacks)
38
+    yaml_tag = u'MatrixXr'
39
+    def __init__(self, rows, cols, data):
40
+        self.rows = rows
41
+        self.cols = cols
42
+        self.data = np.zeros((rows,cols))
43
+    def __repr__(self):
44
+        return "%s(rows=%r, cols=%r, data=%r)" % (self.__class__.__name__, self.rows, self.cols, self.data) 
46 45
 
47 46
 class VectorXr(yaml.YAMLObject):
48 47
     yaml_tag = r'VectorXr'
@@ -70,7 +69,7 @@ class AkvoYamlNode(yaml.YAMLObject):
70 69
         self.Import = {}
71 70
         self.Processing = OrderedDict() 
72 71
         #self.ProcessingFlow = []
73
-        #self.data = {}
72
+        #self.Data = {}
74 73
     # For going the other way, data import based on Yaml serialization, 
75 74
     def __repr__(self):
76 75
         return "%s(name=%r, Akvo_VESION=%r, Import=%r, Processing=%r)" % (
@@ -453,7 +452,6 @@ class ApplicationWindow(QtWidgets.QMainWindow):
453 452
         #INFO["samp"] = self.RAWDataProc.samp
454 453
         INFO["nPulseMoments"] = self.RAWDataProc.nPulseMoments
455 454
         #INFO["deadTime"] = self.RAWDataProc.deadTime
456
-        INFO["transFreq"] = self.RAWDataProc.transFreq.tolist()
457 455
         INFO["processed"] = "Akvo v. 1.0, on " + time.strftime("%d/%m/%Y")
458 456
         # Pulse current info
459 457
         ip = 0
@@ -503,10 +501,10 @@ class ApplicationWindow(QtWidgets.QMainWindow):
503 501
  
504 502
     def SavePreprocess(self):
505 503
      
506
-        if "Saved" not in self.YamlNode.Processing.keys():
507
-            self.YamlNode.Processing["Saved"] = []
508
-        self.YamlNode.Processing["Saved"].append(datetime.datetime.now().isoformat()) 
509
-        self.Log()
504
+        #if "Saved" not in self.YamlNode.Processing.keys():
505
+        #    self.YamlNode.Processing["Saved"] = []
506
+        #self.YamlNode.Processing["Saved"].append(datetime.datetime.now().isoformat()) 
507
+        #self.Log()
510 508
  
511 509
         import pickle, os 
512 510
         try:
@@ -608,10 +606,11 @@ class ApplicationWindow(QtWidgets.QMainWindow):
608 606
         #except KeyError:
609 607
         #    pass
610 608
        
611
-        if "Loaded" not in self.YamlNode.Processing.keys():
612
-            self.YamlNode.Processing["Loaded"] = []
613
-        self.YamlNode.Processing["Loaded"].append(datetime.datetime.now().isoformat()) 
614
-        self.Log()
609
+        # Remove "Saved" and "Loaded" from processing flow 
610
+        #if "Loaded" not in self.YamlNode.Processing.keys():
611
+        #    self.YamlNode.Processing["Loaded"] = []
612
+        #self.YamlNode.Processing["Loaded"].append(datetime.datetime.now().isoformat()) 
613
+        #self.Log()
615 614
  
616 615
         # If we got this far, enable all the widgets
617 616
         self.ui.lcdNumberTauPulse1.setEnabled(True)

Loading…
Cancel
Save