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