@@ -47,6 +47,10 class PlotData(Operation, Process): | |||||
47 | __MAXNUMX = 80 |
|
47 | __MAXNUMX = 80 | |
48 | __missing = 1E30 |
|
48 | __missing = 1E30 | |
49 |
|
49 | |||
|
50 | __attrs__ = ['show', 'save', 'xmin', 'xmax', 'ymin', 'ymax', 'zmin', 'zmax', | |||
|
51 | 'zlimits', 'xlabel', 'ylabel', 'cb_label', 'title', 'titles', 'colorbar', | |||
|
52 | 'bgcolor', 'width', 'height', 'localtime', 'oneFigure', 'showprofile'] | |||
|
53 | ||||
50 | def __init__(self, **kwargs): |
|
54 | def __init__(self, **kwargs): | |
51 |
|
55 | |||
52 | Operation.__init__(self, plot=True, **kwargs) |
|
56 | Operation.__init__(self, plot=True, **kwargs) | |
@@ -380,7 +384,7 class PlotData(Operation, Process): | |||||
380 | [tick.set_visible(False) |
|
384 | [tick.set_visible(False) | |
381 | for tick in self.pf_axes[n].get_yticklabels()] |
|
385 | for tick in self.pf_axes[n].get_yticklabels()] | |
382 | if self.colorbar: |
|
386 | if self.colorbar: | |
383 |
ax.cbar = plt.colorbar(ax.plt, ax=ax, fraction=0. |
|
387 | ax.cbar = plt.colorbar(ax.plt, ax=ax, fraction=0.05, pad=0.02, aspect=10) | |
384 | ax.cbar.ax.tick_params(labelsize=8) |
|
388 | ax.cbar.ax.tick_params(labelsize=8) | |
385 | ax.cbar.ax.press = None |
|
389 | ax.cbar.ax.press = None | |
386 | if self.cb_label: |
|
390 | if self.cb_label: |
@@ -553,7 +553,10 class JRODataIO: | |||||
553 | return dtype_width |
|
553 | return dtype_width | |
554 |
|
554 | |||
555 | def getAllowedArgs(self): |
|
555 | def getAllowedArgs(self): | |
556 | return inspect.getargspec(self.run).args |
|
556 | if hasattr(self, '__attrs__'): | |
|
557 | return self.__attrs__ | |||
|
558 | else: | |||
|
559 | return inspect.getargspec(self.run).args | |||
557 |
|
560 | |||
558 |
|
561 | |||
559 | class JRODataReader(JRODataIO): |
|
562 | class JRODataReader(JRODataIO): |
@@ -513,10 +513,8 class BLTRSpectraReader (ProcessingUnit, FileHeaderBLTR, RecordHeaderBLTR, JRODa | |||||
513 | self.dataOut = Spectra() |
|
513 | self.dataOut = Spectra() | |
514 | self.profileIndex = 1 # Always |
|
514 | self.profileIndex = 1 # Always | |
515 | self.dataOut.flagNoData = False |
|
515 | self.dataOut.flagNoData = False | |
516 | self.dataOut.nRdPairs = 0 |
|
516 | self.dataOut.nRdPairs = 0 | |
517 |
self.dataOut. |
|
517 | self.dataOut.data_spc = None | |
518 | self.dataOut.data_spc = None |
|
|||
519 | self.dataOut.noise = [] |
|
|||
520 | self.dataOut.velocityX = [] |
|
518 | self.dataOut.velocityX = [] | |
521 | self.dataOut.velocityY = [] |
|
519 | self.dataOut.velocityY = [] | |
522 | self.dataOut.velocityV = [] |
|
520 | self.dataOut.velocityV = [] |
@@ -494,17 +494,14 class MIRA35CReader (ProcessingUnit, FileHeaderMIRA35c, SRVIHeader, RecordHeader | |||||
494 | self.dataOut = Spectra() |
|
494 | self.dataOut = Spectra() | |
495 | self.profileIndex = 1 # Always |
|
495 | self.profileIndex = 1 # Always | |
496 | self.dataOut.flagNoData = False |
|
496 | self.dataOut.flagNoData = False | |
497 | self.dataOut.nRdPairs = 0 |
|
497 | self.dataOut.nRdPairs = 0 | |
498 |
self.dataOut. |
|
498 | self.dataOut.data_spc = None | |
499 | self.dataOut.data_spc = None |
|
|||
500 |
|
||||
501 | self.dataOut.normFactor = 1 |
|
|||
502 | self.nextfileflag = True |
|
499 | self.nextfileflag = True | |
503 | self.dataOut.RadarConst = 0 |
|
500 | self.dataOut.RadarConst = 0 | |
504 | self.dataOut.HSDV = [] |
|
501 | self.dataOut.HSDV = [] | |
505 | self.dataOut.NPW = [] |
|
502 | self.dataOut.NPW = [] | |
506 | self.dataOut.COFA = [] |
|
503 | self.dataOut.COFA = [] | |
507 | self.dataOut.noise = 0 |
|
504 | # self.dataOut.noise = 0 | |
508 |
|
505 | |||
509 | def Files2Read(self, fp): |
|
506 | def Files2Read(self, fp): | |
510 | ''' |
|
507 | ''' | |
@@ -588,6 +585,7 class MIRA35CReader (ProcessingUnit, FileHeaderMIRA35c, SRVIHeader, RecordHeader | |||||
588 | self.dataOut.noise = self.dataOut.getNoise() |
|
585 | self.dataOut.noise = self.dataOut.getNoise() | |
589 | # print 'ACAAAAAA', self.dataOut.noise |
|
586 | # print 'ACAAAAAA', self.dataOut.noise | |
590 | self.dataOut.data_spc = self.dataOut.data_spc + self.dataOut.noise |
|
587 | self.dataOut.data_spc = self.dataOut.data_spc + self.dataOut.noise | |
|
588 | self.dataOut.normFactor = 1 | |||
591 | # print 'self.dataOut.noise',self.dataOut.noise |
|
589 | # print 'self.dataOut.noise',self.dataOut.noise | |
592 |
|
590 | |||
593 | return self.dataOut.data_spc |
|
591 | return self.dataOut.data_spc |
@@ -71,7 +71,10 class ProcessingUnit(object): | |||||
71 | checkKwargs(self.run, kwargs) |
|
71 | checkKwargs(self.run, kwargs) | |
72 |
|
72 | |||
73 | def getAllowedArgs(self): |
|
73 | def getAllowedArgs(self): | |
74 | return inspect.getargspec(self.run).args |
|
74 | if hasattr(self, '__attrs__'): | |
|
75 | return self.__attrs__ | |||
|
76 | else: | |||
|
77 | return inspect.getargspec(self.run).args | |||
75 |
|
78 | |||
76 | def addOperationKwargs(self, objId, **kwargs): |
|
79 | def addOperationKwargs(self, objId, **kwargs): | |
77 | ''' |
|
80 | ''' | |
@@ -318,7 +321,10 class Operation(object): | |||||
318 | checkKwargs(self.run, kwargs) |
|
321 | checkKwargs(self.run, kwargs) | |
319 |
|
322 | |||
320 | def getAllowedArgs(self): |
|
323 | def getAllowedArgs(self): | |
321 | return inspect.getargspec(self.run).args |
|
324 | if hasattr(self, '__attrs__'): | |
|
325 | return self.__attrs__ | |||
|
326 | else: | |||
|
327 | return inspect.getargspec(self.run).args | |||
322 |
|
328 | |||
323 | def setup(self): |
|
329 | def setup(self): | |
324 |
|
330 |
@@ -250,6 +250,8 class PublishData(Operation): | |||||
250 | Operation to send data over zmq. |
|
250 | Operation to send data over zmq. | |
251 | ''' |
|
251 | ''' | |
252 |
|
252 | |||
|
253 | __attrs__ = ['host', 'port', 'delay', 'zeromq', 'mqtt', 'verbose'] | |||
|
254 | ||||
253 | def __init__(self, **kwargs): |
|
255 | def __init__(self, **kwargs): | |
254 | """Inicio.""" |
|
256 | """Inicio.""" | |
255 | Operation.__init__(self, **kwargs) |
|
257 | Operation.__init__(self, **kwargs) | |
@@ -434,6 +436,8 class PublishData(Operation): | |||||
434 |
|
436 | |||
435 | class ReceiverData(ProcessingUnit): |
|
437 | class ReceiverData(ProcessingUnit): | |
436 |
|
438 | |||
|
439 | __attrs__ = ['server'] | |||
|
440 | ||||
437 | def __init__(self, **kwargs): |
|
441 | def __init__(self, **kwargs): | |
438 |
|
442 | |||
439 | ProcessingUnit.__init__(self, **kwargs) |
|
443 | ProcessingUnit.__init__(self, **kwargs) | |
@@ -472,6 +476,7 class ReceiverData(ProcessingUnit): | |||||
472 | class PlotterReceiver(ProcessingUnit, Process): |
|
476 | class PlotterReceiver(ProcessingUnit, Process): | |
473 |
|
477 | |||
474 | throttle_value = 5 |
|
478 | throttle_value = 5 | |
|
479 | __attrs__ = ['server', 'plottypes', 'realtime', 'localtime', 'throttle'] | |||
475 |
|
480 | |||
476 | def __init__(self, **kwargs): |
|
481 | def __init__(self, **kwargs): | |
477 |
|
482 |
@@ -1,6 +1,5 | |||||
1 | import schainpy |
|
1 | import schainpy | |
2 | from schainpy.model import Operation, ProcessingUnit |
|
2 | from schainpy.model import Operation, ProcessingUnit | |
3 | from importlib import import_module |
|
|||
4 | from pydoc import locate |
|
3 | from pydoc import locate | |
5 |
|
4 | |||
6 | def clean_modules(module): |
|
5 | def clean_modules(module): | |
@@ -11,17 +10,17 def clean_modules(module): | |||||
11 |
|
10 | |||
12 | def check_module(possible, instance): |
|
11 | def check_module(possible, instance): | |
13 | def check(x): |
|
12 | def check(x): | |
14 | try: |
|
13 | try: | |
15 | instancia = locate('schainpy.model.{}'.format(x)) |
|
14 | instancia = locate('schainpy.model.{}'.format(x)) | |
16 | return isinstance(instancia(), instance) |
|
15 | return isinstance(instancia(), instance) | |
17 | except Exception as e: |
|
16 | except Exception as e: | |
18 | return False |
|
17 | return False | |
19 | clean = clean_modules(possible) |
|
18 | clean = clean_modules(possible) | |
20 | return [x for x in clean if check(x)] |
|
19 | return [x for x in clean if check(x)] | |
21 |
|
20 | |||
22 |
|
21 | |||
23 | def getProcs(): |
|
22 | def getProcs(): | |
24 |
module = dir( |
|
23 | module = dir(schainpy.model) | |
25 | procs = check_module(module, ProcessingUnit) |
|
24 | procs = check_module(module, ProcessingUnit) | |
26 | try: |
|
25 | try: | |
27 | procs.remove('ProcessingUnit') |
|
26 | procs.remove('ProcessingUnit') | |
@@ -30,7 +29,7 def getProcs(): | |||||
30 | return procs |
|
29 | return procs | |
31 |
|
30 | |||
32 | def getOperations(): |
|
31 | def getOperations(): | |
33 |
module = dir( |
|
32 | module = dir(schainpy.model) | |
34 | noProcs = [x for x in module if not x.endswith('Proc')] |
|
33 | noProcs = [x for x in module if not x.endswith('Proc')] | |
35 | operations = check_module(noProcs, Operation) |
|
34 | operations = check_module(noProcs, Operation) | |
36 | try: |
|
35 | try: | |
@@ -53,7 +52,7 def getArgs(op): | |||||
53 | return args |
|
52 | return args | |
54 |
|
53 | |||
55 | def getAll(): |
|
54 | def getAll(): | |
56 |
allModules = dir( |
|
55 | allModules = dir(schainpy.model) | |
57 | modules = check_module(allModules, Operation) |
|
56 | modules = check_module(allModules, Operation) | |
58 | modules.extend(check_module(allModules, ProcessingUnit)) |
|
57 | modules.extend(check_module(allModules, ProcessingUnit)) | |
59 | return modules |
|
58 | return modules |
General Comments 0
You need to be logged in to leave comments.
Login now