@@ -4,8 +4,6 import subprocess | |||||
4 | import os |
|
4 | import os | |
5 | import sys |
|
5 | import sys | |
6 | import glob |
|
6 | import glob | |
7 | save_stdout = sys.stdout |
|
|||
8 | sys.stdout = open('/dev/null', 'w') |
|
|||
9 | from multiprocessing import cpu_count |
|
7 | from multiprocessing import cpu_count | |
10 | from schainpy.controller import Project |
|
8 | from schainpy.controller import Project | |
11 | from schainpy.model import Operation, ProcessingUnit |
|
9 | from schainpy.model import Operation, ProcessingUnit | |
@@ -19,7 +17,6 try: | |||||
19 | from queue import Queue |
|
17 | from queue import Queue | |
20 | except: |
|
18 | except: | |
21 | from Queue import Queue |
|
19 | from Queue import Queue | |
22 | sys.stdout = save_stdout |
|
|||
23 |
|
20 | |||
24 |
|
21 | |||
25 | def getProcs(): |
|
22 | def getProcs(): | |
@@ -45,11 +42,19 def getOperations(): | |||||
45 |
|
42 | |||
46 | def getArgs(op): |
|
43 | def getArgs(op): | |
47 | module = locate('schainpy.model.{}'.format(op)) |
|
44 | module = locate('schainpy.model.{}'.format(op)) | |
48 |
|
45 | try: | ||
49 | if hasattr(module, '__attrs__'): |
|
46 | obj = module(1,2,3,Queue(),5,6) | |
50 | args = module.__attrs__ |
|
47 | except: | |
|
48 | obj = module() | |||
|
49 | ||||
|
50 | if hasattr(obj, '__attrs__'): | |||
|
51 | args = obj.__attrs__ | |||
51 | else: |
|
52 | else: | |
52 | args = inspect.getargspec(module.run).args |
|
53 | if hasattr(obj, 'myrun'): | |
|
54 | args = inspect.getfullargspec(obj.myrun).args | |||
|
55 | else: | |||
|
56 | args = inspect.getfullargspec(obj.run).args | |||
|
57 | ||||
53 | try: |
|
58 | try: | |
54 | args.remove('self') |
|
59 | args.remove('self') | |
55 | except Exception as e: |
|
60 | except Exception as e: | |
@@ -148,7 +153,7 def search(nextcommand): | |||||
148 | if nextcommand is None: |
|
153 | if nextcommand is None: | |
149 | log.error('There is no Operation/ProcessingUnit to search', '') |
|
154 | log.error('There is no Operation/ProcessingUnit to search', '') | |
150 | else: |
|
155 | else: | |
151 |
try: |
|
156 | try: | |
152 | args = getArgs(nextcommand) |
|
157 | args = getArgs(nextcommand) | |
153 | doc = getDoc(nextcommand) |
|
158 | doc = getDoc(nextcommand) | |
154 | if len(args) == 0: |
|
159 | if len(args) == 0: |
@@ -29,7 +29,7 import pickle | |||||
29 | try: |
|
29 | try: | |
30 | import digital_rf |
|
30 | import digital_rf | |
31 | except: |
|
31 | except: | |
32 | print('You should install "digital_rf" module if you want to read Digital RF data') |
|
32 | pass | |
33 |
|
33 | |||
34 | @MPDecorator |
|
34 | @MPDecorator | |
35 | class DigitalRFReader(ProcessingUnit): |
|
35 | class DigitalRFReader(ProcessingUnit): |
@@ -14,7 +14,7 from time import sleep | |||||
14 | try: |
|
14 | try: | |
15 | import pyfits |
|
15 | import pyfits | |
16 | except ImportError as e: |
|
16 | except ImportError as e: | |
17 | print("Fits data cannot be used. Install pyfits module") |
|
17 | pass | |
18 |
|
18 | |||
19 | from xml.etree.ElementTree import ElementTree |
|
19 | from xml.etree.ElementTree import ElementTree | |
20 |
|
20 |
@@ -23,9 +23,7 from schainpy.utils import log | |||||
23 | try: |
|
23 | try: | |
24 | import madrigal.cedar |
|
24 | import madrigal.cedar | |
25 | except: |
|
25 | except: | |
26 | log.warning( |
|
26 | pass | |
27 | 'You should install "madrigal library" module if you want to read/write Madrigal data' |
|
|||
28 | ) |
|
|||
29 |
|
27 | |||
30 | try: |
|
28 | try: | |
31 | basestring |
|
29 | basestring |
@@ -19,7 +19,7 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation | |||||
19 | try: |
|
19 | try: | |
20 | import digital_rf_hdf5 |
|
20 | import digital_rf_hdf5 | |
21 | except: |
|
21 | except: | |
22 | print('You should install "digital_rf_hdf5" module if you want to read USRP data') |
|
22 | pass | |
23 |
|
23 | |||
24 | class USRPReader(ProcessingUnit): |
|
24 | class USRPReader(ProcessingUnit): | |
25 | ''' |
|
25 | ''' |
@@ -23,9 +23,7 from schainpy.utils import log | |||||
23 | try: |
|
23 | try: | |
24 | from netCDF4 import Dataset |
|
24 | from netCDF4 import Dataset | |
25 | except: |
|
25 | except: | |
26 | log.warning( |
|
26 | pass | |
27 | 'You should install "netCDF4" module if you want to read/write NCDF files' |
|
|||
28 | ) |
|
|||
29 |
|
27 | |||
30 | UT1970 = datetime.datetime(1970, 1, 1) - datetime.timedelta(seconds=time.timezone) |
|
28 | UT1970 = datetime.datetime(1970, 1, 1) - datetime.timedelta(seconds=time.timezone) | |
31 |
|
29 |
General Comments 0
You need to be logged in to leave comments.
Login now