Trevor Irons 6 years ago
parent
commit
662d7b3fe7
3 changed files with 32 additions and 48 deletions
  1. 17
    18
      akvo/gui/akvoGUI.py
  2. 2
    2
      akvo/tressel/filtfilt.py
  3. 13
    28
      setup.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)

+ 2
- 2
akvo/tressel/filtfilt.py View File

@@ -35,11 +35,11 @@ def filtfilt(b,a,x):
35 35
     edge=ntaps*3
36 36
 
37 37
     if x.ndim != 1:
38
-        raise ValueError, "Filiflit is only accepting 1 dimension arrays."
38
+        raise ValueError("Filiflit is only accepting 1 dimension arrays.")
39 39
 
40 40
     #x must be bigger than edge
41 41
     if x.size < edge:
42
-        raise ValueError, "Input vector needs to be bigger than 3 * max(len(a),len(b)."
42
+        raise ValueError("Input vector needs to be bigger than 3 * max(len(a),len(b).")
43 43
 
44 44
     if len(a) < ntaps:
45 45
         a=r_[a,zeros(len(b)-len(a))]

+ 13
- 28
setup.py View File

@@ -1,39 +1,21 @@
1 1
 #!/usr/bin/env python
2
-import sys
3 2
 
4
-# optionally use qt4
5
-# if sys.argv[1] == "build_ui":
6
-try:
7
-    from pyqt_distutils.build_ui import build_ui
8
-#         cmdclass = {'build_ui': build_ui}
9
-except ImportError:
10
-    build_ui = None  # user won't have pyqt_distutils when deploying
11
-#         cmdclass = {}
12
-# else:
13
-#     build_ui = None  # user won't have pyqt_distutils when deploying
14
-#     cmdclass = {}
15
-
16
-
17
-# Require PyQt5 and compiltion of GUI files via pyuic 
3
+# Requires PyQt5 and compiltion of GUI files via pyuic 
18 4
 from setuptools import setup, Extension
19 5
 from setuptools.command.build_py import build_py
20
-#from pyqt_distutils.build_ui import build_ui
6
+
7
+try:
8
+    from pyqt_distutils.build_ui import build_ui
9
+except:
10
+    print("Please install pyqt_distutils")
11
+    print( "(sudo) pip(3) install pyqt-distutils")
12
+    exit()
21 13
 
22 14
 class custom_build_py(build_py):
23 15
     def run(self):
24 16
         self.run_command('build_ui')
25 17
         build_py.run(self)
26 18
 
27
-try:
28
-    from Cython.Build import cythonize as cythonise
29
-except ImportError:
30
-    def cythonise(*args, **kwargs):
31
-        #from Cython.Build import cythonize
32
-        #return cythonize(*args, **kwargs)
33
-        return 
34
-
35
-#from distutils.core import setup
36
-
37 19
 setup(name='Akvo',
38 20
       version='1.0.5',
39 21
       description='Surface nuclear magnetic resonance workbench',
@@ -43,7 +25,10 @@ setup(name='Akvo',
43 25
       #setup_requires=['PyQt5'],
44 26
       setup_requires=[
45 27
         # Setuptools 18.0 properly handles Cython extensions.
46
-        'PyQt5', 'pyqt_distutils','setuptools>=18.0',
28
+        #'PyQt', 
29
+        'pyqt_distutils',
30
+        'PyQt5',
31
+        'setuptools>=18.0',
47 32
       ],
48 33
 #      ext_modules = cythonise("akvo/tressel/*.pyx"), 
49 34
 #      build_requires=['cython'],
@@ -65,12 +50,12 @@ setup(name='Akvo',
65 50
                   'akvo = akvo.gui.akvoGUI:main',                  
66 51
               ],              
67 52
           },
53
+      #cmdclass = cmdclass,
68 54
       # for forced build of pyuic
69 55
       cmdclass={
70 56
           'build_ui': build_ui,
71 57
           'build_py': custom_build_py,
72 58
       },
73
-      #cmdclass=cmdclass,
74 59
       # Mechanism to include auxiliary files
75 60
       include_package_data=True,
76 61
       package_data={

Loading…
Cancel
Save