##// END OF EJS Templates
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
George Yong -
r1179:6414333e2ace
parent child
Show More
@@ -65,21 +65,38 def hildebrand_sekhon(data, navg):
65 mean : noise's level
65 mean : noise's level
66 """
66 """
67
67
68 sorted_spectrum = numpy.sort(data, axis=None)
68 sortdata = numpy.sort(data, axis=None)
69 nnoise = len(sorted_spectrum) # default to all points in the spectrum as noise
69 lenOfData = len(sortdata)
70 for npts in range(1, len(sorted_spectrum)+1):
70 nums_min = lenOfData*0.2
71 partial = sorted_spectrum[:npts]
71
72 mean = partial.mean()
72 if nums_min <= 5:
73 var = partial.var()
73
74 if var * navg < mean**2.:
74 nums_min = 5
75 nnoise = npts
75
76 else:
76 sump = 0.
77 # partial spectrum no longer has characteristics of white noise
77 sumq = 0.
78 break
78
79 j = 0
80 cont = 1
81
82 while((cont==1)and(j<lenOfData)):
83
84 sump += sortdata[j]
85 sumq += sortdata[j]**2
86
87 if j > nums_min:
88 rtest = float(j)/(j-1) + 1.0/navg
89 if ((sumq*j) > (rtest*sump**2)):
90 j = j - 1
91 sump = sump - sortdata[j]
92 sumq = sumq - sortdata[j]**2
93 cont = 0
94
95 j += 1
96
97 lnoise = sump /j
79
98
80 noise_spectrum = sorted_spectrum[:nnoise]
99 return lnoise
81 mean = noise_spectrum.mean()
82 return mean
83
100
84
101
85 class Beam:
102 class Beam:
@@ -4,7 +4,8 import numpy
4 import inspect
4 import inspect
5 from .figure import Figure, isRealtime, isTimeInHourRange
5 from .figure import Figure, isRealtime, isTimeInHourRange
6 from .plotting_codes import *
6 from .plotting_codes import *
7
7 from schainpy.model.proc.jroproc_base import MPDecorator
8 from schainpy.utils import log
8
9
9 class FitGauPlot(Figure):
10 class FitGauPlot(Figure):
10
11
@@ -225,8 +226,8 class MomentsPlot(Figure):
225 WIDTHPROF = None
226 WIDTHPROF = None
226 HEIGHTPROF = None
227 HEIGHTPROF = None
227 PREFIX = 'prm'
228 PREFIX = 'prm'
228 def __init__(self, **kwargs):
229 def __init__(self):
229 Figure.__init__(self, **kwargs)
230 Figure.__init__(self)
230 self.isConfig = False
231 self.isConfig = False
231 self.__nsubplots = 1
232 self.__nsubplots = 1
232
233
@@ -404,7 +405,6 class MomentsPlot(Figure):
404 thisDatetime=thisDatetime)
405 thisDatetime=thisDatetime)
405
406
406
407
407
408 class SkyMapPlot(Figure):
408 class SkyMapPlot(Figure):
409
409
410 __isConfig = None
410 __isConfig = None
@@ -773,7 +773,7 class WindProfilerPlot(Figure):
773 self.isConfig = False
773 self.isConfig = False
774 update_figfile = True
774 update_figfile = True
775
775
776
776 @MPDecorator
777 class ParametersPlot(Figure):
777 class ParametersPlot(Figure):
778
778
779 __isConfig = None
779 __isConfig = None
@@ -786,8 +786,8 class ParametersPlot(Figure):
786 nplots = None
786 nplots = None
787 nchan = None
787 nchan = None
788
788
789 def __init__(self, **kwargs):
789 def __init__(self):#, **kwargs):
790 Figure.__init__(self, **kwargs)
790 Figure.__init__(self)#, **kwargs)
791 self.timerange = None
791 self.timerange = None
792 self.isConfig = False
792 self.isConfig = False
793 self.__nsubplots = 1
793 self.__nsubplots = 1
@@ -866,6 +866,9 class ParametersPlot(Figure):
866 zmin : None,
866 zmin : None,
867 zmax : None
867 zmax : None
868 """
868 """
869 if dataOut.flagNoData:
870 return dataOut
871
869
872
870 if HEIGHT is not None:
873 if HEIGHT is not None:
871 self.HEIGHT = HEIGHT
874 self.HEIGHT = HEIGHT
@@ -981,8 +984,8 class ParametersPlot(Figure):
981 thisDatetime=thisDatetime,
984 thisDatetime=thisDatetime,
982 update_figfile=update_figfile)
985 update_figfile=update_figfile)
983
986
984
987 return dataOut
985
988 @MPDecorator
986 class Parameters1Plot(Figure):
989 class Parameters1Plot(Figure):
987
990
988 __isConfig = None
991 __isConfig = None
@@ -992,8 +995,8 class Parameters1Plot(Figure):
992 HEIGHTPROF = None
995 HEIGHTPROF = None
993 PREFIX = 'prm'
996 PREFIX = 'prm'
994
997
995 def __init__(self, **kwargs):
998 def __init__(self):
996 Figure.__init__(self, **kwargs)
999 Figure.__init__(self)
997 self.timerange = 2*60*60
1000 self.timerange = 2*60*60
998 self.isConfig = False
1001 self.isConfig = False
999 self.__nsubplots = 1
1002 self.__nsubplots = 1
@@ -1080,6 +1083,8 class Parameters1Plot(Figure):
1080 zmin : None,
1083 zmin : None,
1081 zmax : None
1084 zmax : None
1082 """
1085 """
1086 if dataOut.flagNoData:
1087 return dataOut
1083
1088
1084 data_param = getattr(dataOut, parameterObject)
1089 data_param = getattr(dataOut, parameterObject)
1085
1090
@@ -1230,6 +1235,7 class Parameters1Plot(Figure):
1230 wr_period=wr_period,
1235 wr_period=wr_period,
1231 thisDatetime=thisDatetime,
1236 thisDatetime=thisDatetime,
1232 update_figfile=False)
1237 update_figfile=False)
1238 return dataOut
1233
1239
1234 class SpectralFittingPlot(Figure):
1240 class SpectralFittingPlot(Figure):
1235
1241
@@ -2149,3 +2155,4 class NSMeteorDetection2Plot(Figure):
2149 ftp=ftp,
2155 ftp=ftp,
2150 wr_period=wr_period,
2156 wr_period=wr_period,
2151 thisDatetime=thisDatetime)
2157 thisDatetime=thisDatetime)
2158 No newline at end of file
@@ -23,8 +23,8 class SpectraPlot(Figure):
23 HEIGHTPROF = None
23 HEIGHTPROF = None
24 PREFIX = 'spc'
24 PREFIX = 'spc'
25
25
26 def __init__(self):#, **kwargs):
26 def __init__(self):
27 Figure.__init__(self)#, **kwargs)
27 Figure.__init__(self)
28 self.isConfig = False
28 self.isConfig = False
29 self.__nsubplots = 1
29 self.__nsubplots = 1
30 self.WIDTH = 250
30 self.WIDTH = 250
@@ -237,8 +237,8 class CrossSpectraPlot(Figure):
237 HEIGHTPROF = None
237 HEIGHTPROF = None
238 PREFIX = 'cspc'
238 PREFIX = 'cspc'
239
239
240 def __init__(self):#, **kwargs):
240 def __init__(self):
241 Figure.__init__(self)#, **kwargs)
241 Figure.__init__(self)
242 self.isConfig = False
242 self.isConfig = False
243 self.__nsubplots = 4
243 self.__nsubplots = 4
244 self.counter_imagwr = 0
244 self.counter_imagwr = 0
@@ -462,9 +462,9 class RTIPlot(Figure):
462 HEIGHTPROF = None
462 HEIGHTPROF = None
463 PREFIX = 'rti'
463 PREFIX = 'rti'
464
464
465 def __init__(self):#, **kwargs):
465 def __init__(self):
466
466
467 Figure.__init__(self)#, **kwargs)
467 Figure.__init__(self)
468 self.timerange = None
468 self.timerange = None
469 self.isConfig = False
469 self.isConfig = False
470 self.__nsubplots = 1
470 self.__nsubplots = 1
@@ -675,8 +675,8 class CoherenceMap(Figure):
675 HEIGHTPROF = None
675 HEIGHTPROF = None
676 PREFIX = 'cmap'
676 PREFIX = 'cmap'
677
677
678 def __init__(self):#, **kwargs):
678 def __init__(self):
679 Figure.__init__(self)#, **kwargs)
679 Figure.__init__(self)
680 self.timerange = 2*60*60
680 self.timerange = 2*60*60
681 self.isConfig = False
681 self.isConfig = False
682 self.__nsubplots = 1
682 self.__nsubplots = 1
@@ -887,8 +887,8 class PowerProfilePlot(Figure):
887 HEIGHTPROF = None
887 HEIGHTPROF = None
888 PREFIX = 'spcprofile'
888 PREFIX = 'spcprofile'
889
889
890 def __init__(self):#, **kwargs):
890 def __init__(self):
891 Figure.__init__(self)#, **kwargs)
891 Figure.__init__(self)
892 self.isConfig = False
892 self.isConfig = False
893 self.__nsubplots = 1
893 self.__nsubplots = 1
894
894
@@ -1017,8 +1017,8 class SpectraCutPlot(Figure):
1017 HEIGHTPROF = None
1017 HEIGHTPROF = None
1018 PREFIX = 'spc_cut'
1018 PREFIX = 'spc_cut'
1019
1019
1020 def __init__(self):#, **kwargs):
1020 def __init__(self):
1021 Figure.__init__(self)#, **kwargs)
1021 Figure.__init__(self)
1022 self.isConfig = False
1022 self.isConfig = False
1023 self.__nsubplots = 1
1023 self.__nsubplots = 1
1024
1024
@@ -1153,8 +1153,8 class Noise(Figure):
1153 PREFIX = 'noise'
1153 PREFIX = 'noise'
1154
1154
1155
1155
1156 def __init__(self):#, **kwargs):
1156 def __init__(self):
1157 Figure.__init__(self)#, **kwargs)
1157 Figure.__init__(self)
1158 self.timerange = 24*60*60
1158 self.timerange = 24*60*60
1159 self.isConfig = False
1159 self.isConfig = False
1160 self.__nsubplots = 1
1160 self.__nsubplots = 1
@@ -1359,8 +1359,8 class BeaconPhase(Figure):
1359
1359
1360 PREFIX = 'beacon_phase'
1360 PREFIX = 'beacon_phase'
1361
1361
1362 def __init__(self):#, **kwargs):
1362 def __init__(self):
1363 Figure.__init__(self)#, **kwargs)
1363 Figure.__init__(self)
1364 self.timerange = 24*60*60
1364 self.timerange = 24*60*60
1365 self.isConfig = False
1365 self.isConfig = False
1366 self.__nsubplots = 1
1366 self.__nsubplots = 1
@@ -1584,4 +1584,4 class BeaconPhase(Figure):
1584 thisDatetime=thisDatetime,
1584 thisDatetime=thisDatetime,
1585 update_figfile=update_figfile)
1585 update_figfile=update_figfile)
1586
1586
1587 return dataOut #Yong No newline at end of file
1587 return dataOut No newline at end of file
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -1823,4 +1823,6 class JRODataWriter(JRODataIO):
1823 set=set, ext=ext, datatype=datatype, **kwargs)
1823 set=set, ext=ext, datatype=datatype, **kwargs)
1824 self.isConfig = True
1824 self.isConfig = True
1825
1825
1826 self.dataOut = dataOut
1826 self.putData()
1827 self.putData()
1828 return self.dataOut No newline at end of file
@@ -6,13 +6,14 import re
6 import datetime
6 import datetime
7
7
8 from schainpy.model.data.jrodata import *
8 from schainpy.model.data.jrodata import *
9 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation
9 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
10 # from .jroIO_base import *
10 # from .jroIO_base import *
11 from schainpy.model.io.jroIO_base import *
11 from schainpy.model.io.jroIO_base import *
12 import schainpy
12 import schainpy
13 from schainpy.utils import log
13
14
14
15 @MPDecorator
15 class ParamReader(ProcessingUnit):
16 class ParamReader(JRODataReader,ProcessingUnit):
16 '''
17 '''
17 Reads HDF5 format files
18 Reads HDF5 format files
18
19
@@ -74,8 +75,8 class ParamReader(ProcessingUnit):
74 dataOut = None
75 dataOut = None
75
76
76
77
77 def __init__(self, **kwargs):
78 def __init__(self):#, **kwargs):
78 ProcessingUnit.__init__(self, **kwargs)
79 ProcessingUnit.__init__(self) #, **kwargs)
79 self.dataOut = Parameters()
80 self.dataOut = Parameters()
80 return
81 return
81
82
@@ -534,7 +535,7 class ParamReader(ProcessingUnit):
534 self.getData()
535 self.getData()
535
536
536 return
537 return
537
538 @MPDecorator
538 class ParamWriter(Operation):
539 class ParamWriter(Operation):
539 '''
540 '''
540 HDF5 Writer, stores parameters data in HDF5 format files
541 HDF5 Writer, stores parameters data in HDF5 format files
@@ -602,9 +603,9 class ParamWriter(Operation):
602
603
603 lastTime = None
604 lastTime = None
604
605
605 def __init__(self, **kwargs):
606 def __init__(self):#, **kwargs):
606 Operation.__init__(self, **kwargs)
607 Operation.__init__(self)#, **kwargs)
607 self.isConfig = False
608 #self.isConfig = False
608 return
609 return
609
610
610 def setup(self, dataOut, path=None, blocksPerFile=10, metadataList=None, dataList=None, mode=None, **kwargs):
611 def setup(self, dataOut, path=None, blocksPerFile=10, metadataList=None, dataList=None, mode=None, **kwargs):
@@ -614,11 +615,12 class ParamWriter(Operation):
614 self.dataList = dataList
615 self.dataList = dataList
615 self.dataOut = dataOut
616 self.dataOut = dataOut
616 self.mode = mode
617 self.mode = mode
617
618 if self.mode is not None:
618 if self.mode is not None:
619 self.mode = numpy.zeros(len(self.dataList)) + mode
619 self.mode = numpy.zeros(len(self.dataList)) + mode
620 else:
620 else:
621 #self.mode = numpy.ones(len(self.dataList),int)
621 self.mode = numpy.ones(len(self.dataList))
622 self.mode = numpy.ones(len(self.dataList))
623 log.error(self.mode)#yong
622
624
623 arrayDim = numpy.zeros((len(self.dataList),5))
625 arrayDim = numpy.zeros((len(self.dataList),5))
624
626
@@ -640,6 +642,9 class ParamWriter(Operation):
640
642
641 #Not array, just a number
643 #Not array, just a number
642 #Mode 0
644 #Mode 0
645 #log.error(mode)#yong
646 #log.error(len(mode))#yong
647 #log.error(type(mode))#yong
643 if type(dataAux)==float or type(dataAux)==int:
648 if type(dataAux)==float or type(dataAux)==int:
644 dsDict['mode'] = 0
649 dsDict['mode'] = 0
645 dsDict['nDim'] = 0
650 dsDict['nDim'] = 0
@@ -647,7 +652,7 class ParamWriter(Operation):
647 dsList.append(dsDict)
652 dsList.append(dsDict)
648
653
649 #Mode 2: meteors
654 #Mode 2: meteors
650 elif mode[i] == 2:
655 elif self.mode[i] == 2:
651 # dsDict['nDim'] = 0
656 # dsDict['nDim'] = 0
652 dsDict['dsName'] = 'table0'
657 dsDict['dsName'] = 'table0'
653 dsDict['mode'] = 2 # Mode meteors
658 dsDict['mode'] = 2 # Mode meteors
@@ -656,7 +661,7 class ParamWriter(Operation):
656 dsDict['dsNumber'] = 1
661 dsDict['dsNumber'] = 1
657
662
658 arrayDim[i,3] = dataAux.shape[-1]
663 arrayDim[i,3] = dataAux.shape[-1]
659 arrayDim[i,4] = mode[i] #Mode the data was stored
664 arrayDim[i,4] = self.mode[i] #Mode the data was stored
660
665
661 dsList.append(dsDict)
666 dsList.append(dsDict)
662
667
@@ -664,7 +669,7 class ParamWriter(Operation):
664 else:
669 else:
665 arrayDim0 = dataAux.shape #Data dimensions
670 arrayDim0 = dataAux.shape #Data dimensions
666 arrayDim[i,0] = len(arrayDim0) #Number of array dimensions
671 arrayDim[i,0] = len(arrayDim0) #Number of array dimensions
667 arrayDim[i,4] = mode[i] #Mode the data was stored
672 arrayDim[i,4] = self.mode[i] #Mode the data was stored
668
673
669 strtable = 'table'
674 strtable = 'table'
670 dsDict['mode'] = 1 # Mode parameters
675 dsDict['mode'] = 1 # Mode parameters
@@ -846,7 +851,7 class ParamWriter(Operation):
846 os.makedirs(fullpath)
851 os.makedirs(fullpath)
847 setFile = -1 #inicializo mi contador de seteo
852 setFile = -1 #inicializo mi contador de seteo
848
853
849 if self.setType is None:
854 if None is None:
850 setFile += 1
855 setFile += 1
851 file = '%s%4.4d%3.3d%03d%s' % (self.metaoptchar,
856 file = '%s%4.4d%3.3d%03d%s' % (self.metaoptchar,
852 timeTuple.tm_year,
857 timeTuple.tm_year,
@@ -902,11 +907,13 class ParamWriter(Operation):
902 for j in range(dsInfo['dsNumber']):
907 for j in range(dsInfo['dsNumber']):
903 dsInfo = dsList[i]
908 dsInfo = dsList[i]
904 tableName = dsInfo['dsName']
909 tableName = dsInfo['dsName']
905 shape = int(dsInfo['shape'])
910
906
911
907 if dsInfo['nDim'] == 3:
912 if dsInfo['nDim'] == 3:
913 shape = dsInfo['shape'].astype(int)
908 ds0 = grp0.create_dataset(tableName, (shape[0],shape[1],1) , data = numpy.zeros((shape[0],shape[1],1)), maxshape = (None,shape[1],None), chunks=True)
914 ds0 = grp0.create_dataset(tableName, (shape[0],shape[1],1) , data = numpy.zeros((shape[0],shape[1],1)), maxshape = (None,shape[1],None), chunks=True)
909 else:
915 else:
916 shape = int(dsInfo['shape'])
910 ds0 = grp0.create_dataset(tableName, (1,shape), data = numpy.zeros((1,shape)) , maxshape=(None,shape), chunks=True)
917 ds0 = grp0.create_dataset(tableName, (1,shape), data = numpy.zeros((1,shape)) , maxshape=(None,shape), chunks=True)
911
918
912 ds.append(ds0)
919 ds.append(ds0)
@@ -1078,7 +1085,7 class ParamWriter(Operation):
1078 self.fp.close()
1085 self.fp.close()
1079 return
1086 return
1080
1087
1081 def run(self, dataOut, path=None, blocksPerFile=10, metadataList=None, dataList=None, mode=None, **kwargs):
1088 def run(self, dataOut, path, blocksPerFile=10, metadataList=None, dataList=None, mode=None, **kwargs):
1082
1089
1083 if not(self.isConfig):
1090 if not(self.isConfig):
1084 flagdata = self.setup(dataOut, path=path, blocksPerFile=blocksPerFile,
1091 flagdata = self.setup(dataOut, path=path, blocksPerFile=blocksPerFile,
@@ -1093,3 +1100,4 class ParamWriter(Operation):
1093
1100
1094 self.putData()
1101 self.putData()
1095 return
1102 return
1103 No newline at end of file
@@ -9,6 +9,7 from schainpy.model.io.jroIO_base import LOCALTIME, JRODataReader, JRODataWriter
9 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
9 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
10 from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader
10 from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader
11 from schainpy.model.data.jrodata import Spectra
11 from schainpy.model.data.jrodata import Spectra
12 from schainpy.utils import log
12
13
13 @MPDecorator
14 @MPDecorator
14 class SpectraReader(JRODataReader, ProcessingUnit):
15 class SpectraReader(JRODataReader, ProcessingUnit):
@@ -388,7 +389,7 class SpectraReader(JRODataReader, ProcessingUnit):
388 self.dataOut.realtime = self.online
389 self.dataOut.realtime = self.online
389
390
390 return self.dataOut.data_spc
391 return self.dataOut.data_spc
391
392 @MPDecorator
392 class SpectraWriter(JRODataWriter, Operation):
393 class SpectraWriter(JRODataWriter, Operation):
393
394
394 """
395 """
@@ -414,7 +415,7 class SpectraWriter(JRODataWriter, Operation):
414
415
415 # dataOut = None
416 # dataOut = None
416
417
417 def __init__(self, **kwargs):
418 def __init__(self):#, **kwargs):
418 """
419 """
419 Inicializador de la clase SpectraWriter para la escritura de datos de espectros.
420 Inicializador de la clase SpectraWriter para la escritura de datos de espectros.
420
421
@@ -428,9 +429,9 class SpectraWriter(JRODataWriter, Operation):
428 Return: None
429 Return: None
429 """
430 """
430
431
431 Operation.__init__(self, **kwargs)
432 Operation.__init__(self)#, **kwargs)
432
433
433 self.isConfig = False
434 #self.isConfig = False
434
435
435 self.nTotalBlocks = 0
436 self.nTotalBlocks = 0
436
437
@@ -594,8 +595,6 class SpectraWriter(JRODataWriter, Operation):
594 # self.setFirstHeader()
595 # self.setFirstHeader()
595 self.writeNextBlock()
596 self.writeNextBlock()
596
597
597 return 1
598
599 def __getBlockSize(self):
598 def __getBlockSize(self):
600 '''
599 '''
601 Este metodos determina el cantidad de bytes para un bloque de datos de tipo Spectra
600 Este metodos determina el cantidad de bytes para un bloque de datos de tipo Spectra
@@ -556,7 +556,7 class VoltageReader(JRODataReader, ProcessingUnit):
556
556
557 return self.dataOut.data
557 return self.dataOut.data
558
558
559
559 @MPDecorator
560 class VoltageWriter(JRODataWriter, Operation):
560 class VoltageWriter(JRODataWriter, Operation):
561 """
561 """
562 Esta clase permite escribir datos de voltajes a archivos procesados (.r). La escritura
562 Esta clase permite escribir datos de voltajes a archivos procesados (.r). La escritura
@@ -569,7 +569,7 class VoltageWriter(JRODataWriter, Operation):
569
569
570 shapeBuffer = None
570 shapeBuffer = None
571
571
572 def __init__(self, **kwargs):
572 def __init__(self):#, **kwargs):
573 """
573 """
574 Inicializador de la clase VoltageWriter para la escritura de datos de espectros.
574 Inicializador de la clase VoltageWriter para la escritura de datos de espectros.
575
575
@@ -578,7 +578,7 class VoltageWriter(JRODataWriter, Operation):
578
578
579 Return: None
579 Return: None
580 """
580 """
581 Operation.__init__(self, **kwargs)
581 Operation.__init__(self)#, **kwargs)
582
582
583 self.nTotalBlocks = 0
583 self.nTotalBlocks = 0
584
584
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -17,11 +17,11 import time
17
17
18
18
19 from scipy.optimize import fmin_l_bfgs_b #optimize with bounds on state papameters
19 from scipy.optimize import fmin_l_bfgs_b #optimize with bounds on state papameters
20 from .jroproc_base import ProcessingUnit, Operation
20 from .jroproc_base import ProcessingUnit, Operation, MPDecorator
21 from schainpy.model.data.jrodata import Parameters, hildebrand_sekhon
21 from schainpy.model.data.jrodata import Parameters, hildebrand_sekhon
22 from scipy import asarray as ar,exp
22 from scipy import asarray as ar,exp
23 from scipy.optimize import curve_fit
23 from scipy.optimize import curve_fit
24
24 from schainpy.utils import log
25 import warnings
25 import warnings
26 from numpy import NaN
26 from numpy import NaN
27 from scipy.optimize.optimize import OptimizeWarning
27 from scipy.optimize.optimize import OptimizeWarning
@@ -49,8 +49,10 def _unpickle_method(func_name, obj, cls):
49 break
49 break
50 return func.__get__(obj, cls)
50 return func.__get__(obj, cls)
51
51
52 @MPDecorator
52 class ParametersProc(ProcessingUnit):
53 class ParametersProc(ProcessingUnit):
53
54
55 METHODS = {}
54 nSeconds = None
56 nSeconds = None
55
57
56 def __init__(self):
58 def __init__(self):
@@ -61,6 +63,7 class ParametersProc(ProcessingUnit):
61 self.firstdatatime = None
63 self.firstdatatime = None
62 self.profIndex = 0
64 self.profIndex = 0
63 self.dataOut = Parameters()
65 self.dataOut = Parameters()
66 self.setupReq = False #Agregar a todas las unidades de proc
64
67
65 def __updateObjFromInput(self):
68 def __updateObjFromInput(self):
66
69
@@ -98,6 +101,8 class ParametersProc(ProcessingUnit):
98
101
99 def run(self):
102 def run(self):
100
103
104
105
101 #---------------------- Voltage Data ---------------------------
106 #---------------------- Voltage Data ---------------------------
102
107
103 if self.dataIn.type == "Voltage":
108 if self.dataIn.type == "Voltage":
@@ -1401,7 +1406,7 class SpectralMoments(Operation):
1401 dataOut.data_DOP = data_param[:,1]
1406 dataOut.data_DOP = data_param[:,1]
1402 dataOut.data_MEAN = data_param[:,2]
1407 dataOut.data_MEAN = data_param[:,2]
1403 dataOut.data_STD = data_param[:,3]
1408 dataOut.data_STD = data_param[:,3]
1404 return
1409 return dataOut
1405
1410
1406 def __calculateMoments(self, oldspec, oldfreq, n0,
1411 def __calculateMoments(self, oldspec, oldfreq, n0,
1407 nicoh = None, graph = None, smooth = None, type1 = None, fwindow = None, snrth = None, dc = None, aliasing = None, oldfd = None, wwauto = None):
1412 nicoh = None, graph = None, smooth = None, type1 = None, fwindow = None, snrth = None, dc = None, aliasing = None, oldfd = None, wwauto = None):
@@ -10,16 +10,10 from schainpy.utils import log
10 @MPDecorator
10 @MPDecorator
11 class SpectraProc(ProcessingUnit):
11 class SpectraProc(ProcessingUnit):
12
12
13 METHODS = {'selectHeights' : ['minHei', 'maxHei'],
14 'selectChannels' : 'channelList',
15 'selectChannelsByIndex': 'channelIndexList',
16 'getBeaconSignal' : ['tauindex', 'channelindex', 'hei_ref'],
17 'selectHeightsByIndex' : ['minIndex', 'maxIndex']
18 }
19
13
20 def __init__(self):#, **kwargs):
14 def __init__(self):
21
15
22 ProcessingUnit.__init__(self)#, **kwargs)
16 ProcessingUnit.__init__(self)
23
17
24 self.buffer = None
18 self.buffer = None
25 self.firstdatatime = None
19 self.firstdatatime = None
@@ -129,10 +123,6 class SpectraProc(ProcessingUnit):
129
123
130 if self.dataIn.type == "Spectra":
124 if self.dataIn.type == "Spectra":
131 self.dataOut.copy(self.dataIn)
125 self.dataOut.copy(self.dataIn)
132 # if not pairsList:
133 # pairsList = itertools.combinations(self.dataOut.channelList, 2)
134 # if self.dataOut.data_cspc is not None:
135 # self.__selectPairs(pairsList)
136 if shift_fft:
126 if shift_fft:
137 #desplaza a la derecha en el eje 2 determinadas posiciones
127 #desplaza a la derecha en el eje 2 determinadas posiciones
138 shift = int(self.dataOut.nFFTPoints/2)
128 shift = int(self.dataOut.nFFTPoints/2)
@@ -802,12 +792,9 class IncohInt(Operation):
802
792
803 n = None
793 n = None
804
794
805 def __init__(self):#, **kwargs):
795 def __init__(self):
806
796
807 Operation.__init__(self)#, **kwargs)
797 Operation.__init__(self)
808
809
810 # self.isConfig = False
811
798
812 def setup(self, n=None, timeInterval=None, overlapping=False):
799 def setup(self, n=None, timeInterval=None, overlapping=False):
813 """
800 """
@@ -838,7 +825,7 class IncohInt(Operation):
838 if n is not None:
825 if n is not None:
839 self.n = int(n)
826 self.n = int(n)
840 else:
827 else:
841 # if (type(timeInterval)!=integer) -> change this line
828
842 self.__integrationtime = int(timeInterval)
829 self.__integrationtime = int(timeInterval)
843 self.n = None
830 self.n = None
844 self.__byTime = True
831 self.__byTime = True
@@ -332,9 +332,9 class CohInt(Operation):
332 __dataToPutStride = False
332 __dataToPutStride = False
333 n = None
333 n = None
334
334
335 def __init__(self):#, **kwargs):
335 def __init__(self, **kwargs):
336
336
337 Operation.__init__(self)#, **kwargs)
337 Operation.__init__(self, **kwargs)
338
338
339 # self.isConfig = False
339 # self.isConfig = False
340
340
@@ -589,14 +589,14 class Decoder(Operation):
589 nCode = None
589 nCode = None
590 nBaud = None
590 nBaud = None
591
591
592 def __init__(self):#, **kwargs):
592 def __init__(self, **kwargs):
593
593
594 Operation.__init__(self)#, **kwargs)
594 Operation.__init__(self, **kwargs)
595
595
596 self.times = None
596 self.times = None
597 self.osamp = None
597 self.osamp = None
598 # self.__setValues = False
598 # self.__setValues = False
599 # self.isConfig = False
599 self.isConfig = False
600 self.setupReq = False
600 self.setupReq = False
601 def setup(self, code, osamp, dataOut):
601 def setup(self, code, osamp, dataOut):
602
602
@@ -777,9 +777,9 class ProfileConcat(Operation):
777 isConfig = False
777 isConfig = False
778 buffer = None
778 buffer = None
779
779
780 def __init__(self):#, **kwargs):
780 def __init__(self, **kwargs):
781
781
782 Operation.__init__(self)#, **kwargs)
782 Operation.__init__(self, **kwargs)
783 self.profileIndex = 0
783 self.profileIndex = 0
784
784
785 def reset(self):
785 def reset(self):
@@ -829,9 +829,9 class ProfileSelector(Operation):
829 # Tamanho total de los perfiles
829 # Tamanho total de los perfiles
830 nProfiles = None
830 nProfiles = None
831
831
832 def __init__(self):#, **kwargs):
832 def __init__(self, **kwargs):
833
833
834 Operation.__init__(self)#, **kwargs)
834 Operation.__init__(self, **kwargs)
835 self.profileIndex = 0
835 self.profileIndex = 0
836
836
837 def incProfileIndex(self):
837 def incProfileIndex(self):
@@ -986,9 +986,9 class ProfileSelector(Operation):
986
986
987 class Reshaper(Operation):
987 class Reshaper(Operation):
988
988
989 def __init__(self):#, **kwargs):
989 def __init__(self, **kwargs):
990
990
991 Operation.__init__(self)#, **kwargs)
991 Operation.__init__(self, **kwargs)
992
992
993 self.__buffer = None
993 self.__buffer = None
994 self.__nitems = 0
994 self.__nitems = 0
@@ -1091,9 +1091,9 class Reshaper(Operation):
1091
1091
1092 class SplitProfiles(Operation):
1092 class SplitProfiles(Operation):
1093
1093
1094 def __init__(self):#, **kwargs):
1094 def __init__(self, **kwargs):
1095
1095
1096 Operation.__init__(self)#, **kwargs)
1096 Operation.__init__(self, **kwargs)
1097
1097
1098 def run(self, dataOut, n):
1098 def run(self, dataOut, n):
1099
1099
@@ -1132,9 +1132,9 class SplitProfiles(Operation):
1132 return dataOut
1132 return dataOut
1133
1133
1134 class CombineProfiles(Operation):
1134 class CombineProfiles(Operation):
1135 def __init__(self):#, **kwargs):
1135 def __init__(self, **kwargs):
1136
1136
1137 Operation.__init__(self)#, **kwargs)
1137 Operation.__init__(self, **kwargs)
1138
1138
1139 self.__remData = None
1139 self.__remData = None
1140 self.__profileIndex = 0
1140 self.__profileIndex = 0
General Comments 0
You need to be logged in to leave comments. Login now