|
@@ -26,12 +26,13 @@ import os
|
26
|
26
|
from copy import deepcopy
|
27
|
27
|
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT #as NavigationToolbar
|
28
|
28
|
import datetime, time
|
29
|
|
-import yaml
|
|
29
|
+
|
30
|
30
|
|
31
|
31
|
from akvo.tressel import mrsurvey
|
32
|
32
|
import pkg_resources # part of setuptools
|
33
|
33
|
version = pkg_resources.require("Akvo")[0].version
|
34
|
34
|
|
|
35
|
+import yaml
|
35
|
36
|
# Writes out numpy arrays into Eigen vectors as serialized by Lemma
|
36
|
37
|
class MatrixXr(yaml.YAMLObject):
|
37
|
38
|
yaml_tag = u'!MatrixXr'
|
|
@@ -51,6 +52,18 @@ class VectorXr(yaml.YAMLObject):
|
51
|
52
|
def __repr__(self):
|
52
|
53
|
# Converts to numpy array on import
|
53
|
54
|
return "np.array(%r)" % (self.data)
|
|
55
|
+
|
|
56
|
+class AkvoYamlNode(yaml.YAMLObject):
|
|
57
|
+ yaml_tag = u'!AkvoData'
|
|
58
|
+ def __init__(self):
|
|
59
|
+ self.Akvo_VERSION = version
|
|
60
|
+ self.Import = {}
|
|
61
|
+ self.dataProcessing = {}
|
|
62
|
+ #self.data = {}
|
|
63
|
+ # For going the other way, data import based on Yaml serialization,
|
|
64
|
+ def __repr__(self):
|
|
65
|
+ return "%s(name=%r, hp=%r, ac=%r, attacks=%r)" % (
|
|
66
|
+ self.__class__.__name__, self.name, self.hp, self.ac, self.attacks, self.thingy)
|
54
|
67
|
|
55
|
68
|
try:
|
56
|
69
|
import thread
|
|
@@ -89,7 +102,9 @@ class ApplicationWindow(QtWidgets.QMainWindow):
|
89
|
102
|
warn.write("Gui files were not compiled locally using pyuic! Further warnings have been supressed")
|
90
|
103
|
warn.close()
|
91
|
104
|
self.RAWDataProc = None
|
92
|
|
-
|
|
105
|
+
|
|
106
|
+ self.YamlNode = AkvoYamlNode()
|
|
107
|
+
|
93
|
108
|
# initialise some stuff
|
94
|
109
|
self.ui.lcdNumberTauPulse2.setEnabled(0)
|
95
|
110
|
self.ui.lcdNumberTauPulse1.setEnabled(0)
|
|
@@ -717,6 +732,14 @@ class ApplicationWindow(QtWidgets.QMainWindow):
|
717
|
732
|
nlogText.append( " reference channels: " + str(self.refChan) )
|
718
|
733
|
nlogText.append( " pulse records: " + str(self.ui.FIDProcComboBox.currentText()) )
|
719
|
734
|
nlogText.append( " instrument dead time: " + str(1e-3 * self.ui.DeadTimeSpinBox.value( )) )
|
|
735
|
+ self.YamlNode.Import["GMR Header"] = self.headerstr
|
|
736
|
+ self.YamlNode.Import["opened"] = datetime.datetime.now().isoformat()
|
|
737
|
+ self.YamlNode.Import["pulse Type"] = str(self.RAWDataProc.pulseType)
|
|
738
|
+ self.YamlNode.Import["stacks"] = self.procStacks.tolist()
|
|
739
|
+ self.YamlNode.Import["data channels"] = self.dataChan.tolist()
|
|
740
|
+ self.YamlNode.Import["reference channels"] = self.refChan.tolist()
|
|
741
|
+ self.YamlNode.Import["pulse records"] = str(self.ui.FIDProcComboBox.currentText())
|
|
742
|
+ self.YamlNode.Import["instrument dead time"] = (1e-3 * self.ui.DeadTimeSpinBox.value( ))
|
720
|
743
|
|
721
|
744
|
self.Log ( nlogText )
|
722
|
745
|
|
|
@@ -741,9 +764,13 @@ class ApplicationWindow(QtWidgets.QMainWindow):
|
741
|
764
|
self.ui.mplwidget.draw()
|
742
|
765
|
|
743
|
766
|
def Log(self, nlogText):
|
744
|
|
- for line in nlogText:
|
745
|
|
- self.ui.logTextBrowser.append( line )
|
746
|
|
- self.logText.append( line )
|
|
767
|
+ #for line in yaml.dump(self.YamlNode, default_flow_style=False):
|
|
768
|
+ #for line in nlogText:
|
|
769
|
+ # self.ui.logTextBrowser.append( line )
|
|
770
|
+ # self.logText.append( line )
|
|
771
|
+
|
|
772
|
+ self.ui.logTextBrowser.clear()
|
|
773
|
+ self.ui.logTextBrowser.append( yaml.dump(self.YamlNode)) #, default_flow_style=False) )
|
747
|
774
|
|
748
|
775
|
def disable(self):
|
749
|
776
|
self.ui.BandPassBox.setEnabled(False)
|