|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1179,6 +1179,8 class Parameters(Spectra): | |||
|
1179 | 1179 | nAvg = None |
|
1180 | 1180 | |
|
1181 | 1181 | noise_estimation = None |
|
1182 | ||
|
1183 | GauSPC = None #Fit gaussian SPC | |
|
1182 | 1184 | |
|
1183 | 1185 | |
|
1184 | 1186 | def __init__(self): |
@@ -1199,7 +1201,7 class Parameters(Spectra): | |||
|
1199 | 1201 | time1 = self.utctimeInit - self.timeZone*60 |
|
1200 | 1202 | else: |
|
1201 | 1203 | time1 = self.utctimeInit |
|
1202 | ||
|
1204 | print 'interval',interval | |
|
1203 | 1205 | datatime.append(time1) |
|
1204 | 1206 | datatime.append(time1 + interval) |
|
1205 | 1207 | datatime = numpy.array(datatime) |
@@ -1213,8 +1215,15 class Parameters(Spectra): | |||
|
1213 | 1215 | else: |
|
1214 | 1216 | return self.paramInterval |
|
1215 | 1217 | |
|
1218 | def setValue(self, value): | |
|
1219 | ||
|
1220 | print "This property should not be initialized" | |
|
1221 | ||
|
1222 | return | |
|
1223 | ||
|
1216 | 1224 | def getNoise(self): |
|
1217 | 1225 | |
|
1218 | 1226 | return self.spc_noise |
|
1219 | 1227 | |
|
1220 | 1228 | timeInterval = property(getTimeInterval) |
|
1229 | noise = property(getNoise, setValue, "I'm the 'Noise' property.") |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -6,6 +6,217 from figure import Figure, isRealtime, isTimeInHourRange | |||
|
6 | 6 | from plotting_codes import * |
|
7 | 7 | |
|
8 | 8 | |
|
9 | class FitGauPlot(Figure): | |
|
10 | ||
|
11 | isConfig = None | |
|
12 | __nsubplots = None | |
|
13 | ||
|
14 | WIDTHPROF = None | |
|
15 | HEIGHTPROF = None | |
|
16 | PREFIX = 'fitgau' | |
|
17 | ||
|
18 | def __init__(self, **kwargs): | |
|
19 | Figure.__init__(self, **kwargs) | |
|
20 | self.isConfig = False | |
|
21 | self.__nsubplots = 1 | |
|
22 | ||
|
23 | self.WIDTH = 250 | |
|
24 | self.HEIGHT = 250 | |
|
25 | self.WIDTHPROF = 120 | |
|
26 | self.HEIGHTPROF = 0 | |
|
27 | self.counter_imagwr = 0 | |
|
28 | ||
|
29 | self.PLOT_CODE = SPEC_CODE | |
|
30 | ||
|
31 | self.FTP_WEI = None | |
|
32 | self.EXP_CODE = None | |
|
33 | self.SUB_EXP_CODE = None | |
|
34 | self.PLOT_POS = None | |
|
35 | ||
|
36 | self.__xfilter_ena = False | |
|
37 | self.__yfilter_ena = False | |
|
38 | ||
|
39 | def getSubplots(self): | |
|
40 | ||
|
41 | ncol = int(numpy.sqrt(self.nplots)+0.9) | |
|
42 | nrow = int(self.nplots*1./ncol + 0.9) | |
|
43 | ||
|
44 | return nrow, ncol | |
|
45 | ||
|
46 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): | |
|
47 | ||
|
48 | self.__showprofile = showprofile | |
|
49 | self.nplots = nplots | |
|
50 | ||
|
51 | ncolspan = 1 | |
|
52 | colspan = 1 | |
|
53 | if showprofile: | |
|
54 | ncolspan = 3 | |
|
55 | colspan = 2 | |
|
56 | self.__nsubplots = 2 | |
|
57 | ||
|
58 | self.createFigure(id = id, | |
|
59 | wintitle = wintitle, | |
|
60 | widthplot = self.WIDTH + self.WIDTHPROF, | |
|
61 | heightplot = self.HEIGHT + self.HEIGHTPROF, | |
|
62 | show=show) | |
|
63 | ||
|
64 | nrow, ncol = self.getSubplots() | |
|
65 | ||
|
66 | counter = 0 | |
|
67 | for y in range(nrow): | |
|
68 | for x in range(ncol): | |
|
69 | ||
|
70 | if counter >= self.nplots: | |
|
71 | break | |
|
72 | ||
|
73 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) | |
|
74 | ||
|
75 | if showprofile: | |
|
76 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) | |
|
77 | ||
|
78 | counter += 1 | |
|
79 | ||
|
80 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, | |
|
81 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, | |
|
82 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, | |
|
83 | server=None, folder=None, username=None, password=None, | |
|
84 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False, | |
|
85 | xaxis="frequency", colormap='jet', normFactor=None , GauSelector = 1): | |
|
86 | ||
|
87 | """ | |
|
88 | ||
|
89 | Input: | |
|
90 | dataOut : | |
|
91 | id : | |
|
92 | wintitle : | |
|
93 | channelList : | |
|
94 | showProfile : | |
|
95 | xmin : None, | |
|
96 | xmax : None, | |
|
97 | ymin : None, | |
|
98 | ymax : None, | |
|
99 | zmin : None, | |
|
100 | zmax : None | |
|
101 | """ | |
|
102 | if realtime: | |
|
103 | if not(isRealtime(utcdatatime = dataOut.utctime)): | |
|
104 | print 'Skipping this plot function' | |
|
105 | return | |
|
106 | ||
|
107 | if channelList == None: | |
|
108 | channelIndexList = dataOut.channelIndexList | |
|
109 | else: | |
|
110 | channelIndexList = [] | |
|
111 | for channel in channelList: | |
|
112 | if channel not in dataOut.channelList: | |
|
113 | raise ValueError, "Channel %d is not in dataOut.channelList" %channel | |
|
114 | channelIndexList.append(dataOut.channelList.index(channel)) | |
|
115 | ||
|
116 | # if normFactor is None: | |
|
117 | # factor = dataOut.normFactor | |
|
118 | # else: | |
|
119 | # factor = normFactor | |
|
120 | if xaxis == "frequency": | |
|
121 | x = dataOut.spc_range[0] | |
|
122 | xlabel = "Frequency (kHz)" | |
|
123 | ||
|
124 | elif xaxis == "time": | |
|
125 | x = dataOut.spc_range[1] | |
|
126 | xlabel = "Time (ms)" | |
|
127 | ||
|
128 | else: | |
|
129 | x = dataOut.spc_range[2] | |
|
130 | xlabel = "Velocity (m/s)" | |
|
131 | ||
|
132 | ylabel = "Range (Km)" | |
|
133 | ||
|
134 | y = dataOut.getHeiRange() | |
|
135 | ||
|
136 | z = dataOut.GauSPC[:,GauSelector,:,:] #GauSelector] #dataOut.data_spc/factor | |
|
137 | print 'GausSPC', z[0,32,10:40] | |
|
138 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | |
|
139 | zdB = 10*numpy.log10(z) | |
|
140 | ||
|
141 | avg = numpy.average(z, axis=1) | |
|
142 | avgdB = 10*numpy.log10(avg) | |
|
143 | ||
|
144 | noise = dataOut.spc_noise | |
|
145 | noisedB = 10*numpy.log10(noise) | |
|
146 | ||
|
147 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) | |
|
148 | title = wintitle + " Spectra" | |
|
149 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): | |
|
150 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) | |
|
151 | ||
|
152 | if not self.isConfig: | |
|
153 | ||
|
154 | nplots = len(channelIndexList) | |
|
155 | ||
|
156 | self.setup(id=id, | |
|
157 | nplots=nplots, | |
|
158 | wintitle=wintitle, | |
|
159 | showprofile=showprofile, | |
|
160 | show=show) | |
|
161 | ||
|
162 | if xmin == None: xmin = numpy.nanmin(x) | |
|
163 | if xmax == None: xmax = numpy.nanmax(x) | |
|
164 | if ymin == None: ymin = numpy.nanmin(y) | |
|
165 | if ymax == None: ymax = numpy.nanmax(y) | |
|
166 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 | |
|
167 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 | |
|
168 | ||
|
169 | self.FTP_WEI = ftp_wei | |
|
170 | self.EXP_CODE = exp_code | |
|
171 | self.SUB_EXP_CODE = sub_exp_code | |
|
172 | self.PLOT_POS = plot_pos | |
|
173 | ||
|
174 | self.isConfig = True | |
|
175 | ||
|
176 | self.setWinTitle(title) | |
|
177 | ||
|
178 | for i in range(self.nplots): | |
|
179 | index = channelIndexList[i] | |
|
180 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) | |
|
181 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[index], noisedB[index], str_datetime) | |
|
182 | if len(dataOut.beam.codeList) != 0: | |
|
183 | title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[index], noisedB[index], dataOut.beam.azimuthList[index], dataOut.beam.zenithList[index], str_datetime) | |
|
184 | ||
|
185 | axes = self.axesList[i*self.__nsubplots] | |
|
186 | axes.pcolor(x, y, zdB[index,:,:], | |
|
187 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
|
188 | xlabel=xlabel, ylabel=ylabel, title=title, colormap=colormap, | |
|
189 | ticksize=9, cblabel='') | |
|
190 | ||
|
191 | if self.__showprofile: | |
|
192 | axes = self.axesList[i*self.__nsubplots +1] | |
|
193 | axes.pline(avgdB[index,:], y, | |
|
194 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, | |
|
195 | xlabel='dB', ylabel='', title='', | |
|
196 | ytick_visible=False, | |
|
197 | grid='x') | |
|
198 | ||
|
199 | noiseline = numpy.repeat(noisedB[index], len(y)) | |
|
200 | axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) | |
|
201 | ||
|
202 | self.draw() | |
|
203 | ||
|
204 | if figfile == None: | |
|
205 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
206 | name = str_datetime | |
|
207 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): | |
|
208 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) | |
|
209 | figfile = self.getFilename(name) | |
|
210 | ||
|
211 | self.save(figpath=figpath, | |
|
212 | figfile=figfile, | |
|
213 | save=save, | |
|
214 | ftp=ftp, | |
|
215 | wr_period=wr_period, | |
|
216 | thisDatetime=thisDatetime) | |
|
217 | ||
|
218 | ||
|
219 | ||
|
9 | 220 | class MomentsPlot(Figure): |
|
10 | 221 | |
|
11 | 222 | isConfig = None |
@@ -446,10 +657,14 class WindProfilerPlot(Figure): | |||
|
446 | 657 | # tmin = None |
|
447 | 658 | # tmax = None |
|
448 | 659 | |
|
449 | ||
|
450 | x = dataOut.getTimeRange1(dataOut.outputInterval) | |
|
660 | x = dataOut.getTimeRange1(dataOut.paramInterval) | |
|
451 | 661 | y = dataOut.heightList |
|
452 | 662 | z = dataOut.data_output.copy() |
|
663 | print ' ' | |
|
664 | print 'Xvel',z[0] | |
|
665 | print ' ' | |
|
666 | print 'Yvel',z[1] | |
|
667 | print ' ' | |
|
453 | 668 | nplots = z.shape[0] #Number of wind dimensions estimated |
|
454 | 669 | nplotsw = nplots |
|
455 | 670 | |
@@ -559,7 +774,7 class WindProfilerPlot(Figure): | |||
|
559 | 774 | thisDatetime=thisDatetime, |
|
560 | 775 | update_figfile=update_figfile) |
|
561 | 776 | |
|
562 |
if dataOut.ltctime + dataOut. |
|
|
777 | if dataOut.ltctime + dataOut.paramInterval >= self.xmax: | |
|
563 | 778 | self.counter_imagwr = wr_period |
|
564 | 779 | self.isConfig = False |
|
565 | 780 | update_figfile = True |
@@ -636,12 +851,12 class ParametersPlot(Figure): | |||
|
636 | 851 | |
|
637 | 852 | counter += 1 |
|
638 | 853 | |
|
639 |
def run(self, dataOut, id, wintitle="", channelList=None, paramIndex = 0, colormap= |
|
|
854 | def run(self, dataOut, id, wintitle="", channelList=None, paramIndex = 0, colormap="jet", | |
|
640 | 855 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, timerange=None, |
|
641 | 856 | showSNR=False, SNRthresh = -numpy.inf, SNRmin=None, SNRmax=None, |
|
642 | 857 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
643 | 858 | server=None, folder=None, username=None, password=None, |
|
644 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): | |
|
859 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, HEIGHT=None): | |
|
645 | 860 | """ |
|
646 | 861 | |
|
647 | 862 | Input: |
@@ -657,12 +872,11 class ParametersPlot(Figure): | |||
|
657 | 872 | zmin : None, |
|
658 | 873 | zmax : None |
|
659 | 874 | """ |
|
660 | ||
|
661 | if colormap: | |
|
662 | colormap="jet" | |
|
663 |
|
|
|
664 | colormap="RdBu_r" | |
|
665 | ||
|
875 | ||
|
876 | if HEIGHT is not None: | |
|
877 | self.HEIGHT = HEIGHT | |
|
878 | ||
|
879 | ||
|
666 | 880 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
667 | 881 | return |
|
668 | 882 |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -103,9 +103,6 class SpectraPlot(Figure): | |||
|
103 | 103 | zmin : None, |
|
104 | 104 | zmax : None |
|
105 | 105 | """ |
|
106 | ||
|
107 | colormap = kwargs.get('colormap','jet') | |
|
108 | ||
|
109 | 106 | if realtime: |
|
110 | 107 | if not(isRealtime(utcdatatime = dataOut.utctime)): |
|
111 | 108 | print 'Skipping this plot function' |
@@ -525,7 +522,7 class RTIPlot(Figure): | |||
|
525 | 522 | timerange=None, colormap='jet', |
|
526 | 523 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
527 | 524 | server=None, folder=None, username=None, password=None, |
|
528 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, normFactor=None): | |
|
525 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, normFactor=None, HEIGHT=None): | |
|
529 | 526 | |
|
530 | 527 | """ |
|
531 | 528 | |
@@ -543,7 +540,10 class RTIPlot(Figure): | |||
|
543 | 540 | zmax : None |
|
544 | 541 | """ |
|
545 | 542 | |
|
546 | colormap = kwargs.get('colormap', 'jet') | |
|
543 | #colormap = kwargs.get('colormap', 'jet') | |
|
544 | if HEIGHT is not None: | |
|
545 | self.HEIGHT = HEIGHT | |
|
546 | ||
|
547 | 547 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
548 | 548 | return |
|
549 | 549 |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -267,7 +267,6 def addpcolor(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap= | |||
|
267 | 267 | cmap.set_bad('white',1.) |
|
268 | 268 | ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap)) |
|
269 | 269 | ax.grid(True) |
|
270 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
271 | 270 | |
|
272 | 271 | def addpcolorbuffer(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'): |
|
273 | 272 |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1058,10 +1058,10 class JRODataReader(JRODataIO): | |||
|
1058 | 1058 | |
|
1059 | 1059 | break |
|
1060 | 1060 | |
|
1061 | if self.verbose: | |
|
1062 | print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, | |
|
1063 | self.processingHeaderObj.dataBlocksPerFile, | |
|
1064 | self.dataOut.datatime.ctime()) | |
|
1061 | # if self.verbose: | |
|
1062 | # print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, | |
|
1063 | # self.processingHeaderObj.dataBlocksPerFile, | |
|
1064 | # self.dataOut.datatime.ctime()) | |
|
1065 | 1065 | return 1 |
|
1066 | 1066 | |
|
1067 | 1067 | def __readFirstHeader(self): |
@@ -1417,11 +1417,12 class JRODataReader(JRODataIO): | |||
|
1417 | 1417 | print "[Reading] Number of read blocks %04d" %self.nTotalBlocks |
|
1418 | 1418 | |
|
1419 | 1419 | def printNumberOfBlock(self): |
|
1420 | 'SPAM!' | |
|
1420 | 1421 | |
|
1421 | if self.flagIsNewBlock: | |
|
1422 | print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, | |
|
1423 | self.processingHeaderObj.dataBlocksPerFile, | |
|
1424 | self.dataOut.datatime.ctime()) | |
|
1422 | # if self.flagIsNewBlock: | |
|
1423 | # print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, | |
|
1424 | # self.processingHeaderObj.dataBlocksPerFile, | |
|
1425 | # self.dataOut.datatime.ctime()) | |
|
1425 | 1426 | |
|
1426 | 1427 | def printInfo(self): |
|
1427 | 1428 |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -30,6 +30,7 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation | |||
|
30 | 30 | #from schainpy.model.io.jroIO_bltr import BLTRReader |
|
31 | 31 | from numpy import imag, shape, NaN |
|
32 | 32 | |
|
33 | from jroIO_base import JRODataReader | |
|
33 | 34 | |
|
34 | 35 | |
|
35 | 36 | class Header(object): |
@@ -426,7 +427,7 class RecordHeaderBLTR(Header): | |||
|
426 | 427 | return 1 |
|
427 | 428 | |
|
428 | 429 | |
|
429 | class BLTRReader (ProcessingUnit,FileHeaderBLTR,RecordHeaderBLTR): | |
|
430 | class BLTRReader (ProcessingUnit, FileHeaderBLTR, RecordHeaderBLTR, JRODataReader): | |
|
430 | 431 | |
|
431 | 432 | path = None |
|
432 | 433 | startDate = None |
@@ -450,10 +451,10 class BLTRReader (ProcessingUnit,FileHeaderBLTR,RecordHeaderBLTR): | |||
|
450 | 451 | |
|
451 | 452 | |
|
452 | 453 | |
|
453 | def __init__(self): | |
|
454 | def __init__(self, **kwargs): | |
|
454 | 455 | |
|
455 | 456 | #Eliminar de la base la herencia |
|
456 | ProcessingUnit.__init__(self) | |
|
457 | ProcessingUnit.__init__(self, **kwargs) | |
|
457 | 458 | |
|
458 | 459 | # self.isConfig = False |
|
459 | 460 | |
@@ -541,7 +542,8 class BLTRReader (ProcessingUnit,FileHeaderBLTR,RecordHeaderBLTR): | |||
|
541 | 542 | timezone='utc', |
|
542 | 543 | code = None, |
|
543 | 544 | online=False, |
|
544 |
ReadMode=None |
|
|
545 | ReadMode=None, | |
|
546 | **kwargs): | |
|
545 | 547 | |
|
546 | 548 | self.isConfig = True |
|
547 | 549 | |
@@ -717,8 +719,8 class BLTRReader (ProcessingUnit,FileHeaderBLTR,RecordHeaderBLTR): | |||
|
717 | 719 | |
|
718 | 720 | self.data_block = numpy.transpose(self.data_block, (1,2,0)) |
|
719 | 721 | |
|
720 | ||
|
721 |
spc = |
|
|
722 | copy = self.data_block.copy() | |
|
723 | spc = copy * numpy.conjugate(copy) | |
|
722 | 724 | |
|
723 | 725 | self.data_spc = numpy.absolute(spc) # valor absoluto o magnitud |
|
724 | 726 |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -416,7 +416,7 class RecordHeader(Header): | |||
|
416 | 416 | self.RadarConst = header['RadarConst'][0] # |
|
417 | 417 | #84 |
|
418 | 418 | |
|
419 | print 'Pointer fp RECheader', fp.tell() | |
|
419 | #print 'Pointer fp RECheader', fp.tell() | |
|
420 | 420 | |
|
421 | 421 | #self.ipp= 0.5*(SPEED_OF_LIGHT/self.PRFhz) |
|
422 | 422 | |
@@ -456,10 +456,10 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
456 | 456 | |
|
457 | 457 | |
|
458 | 458 | |
|
459 | def __init__(self): | |
|
459 | def __init__(self, **kwargs): | |
|
460 | 460 | |
|
461 | 461 | #Eliminar de la base la herencia |
|
462 | ProcessingUnit.__init__(self) | |
|
462 | ProcessingUnit.__init__(self, **kwargs) | |
|
463 | 463 | self.PointerReader = 0 |
|
464 | 464 | self.FileHeaderFlag = False |
|
465 | 465 | self.utc = None |
@@ -490,13 +490,14 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
490 | 490 | self.dataOut.nRdPairs = 0 |
|
491 | 491 | self.dataOut.pairsList = [] |
|
492 | 492 | self.dataOut.data_spc=None |
|
493 | self.dataOut.noise=[] | |
|
493 | ||
|
494 | 494 | self.dataOut.normFactor=1 |
|
495 | 495 | self.nextfileflag = True |
|
496 | 496 | self.dataOut.RadarConst = 0 |
|
497 | 497 | self.dataOut.HSDV = [] |
|
498 | 498 | self.dataOut.NPW = [] |
|
499 | 499 | self.dataOut.COFA = [] |
|
500 | self.dataOut.noise = 0 | |
|
500 | 501 | |
|
501 | 502 | |
|
502 | 503 | def Files2Read(self, fp): |
@@ -543,7 +544,7 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
543 | 544 | timezone='utc', |
|
544 | 545 | code = None, |
|
545 | 546 | online=False, |
|
546 | ReadMode=None): | |
|
547 | ReadMode=None, **kwargs): | |
|
547 | 548 | |
|
548 | 549 | self.isConfig = True |
|
549 | 550 | |
@@ -553,7 +554,7 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
553 | 554 | self.startTime=startTime |
|
554 | 555 | self.endTime=endTime |
|
555 | 556 | self.walk=walk |
|
556 | self.ReadMode=int(ReadMode) | |
|
557 | #self.ReadMode=int(ReadMode) | |
|
557 | 558 | |
|
558 | 559 | pass |
|
559 | 560 | |
@@ -576,9 +577,13 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
576 | 577 | self.Files2Read(self.fp) |
|
577 | 578 | self.readFile(self.fp) |
|
578 | 579 | |
|
579 | self.dataOut.data_spc = self.data_spc.copy() | |
|
580 | self.dataOut.data_spc = self.dataOut_spc#self.data_spc.copy() | |
|
580 | 581 | self.dataOut.RadarConst = self.RadarConst |
|
581 | 582 | self.dataOut.data_output=self.data_output |
|
583 | self.dataOut.noise = self.dataOut.getNoise() | |
|
584 | #print 'ACAAAAAA', self.dataOut.noise | |
|
585 | self.dataOut.data_spc = self.dataOut.data_spc+self.dataOut.noise | |
|
586 | #print 'self.dataOut.noise',self.dataOut.noise | |
|
582 | 587 | |
|
583 | 588 | |
|
584 | 589 | return self.dataOut.data_spc |
@@ -629,7 +634,7 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
629 | 634 | pulse_width = self.fheader.PPARpdr * 10**-9 |
|
630 | 635 | self.__deltaHeigth = 0.5 * SPEED_OF_LIGHT * pulse_width |
|
631 | 636 | |
|
632 | self.data_spc = numpy.zeros((self.Num_Hei, self.Num_Bins,2)) | |
|
637 | self.data_spc = numpy.zeros((self.Num_Hei, self.Num_Bins,2))# | |
|
633 | 638 | self.dataOut.HSDV = numpy.zeros((self.Num_Hei, 2)) |
|
634 | 639 | |
|
635 | 640 | self.Ze = numpy.zeros(self.Num_Hei) |
@@ -693,7 +698,7 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
693 | 698 | npw2 = self.recordheader.npw2 |
|
694 | 699 | |
|
695 | 700 | |
|
696 |
self.dataOut.channelList = range( |
|
|
701 | self.dataOut.channelList = range(1) | |
|
697 | 702 | self.dataOut.nIncohInt = self.Num_inCoh |
|
698 | 703 | self.dataOut.nProfiles = self.Num_Bins |
|
699 | 704 | self.dataOut.nCohInt = 1 |
@@ -756,7 +761,6 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
756 | 761 | |
|
757 | 762 | self.dataOut.COFA = numpy.array([self.COFA_Co , self.COFA_Cx]) |
|
758 | 763 | |
|
759 | ||
|
760 | 764 | print ' ' |
|
761 | 765 | print 'SPC',numpy.shape(self.dataOut.data_spc) |
|
762 | 766 | #print 'SPC',self.dataOut.data_spc |
@@ -764,20 +768,26 class MIRA35CReader (ProcessingUnit,FileHeaderMIRA35c,SRVIHeader,RecordHeader): | |||
|
764 | 768 | noinor1 = 713031680 |
|
765 | 769 | noinor2 = 30 |
|
766 | 770 | |
|
767 | #print 'npw1 db' , npw1 | |
|
768 | ||
|
769 | npw1 = 10**(npw1/10) * noinor1 * noinor2 | |
|
770 | npw2 = 10**(npw2/10) * noinor1 * noinor2 | |
|
771 | npw1 = 1#0**(npw1/10) * noinor1 * noinor2 | |
|
772 | npw2 = 1#0**(npw2/10) * noinor1 * noinor2 | |
|
771 | 773 | self.dataOut.NPW = numpy.array([npw1, npw2]) |
|
772 | 774 | |
|
773 | ||
|
774 | 775 | print ' ' |
|
775 | #print numpy.__version__ | |
|
776 | ||
|
776 | 777 | self.data_spc = numpy.transpose(self.data_spc, (2,1,0)) |
|
777 | 778 | self.data_spc = numpy.fft.fftshift(self.data_spc, axes = 1) |
|
778 | 779 | |
|
779 | 780 | self.data_spc = numpy.fliplr(self.data_spc) |
|
780 | 781 | |
|
782 | self.data_spc = numpy.where(self.data_spc > 0. , self.data_spc, 0) | |
|
783 | self.dataOut_spc= numpy.ones([1, self.Num_Bins , self.Num_Hei]) | |
|
784 | self.dataOut_spc[0,:,:] = self.data_spc[0,:,:] | |
|
785 | #print 'SHAPE', self.dataOut_spc.shape | |
|
786 | #For nyquist correction: | |
|
787 | #fix = 20 # ~3m/s | |
|
788 | #shift = self.Num_Bins/2 + fix | |
|
789 | #self.data_spc = numpy.array([ self.data_spc[: , self.Num_Bins-shift+1: , :] , self.data_spc[: , 0:self.Num_Bins-shift , :]]) | |
|
790 | ||
|
781 | 791 | |
|
782 | 792 | |
|
783 | 793 | '''Block Reading, the Block Data is received and Reshape is used to give it |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -178,8 +178,8 class ParamReader(ProcessingUnit): | |||
|
178 | 178 | print "[Reading] %d file(s) was(were) found in time range: %s - %s" %(len(filenameList), startTime, endTime) |
|
179 | 179 | |
|
180 | 180 | |
|
181 | for i in range(len(filenameList)): | |
|
182 | print "[Reading] %s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) | |
|
181 | # for i in range(len(filenameList)): | |
|
182 | # print "[Reading] %s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) | |
|
183 | 183 | |
|
184 | 184 | self.filenameList = filenameList |
|
185 | 185 | self.datetimeList = datetimeList |
|
1 | NO CONTENT: modified file, binary diff hidden |
This diff has been collapsed as it changes many lines, (568 lines changed) Show them Hide them | |||
@@ -11,22 +11,17 from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, | |||
|
11 | 11 | from schainpy.model.data.jrodata import Spectra |
|
12 | 12 | |
|
13 | 13 | class SpectraReader(JRODataReader, ProcessingUnit): |
|
14 | <<<<<<< HEAD | |
|
14 | ||
|
15 | 15 | """ |
|
16 | 16 | Esta clase permite leer datos de espectros desde archivos procesados (.pdata). La lectura |
|
17 | 17 | de los datos siempre se realiza por bloques. Los datos leidos (array de 3 dimensiones) |
|
18 | ======= | |
|
19 | """ | |
|
20 | Esta clase permite leer datos de espectros desde archivos procesados (.pdata). La lectura | |
|
21 | de los datos siempre se realiza por bloques. Los datos leidos (array de 3 dimensiones) | |
|
22 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
23 | 18 | son almacenados en tres buffer's para el Self Spectra, el Cross Spectra y el DC Channel. |
|
24 | 19 |
|
|
25 | 20 | paresCanalesIguales * alturas * perfiles (Self Spectra) |
|
26 | 21 | paresCanalesDiferentes * alturas * perfiles (Cross Spectra) |
|
27 | 22 | canales * alturas (DC Channels) |
|
28 | 23 |
|
|
29 | <<<<<<< HEAD | |
|
24 | ||
|
30 | 25 | Esta clase contiene instancias (objetos) de las clases BasicHeader, SystemHeader, |
|
31 | 26 | RadarControllerHeader y Spectra. Los tres primeros se usan para almacenar informacion de la |
|
32 | 27 | cabecera de datos (metadata), y el cuarto (Spectra) para obtener y almacenar un bloque de |
@@ -81,168 +76,25 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
81 | 76 | Inicializador de la clase SpectraReader para la lectura de datos de espectros. |
|
82 | 77 |
|
|
83 | 78 | Inputs: |
|
84 | ======= | |
|
85 | Esta clase contiene instancias (objetos) de las clases BasicHeader, SystemHeader, | |
|
86 | RadarControllerHeader y Spectra. Los tres primeros se usan para almacenar informacion de la | |
|
87 | cabecera de datos (metadata), y el cuarto (Spectra) para obtener y almacenar un bloque de | |
|
88 | datos desde el "buffer" cada vez que se ejecute el metodo "getData". | |
|
89 | ||
|
90 | Example: | |
|
91 | dpath = "/home/myuser/data" | |
|
92 | ||
|
93 | startTime = datetime.datetime(2010,1,20,0,0,0,0,0,0) | |
|
94 | ||
|
95 | endTime = datetime.datetime(2010,1,21,23,59,59,0,0,0) | |
|
96 | ||
|
97 | readerObj = SpectraReader() | |
|
98 | ||
|
99 | readerObj.setup(dpath, startTime, endTime) | |
|
100 | ||
|
101 | while(True): | |
|
102 | ||
|
103 | readerObj.getData() | |
|
104 | ||
|
105 | print readerObj.data_spc | |
|
106 | ||
|
107 | print readerObj.data_cspc | |
|
108 | ||
|
109 | print readerObj.data_dc | |
|
110 | ||
|
111 | if readerObj.flagNoMoreFiles: | |
|
112 | break | |
|
113 | ||
|
114 | """ | |
|
115 | ||
|
116 | pts2read_SelfSpectra = 0 | |
|
117 | ||
|
118 | pts2read_CrossSpectra = 0 | |
|
119 | ||
|
120 | pts2read_DCchannels = 0 | |
|
121 | ||
|
122 | ext = ".pdata" | |
|
123 | ||
|
124 | optchar = "P" | |
|
125 | ||
|
126 | dataOut = None | |
|
127 | ||
|
128 | nRdChannels = None | |
|
129 | ||
|
130 | nRdPairs = None | |
|
131 | ||
|
132 | rdPairList = [] | |
|
133 | ||
|
134 | def __init__(self): | |
|
135 | """ | |
|
136 | Inicializador de la clase SpectraReader para la lectura de datos de espectros. | |
|
137 | 79 |
|
|
138 | Inputs: | |
|
139 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
140 | 80 | dataOut : Objeto de la clase Spectra. Este objeto sera utilizado para |
|
141 | 81 | almacenar un perfil de datos cada vez que se haga un requerimiento |
|
142 | 82 | (getData). El perfil sera obtenido a partir del buffer de datos, |
|
143 | 83 | si el buffer esta vacio se hara un nuevo proceso de lectura de un |
|
144 | 84 | bloque de datos. |
|
145 | 85 | Si este parametro no es pasado se creara uno internamente. |
|
146 | <<<<<<< HEAD | |
|
147 | 86 |
|
|
148 | Affected: | |
|
149 | ======= | |
|
150 | 87 |
|
|
151 | 88 | Affected: |
|
152 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
89 | ||
|
153 | 90 | self.dataOut |
|
154 | 91 |
|
|
155 | 92 | Return : None |
|
156 | 93 |
|
|
157 | <<<<<<< HEAD | |
|
158 | ||
|
159 | #Eliminar de la base la herencia | |
|
160 | ProcessingUnit.__init__(self, **kwargs) | |
|
161 | ||
|
162 | # self.isConfig = False | |
|
163 | ||
|
164 | self.pts2read_SelfSpectra = 0 | |
|
165 | ||
|
166 | self.pts2read_CrossSpectra = 0 | |
|
167 | ||
|
168 | self.pts2read_DCchannels = 0 | |
|
169 | ||
|
170 | self.datablock = None | |
|
171 | ||
|
172 | self.utc = None | |
|
173 | ||
|
174 | self.ext = ".pdata" | |
|
175 | ||
|
176 | self.optchar = "P" | |
|
177 | ||
|
178 | self.basicHeaderObj = BasicHeader(LOCALTIME) | |
|
179 | ||
|
180 | self.systemHeaderObj = SystemHeader() | |
|
181 | ||
|
182 | self.radarControllerHeaderObj = RadarControllerHeader() | |
|
183 | ||
|
184 | self.processingHeaderObj = ProcessingHeader() | |
|
185 | ||
|
186 | self.online = 0 | |
|
187 | ||
|
188 | self.fp = None | |
|
189 | ||
|
190 | self.idFile = None | |
|
191 | ||
|
192 | self.dtype = None | |
|
193 | ||
|
194 | self.fileSizeByHeader = None | |
|
195 | ||
|
196 | self.filenameList = [] | |
|
197 | ||
|
198 | self.filename = None | |
|
199 | ||
|
200 | self.fileSize = None | |
|
201 | ||
|
202 | self.firstHeaderSize = 0 | |
|
203 | ||
|
204 | self.basicHeaderSize = 24 | |
|
205 | ||
|
206 | self.pathList = [] | |
|
207 | ||
|
208 | self.lastUTTime = 0 | |
|
209 | ||
|
210 | self.maxTimeStep = 30 | |
|
211 | ||
|
212 | self.flagNoMoreFiles = 0 | |
|
213 | ||
|
214 | self.set = 0 | |
|
215 | ||
|
216 | self.path = None | |
|
217 | ||
|
218 | self.delay = 60 #seconds | |
|
219 | ||
|
220 | self.nTries = 3 #quantity tries | |
|
221 | ||
|
222 | self.nFiles = 3 #number of files for searching | |
|
223 | ||
|
224 | self.nReadBlocks = 0 | |
|
225 | ||
|
226 | self.flagIsNewFile = 1 | |
|
227 | ||
|
228 | self.__isFirstTimeOnline = 1 | |
|
229 | ||
|
230 | # self.ippSeconds = 0 | |
|
231 | ||
|
232 | self.flagDiscontinuousBlock = 0 | |
|
233 | ||
|
234 | self.flagIsNewBlock = 0 | |
|
235 | 94 | |
|
236 | self.nTotalBlocks = 0 | |
|
237 | ||
|
238 | self.blocksize = 0 | |
|
239 | ||
|
240 | self.dataOut = self.createObjByDefault() | |
|
241 | ||
|
242 | ======= | |
|
243 | 95 | |
|
244 | 96 | #Eliminar de la base la herencia |
|
245 | ProcessingUnit.__init__(self) | |
|
97 | ProcessingUnit.__init__(self, **kwargs) | |
|
246 | 98 | |
|
247 | 99 | # self.isConfig = False |
|
248 | 100 | |
@@ -324,24 +176,15 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
324 | 176 | |
|
325 | 177 | self.dataOut = self.createObjByDefault() |
|
326 | 178 | |
|
327 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
328 | 179 | self.profileIndex = 1 #Always |
|
329 | 180 | |
|
330 | 181 | |
|
331 | 182 | def createObjByDefault(self): |
|
332 | <<<<<<< HEAD | |
|
333 | ||
|
334 | dataObj = Spectra() | |
|
335 | ||
|
336 | return dataObj | |
|
337 | ||
|
338 | ======= | |
|
339 | 183 | |
|
340 | 184 | dataObj = Spectra() |
|
341 | 185 | |
|
342 | 186 | return dataObj |
|
343 | 187 | |
|
344 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
345 | 188 | def __hasNotDataInBuffer(self): |
|
346 | 189 | return 1 |
|
347 | 190 | |
@@ -349,11 +192,7 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
349 | 192 | def getBlockDimension(self): |
|
350 | 193 |
|
|
351 | 194 | Obtiene la cantidad de puntos a leer por cada bloque de datos |
|
352 | <<<<<<< HEAD | |
|
353 | ||
|
354 | ======= | |
|
355 | 195 |
|
|
356 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
357 | 196 | Affected: |
|
358 | 197 | self.nRdChannels |
|
359 | 198 | self.nRdPairs |
@@ -370,40 +209,16 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
370 | 209 | self.nRdChannels = 0 |
|
371 | 210 | self.nRdPairs = 0 |
|
372 | 211 | self.rdPairList = [] |
|
373 | <<<<<<< HEAD | |
|
374 | 212 | |
|
375 | 213 | for i in range(0, self.processingHeaderObj.totalSpectra*2, 2): |
|
376 | 214 | if self.processingHeaderObj.spectraComb[i] == self.processingHeaderObj.spectraComb[i+1]: |
|
377 | self.nRdChannels = self.nRdChannels + 1 #par de canales iguales | |
|
378 | ======= | |
|
379 | ||
|
380 | ||
|
381 | for i in range(0, self.processingHeaderObj.totalSpectra*2, 2): | |
|
382 | if self.processingHeaderObj.spectraComb[i] == self.processingHeaderObj.spectraComb[i+1]: | |
|
383 | 215 | self.nRdChannels = self.nRdChannels + 1 #par de canales iguales |
|
384 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
216 | ||
|
385 | 217 | else: |
|
386 | 218 | self.nRdPairs = self.nRdPairs + 1 #par de canales diferentes |
|
387 | 219 | self.rdPairList.append((self.processingHeaderObj.spectraComb[i], self.processingHeaderObj.spectraComb[i+1])) |
|
388 | 220 | |
|
389 | 221 | pts2read = self.processingHeaderObj.nHeights * self.processingHeaderObj.profilesPerBlock |
|
390 | <<<<<<< HEAD | |
|
391 | ||
|
392 | self.pts2read_SelfSpectra = int(self.nRdChannels * pts2read) | |
|
393 | self.blocksize = self.pts2read_SelfSpectra | |
|
394 | ||
|
395 | if self.processingHeaderObj.flag_cspc: | |
|
396 | self.pts2read_CrossSpectra = int(self.nRdPairs * pts2read) | |
|
397 | self.blocksize += self.pts2read_CrossSpectra | |
|
398 | ||
|
399 | if self.processingHeaderObj.flag_dc: | |
|
400 | self.pts2read_DCchannels = int(self.systemHeaderObj.nChannels * self.processingHeaderObj.nHeights) | |
|
401 | self.blocksize += self.pts2read_DCchannels | |
|
402 | ||
|
403 | # self.blocksize = self.pts2read_SelfSpectra + self.pts2read_CrossSpectra + self.pts2read_DCchannels | |
|
404 | ||
|
405 | ||
|
406 | ======= | |
|
407 | 222 | |
|
408 | 223 | self.pts2read_SelfSpectra = int(self.nRdChannels * pts2read) |
|
409 | 224 | self.blocksize = self.pts2read_SelfSpectra |
@@ -419,26 +234,18 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
419 | 234 | # self.blocksize = self.pts2read_SelfSpectra + self.pts2read_CrossSpectra + self.pts2read_DCchannels |
|
420 | 235 | |
|
421 | 236 | |
|
422 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
423 | 237 | def readBlock(self): |
|
424 | 238 |
|
|
425 | 239 | Lee el bloque de datos desde la posicion actual del puntero del archivo |
|
426 | 240 | (self.fp) y actualiza todos los parametros relacionados al bloque de datos |
|
427 | 241 | (metadata + data). La data leida es almacenada en el buffer y el contador del buffer |
|
428 | 242 | es seteado a 0 |
|
429 | <<<<<<< HEAD | |
|
430 | ||
|
431 | Return: None | |
|
432 | ||
|
433 | Variables afectadas: | |
|
434 | ||
|
435 | ======= | |
|
436 | 243 |
|
|
437 | 244 | Return: None |
|
438 | 245 |
|
|
439 | 246 | Variables afectadas: |
|
440 | 247 |
|
|
441 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
248 | ||
|
442 | 249 | self.flagIsNewFile |
|
443 | 250 | self.flagIsNewBlock |
|
444 | 251 | self.nTotalBlocks |
@@ -446,11 +253,6 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
446 | 253 | self.data_cspc |
|
447 | 254 | self.data_dc |
|
448 | 255 |
|
|
449 | <<<<<<< HEAD | |
|
450 | Exceptions: | |
|
451 | Si un bloque leido no es un bloque valido | |
|
452 | """ | |
|
453 | ======= | |
|
454 | 256 | Exceptions: |
|
455 | 257 | Si un bloque leido no es un bloque valido |
|
456 | 258 | """ |
@@ -463,25 +265,13 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
463 | 265 | print ' ' |
|
464 | 266 | print ' ======================================================== ' |
|
465 | 267 | |
|
466 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
268 | ||
|
467 | 269 | blockOk_flag = False |
|
468 | 270 | fpointer = self.fp.tell() |
|
469 | 271 | |
|
470 | 272 | spc = numpy.fromfile( self.fp, self.dtype[0], self.pts2read_SelfSpectra ) |
|
471 | 273 | spc = spc.reshape( (self.nRdChannels, self.processingHeaderObj.nHeights, self.processingHeaderObj.profilesPerBlock) ) #transforma a un arreglo 3D |
|
472 | <<<<<<< HEAD | |
|
473 | ||
|
474 | if self.processingHeaderObj.flag_cspc: | |
|
475 | cspc = numpy.fromfile( self.fp, self.dtype, self.pts2read_CrossSpectra ) | |
|
476 | cspc = cspc.reshape( (self.nRdPairs, self.processingHeaderObj.nHeights, self.processingHeaderObj.profilesPerBlock) ) #transforma a un arreglo 3D | |
|
477 | ||
|
478 | if self.processingHeaderObj.flag_dc: | |
|
479 | dc = numpy.fromfile( self.fp, self.dtype, self.pts2read_DCchannels ) #int(self.processingHeaderObj.nHeights*self.systemHeaderObj.nChannels) ) | |
|
480 | dc = dc.reshape( (self.systemHeaderObj.nChannels, self.processingHeaderObj.nHeights) ) #transforma a un arreglo 2D | |
|
481 | ||
|
482 | 274 | |
|
483 | ======= | |
|
484 | ||
|
485 | 275 | if self.processingHeaderObj.flag_cspc: |
|
486 | 276 | cspc = numpy.fromfile( self.fp, self.dtype, self.pts2read_CrossSpectra ) |
|
487 | 277 | cspc = cspc.reshape( (self.nRdPairs, self.processingHeaderObj.nHeights, self.processingHeaderObj.profilesPerBlock) ) #transforma a un arreglo 3D |
@@ -491,23 +281,10 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
491 | 281 | dc = dc.reshape( (self.systemHeaderObj.nChannels, self.processingHeaderObj.nHeights) ) #transforma a un arreglo 2D |
|
492 | 282 | |
|
493 | 283 | |
|
494 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
495 | 284 | if not(self.processingHeaderObj.shif_fft): |
|
496 | 285 | #desplaza a la derecha en el eje 2 determinadas posiciones |
|
497 | 286 | shift = int(self.processingHeaderObj.profilesPerBlock/2) |
|
498 | 287 | spc = numpy.roll( spc, shift , axis=2 ) |
|
499 | <<<<<<< HEAD | |
|
500 | ||
|
501 | if self.processingHeaderObj.flag_cspc: | |
|
502 | #desplaza a la derecha en el eje 2 determinadas posiciones | |
|
503 | cspc = numpy.roll( cspc, shift, axis=2 ) | |
|
504 | ||
|
505 | #Dimensions : nChannels, nProfiles, nSamples | |
|
506 | spc = numpy.transpose( spc, (0,2,1) ) | |
|
507 | self.data_spc = spc | |
|
508 | ||
|
509 | if self.processingHeaderObj.flag_cspc: | |
|
510 | ======= | |
|
511 | 288 | |
|
512 | 289 | if self.processingHeaderObj.flag_cspc: |
|
513 | 290 | #desplaza a la derecha en el eje 2 determinadas posiciones |
@@ -518,16 +295,13 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
518 | 295 | self.data_spc = spc |
|
519 | 296 | |
|
520 | 297 | if self.processingHeaderObj.flag_cspc: |
|
521 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
298 | ||
|
522 | 299 | cspc = numpy.transpose( cspc, (0,2,1) ) |
|
523 | 300 | self.data_cspc = cspc['real'] + cspc['imag']*1j |
|
524 | 301 | else: |
|
525 | 302 | self.data_cspc = None |
|
526 | <<<<<<< HEAD | |
|
527 | ||
|
528 | ======= | |
|
529 | 303 | |
|
530 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
304 | ||
|
531 | 305 | if self.processingHeaderObj.flag_dc: |
|
532 | 306 | self.data_dc = dc['real'] + dc['imag']*1j |
|
533 | 307 | else: |
@@ -540,62 +314,6 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
540 | 314 | self.nReadBlocks += 1 |
|
541 | 315 | |
|
542 | 316 | return 1 |
|
543 | <<<<<<< HEAD | |
|
544 | ||
|
545 | def getFirstHeader(self): | |
|
546 | ||
|
547 | self.getBasicHeader() | |
|
548 | ||
|
549 | self.dataOut.systemHeaderObj = self.systemHeaderObj.copy() | |
|
550 | ||
|
551 | self.dataOut.radarControllerHeaderObj = self.radarControllerHeaderObj.copy() | |
|
552 | ||
|
553 | # self.dataOut.ippSeconds = self.ippSeconds | |
|
554 | ||
|
555 | # self.dataOut.timeInterval = self.radarControllerHeaderObj.ippSeconds * self.processingHeaderObj.nCohInt * self.processingHeaderObj.nIncohInt * self.processingHeaderObj.profilesPerBlock | |
|
556 | ||
|
557 | self.dataOut.dtype = self.dtype | |
|
558 | ||
|
559 | # self.dataOut.nPairs = self.nPairs | |
|
560 | ||
|
561 | self.dataOut.pairsList = self.rdPairList | |
|
562 | ||
|
563 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock | |
|
564 | ||
|
565 | self.dataOut.nFFTPoints = self.processingHeaderObj.profilesPerBlock | |
|
566 | ||
|
567 | self.dataOut.nCohInt = self.processingHeaderObj.nCohInt | |
|
568 | ||
|
569 | self.dataOut.nIncohInt = self.processingHeaderObj.nIncohInt | |
|
570 | ||
|
571 | xf = self.processingHeaderObj.firstHeight + self.processingHeaderObj.nHeights*self.processingHeaderObj.deltaHeight | |
|
572 | ||
|
573 | self.dataOut.heightList = numpy.arange(self.processingHeaderObj.firstHeight, xf, self.processingHeaderObj.deltaHeight) | |
|
574 | ||
|
575 | self.dataOut.channelList = range(self.systemHeaderObj.nChannels) | |
|
576 | ||
|
577 | self.dataOut.flagShiftFFT = True #Data is always shifted | |
|
578 | ||
|
579 | self.dataOut.flagDecodeData = self.processingHeaderObj.flag_decode #asumo q la data no esta decodificada | |
|
580 | ||
|
581 | self.dataOut.flagDeflipData = self.processingHeaderObj.flag_deflip #asumo q la data esta sin flip | |
|
582 | ||
|
583 | def getData(self): | |
|
584 | """ | |
|
585 | First method to execute before "RUN" is called. | |
|
586 | ||
|
587 | Copia el buffer de lectura a la clase "Spectra", | |
|
588 | con todos los parametros asociados a este (metadata). cuando no hay datos en el buffer de | |
|
589 | lectura es necesario hacer una nueva lectura de los bloques de datos usando "readNextBlock" | |
|
590 | ||
|
591 | Return: | |
|
592 | 0 : Si no hay mas archivos disponibles | |
|
593 | 1 : Si hizo una buena copia del buffer | |
|
594 | ||
|
595 | Affected: | |
|
596 | self.dataOut | |
|
597 | ||
|
598 | ======= | |
|
599 | 317 | |
|
600 | 318 | def getFirstHeader(self): |
|
601 | 319 | |
@@ -650,7 +368,6 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
650 | 368 | Affected: |
|
651 | 369 | self.dataOut |
|
652 | 370 |
|
|
653 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
654 | 371 | self.flagDiscontinuousBlock |
|
655 | 372 | self.flagIsNewBlock |
|
656 | 373 |
|
@@ -659,82 +376,22 class SpectraReader(JRODataReader, ProcessingUnit): | |||
|
659 | 376 | self.dataOut.flagNoData = True |
|
660 | 377 | print 'Process finished' |
|
661 | 378 | return 0 |
|
662 | <<<<<<< HEAD | |
|
663 | ||
|
664 | self.flagDiscontinuousBlock = 0 | |
|
665 | self.flagIsNewBlock = 0 | |
|
666 | ||
|
667 | if self.__hasNotDataInBuffer(): | |
|
668 | ======= | |
|
669 | 379 | |
|
670 | 380 | self.flagDiscontinuousBlock = 0 |
|
671 | 381 | self.flagIsNewBlock = 0 |
|
672 | 382 | |
|
673 | 383 | if self.__hasNotDataInBuffer(): |
|
674 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
675 | 384 | |
|
676 | 385 | if not( self.readNextBlock() ): |
|
677 | 386 | self.dataOut.flagNoData = True |
|
678 | 387 | return 0 |
|
679 | <<<<<<< HEAD | |
|
680 | ||
|
681 | ======= | |
|
682 | 388 | |
|
683 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
389 | ||
|
684 | 390 | #data es un numpy array de 3 dmensiones (perfiles, alturas y canales) |
|
685 | 391 | |
|
686 | 392 | if self.data_spc is None: |
|
687 | 393 | self.dataOut.flagNoData = True |
|
688 | 394 | return 0 |
|
689 | <<<<<<< HEAD | |
|
690 | ||
|
691 | self.getBasicHeader() | |
|
692 | ||
|
693 | self.getFirstHeader() | |
|
694 | ||
|
695 | self.dataOut.data_spc = self.data_spc | |
|
696 | ||
|
697 | self.dataOut.data_cspc = self.data_cspc | |
|
698 | ||
|
699 | self.dataOut.data_dc = self.data_dc | |
|
700 | ||
|
701 | self.dataOut.flagNoData = False | |
|
702 | ||
|
703 | self.dataOut.realtime = self.online | |
|
704 | ||
|
705 | return self.dataOut.data_spc | |
|
706 | ||
|
707 | class SpectraWriter(JRODataWriter, Operation): | |
|
708 | ||
|
709 | """ | |
|
710 | Esta clase permite escribir datos de espectros a archivos procesados (.pdata). La escritura | |
|
711 | de los datos siempre se realiza por bloques. | |
|
712 | """ | |
|
713 | ||
|
714 | ext = ".pdata" | |
|
715 | ||
|
716 | optchar = "P" | |
|
717 | ||
|
718 | shape_spc_Buffer = None | |
|
719 | ||
|
720 | shape_cspc_Buffer = None | |
|
721 | ||
|
722 | shape_dc_Buffer = None | |
|
723 | ||
|
724 | data_spc = None | |
|
725 | ||
|
726 | data_cspc = None | |
|
727 | ||
|
728 | data_dc = None | |
|
729 | ||
|
730 | # dataOut = None | |
|
731 | ||
|
732 | def __init__(self, **kwargs): | |
|
733 | """ | |
|
734 | Inicializador de la clase SpectraWriter para la escritura de datos de espectros. | |
|
735 | ||
|
736 | Affected: | |
|
737 | ======= | |
|
738 | 395 | |
|
739 | 396 | self.getBasicHeader() |
|
740 | 397 | |
@@ -782,7 +439,7 class SpectraWriter(JRODataWriter, Operation): | |||
|
782 | 439 | Inicializador de la clase SpectraWriter para la escritura de datos de espectros. |
|
783 | 440 | |
|
784 | 441 | Affected: |
|
785 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
442 | ||
|
786 | 443 | self.dataOut |
|
787 | 444 | self.basicHeaderObj |
|
788 | 445 | self.systemHeaderObj |
@@ -791,19 +448,6 class SpectraWriter(JRODataWriter, Operation): | |||
|
791 | 448 | |
|
792 | 449 | Return: None |
|
793 | 450 | """ |
|
794 | <<<<<<< HEAD | |
|
795 | ||
|
796 | Operation.__init__(self, **kwargs) | |
|
797 | ||
|
798 | self.isConfig = False | |
|
799 | ||
|
800 | self.nTotalBlocks = 0 | |
|
801 | ||
|
802 | self.data_spc = None | |
|
803 | ||
|
804 | self.data_cspc = None | |
|
805 | ||
|
806 | ======= | |
|
807 | 451 | |
|
808 | 452 | Operation.__init__(self) |
|
809 | 453 | |
@@ -815,42 +459,12 class SpectraWriter(JRODataWriter, Operation): | |||
|
815 | 459 | |
|
816 | 460 | self.data_cspc = None |
|
817 | 461 | |
|
818 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
462 | ||
|
819 | 463 | self.data_dc = None |
|
820 | 464 | |
|
821 | 465 | self.fp = None |
|
822 | 466 | |
|
823 | 467 | self.flagIsNewFile = 1 |
|
824 | <<<<<<< HEAD | |
|
825 | ||
|
826 | self.nTotalBlocks = 0 | |
|
827 | ||
|
828 | self.flagIsNewBlock = 0 | |
|
829 | ||
|
830 | self.setFile = None | |
|
831 | ||
|
832 | self.dtype = None | |
|
833 | ||
|
834 | self.path = None | |
|
835 | ||
|
836 | self.noMoreFiles = 0 | |
|
837 | ||
|
838 | self.filename = None | |
|
839 | ||
|
840 | self.basicHeaderObj = BasicHeader(LOCALTIME) | |
|
841 | ||
|
842 | self.systemHeaderObj = SystemHeader() | |
|
843 | ||
|
844 | self.radarControllerHeaderObj = RadarControllerHeader() | |
|
845 | ||
|
846 | self.processingHeaderObj = ProcessingHeader() | |
|
847 | ||
|
848 | ||
|
849 | def hasAllDataInBuffer(self): | |
|
850 | return 1 | |
|
851 | ||
|
852 | ||
|
853 | ======= | |
|
854 | 468 | |
|
855 | 469 | self.nTotalBlocks = 0 |
|
856 | 470 | |
@@ -879,7 +493,7 class SpectraWriter(JRODataWriter, Operation): | |||
|
879 | 493 | return 1 |
|
880 | 494 | |
|
881 | 495 | |
|
882 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
496 | ||
|
883 | 497 | def setBlockDimension(self): |
|
884 | 498 | """ |
|
885 | 499 | Obtiene las formas dimensionales del los subbloques de datos que componen un bloque |
@@ -898,17 +512,6 class SpectraWriter(JRODataWriter, Operation): | |||
|
898 | 512 | self.shape_cspc_Buffer = (self.dataOut.nPairs, |
|
899 | 513 | self.processingHeaderObj.nHeights, |
|
900 | 514 | self.processingHeaderObj.profilesPerBlock) |
|
901 | <<<<<<< HEAD | |
|
902 | ||
|
903 | self.shape_dc_Buffer = (self.dataOut.nChannels, | |
|
904 | self.processingHeaderObj.nHeights) | |
|
905 | ||
|
906 | ||
|
907 | def writeBlock(self): | |
|
908 | """ | |
|
909 | Escribe el buffer en el file designado | |
|
910 | ||
|
911 | ======= | |
|
912 | 515 | |
|
913 | 516 | self.shape_dc_Buffer = (self.dataOut.nChannels, |
|
914 | 517 | self.processingHeaderObj.nHeights) |
@@ -918,7 +521,7 class SpectraWriter(JRODataWriter, Operation): | |||
|
918 | 521 |
|
|
919 | 522 | Escribe el buffer en el file designado |
|
920 | 523 |
|
|
921 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
524 | ||
|
922 | 525 | Affected: |
|
923 | 526 | self.data_spc |
|
924 | 527 | self.data_cspc |
@@ -926,19 +529,11 class SpectraWriter(JRODataWriter, Operation): | |||
|
926 | 529 | self.flagIsNewFile |
|
927 | 530 | self.flagIsNewBlock |
|
928 | 531 | self.nTotalBlocks |
|
929 | <<<<<<< HEAD | |
|
930 | self.nWriteBlocks | |
|
931 | ||
|
932 | Return: None | |
|
933 | """ | |
|
934 | ||
|
935 | ======= | |
|
936 | 532 | self.nWriteBlocks |
|
937 | 533 | |
|
938 | 534 | Return: None |
|
939 | 535 | """ |
|
940 | 536 | |
|
941 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
942 | 537 | spc = numpy.transpose( self.data_spc, (0,2,1) ) |
|
943 | 538 | if not( self.processingHeaderObj.shif_fft ): |
|
944 | 539 | spc = numpy.roll( spc, self.processingHeaderObj.profilesPerBlock/2, axis=2 ) #desplaza a la derecha en el eje 2 determinadas posiciones |
@@ -955,11 +550,8 class SpectraWriter(JRODataWriter, Operation): | |||
|
955 | 550 | data['imag'] = cspc.imag |
|
956 | 551 | data = data.reshape((-1)) |
|
957 | 552 | data.tofile(self.fp) |
|
958 | <<<<<<< HEAD | |
|
959 | ||
|
960 | ======= | |
|
961 | 553 | |
|
962 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
554 | ||
|
963 | 555 | if self.data_dc is not None: |
|
964 | 556 | data = numpy.zeros( self.shape_dc_Buffer, self.dtype ) |
|
965 | 557 | dc = self.data_dc |
@@ -969,15 +561,6 class SpectraWriter(JRODataWriter, Operation): | |||
|
969 | 561 | data.tofile(self.fp) |
|
970 | 562 | |
|
971 | 563 | # self.data_spc.fill(0) |
|
972 | <<<<<<< HEAD | |
|
973 | # | |
|
974 | # if self.data_dc is not None: | |
|
975 | # self.data_dc.fill(0) | |
|
976 | # | |
|
977 | # if self.data_cspc is not None: | |
|
978 | # self.data_cspc.fill(0) | |
|
979 | ||
|
980 | ======= | |
|
981 | 564 | # |
|
982 | 565 | # if self.data_dc is not None: |
|
983 | 566 | # self.data_dc.fill(0) |
@@ -985,21 +568,12 class SpectraWriter(JRODataWriter, Operation): | |||
|
985 | 568 | # if self.data_cspc is not None: |
|
986 | 569 | # self.data_cspc.fill(0) |
|
987 | 570 | |
|
988 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
571 | ||
|
989 | 572 | self.flagIsNewFile = 0 |
|
990 | 573 | self.flagIsNewBlock = 1 |
|
991 | 574 | self.nTotalBlocks += 1 |
|
992 | 575 | self.nWriteBlocks += 1 |
|
993 | 576 | self.blockIndex += 1 |
|
994 | <<<<<<< HEAD | |
|
995 | ||
|
996 | # print "[Writing] Block = %d04" %self.blockIndex | |
|
997 | ||
|
998 | def putData(self): | |
|
999 | """ | |
|
1000 | Setea un bloque de datos y luego los escribe en un file | |
|
1001 | ||
|
1002 | ======= | |
|
1003 | 577 | |
|
1004 | 578 | # print "[Writing] Block = %d04" %self.blockIndex |
|
1005 | 579 | |
@@ -1007,43 +581,12 class SpectraWriter(JRODataWriter, Operation): | |||
|
1007 | 581 |
|
|
1008 | 582 | Setea un bloque de datos y luego los escribe en un file |
|
1009 | 583 |
|
|
1010 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
584 | ||
|
1011 | 585 | Affected: |
|
1012 | 586 | self.data_spc |
|
1013 | 587 | self.data_cspc |
|
1014 | 588 | self.data_dc |
|
1015 | 589 |
|
|
1016 | <<<<<<< HEAD | |
|
1017 | Return: | |
|
1018 | 0 : Si no hay data o no hay mas files que puedan escribirse | |
|
1019 | 1 : Si se escribio la data de un bloque en un file | |
|
1020 | """ | |
|
1021 | ||
|
1022 | if self.dataOut.flagNoData: | |
|
1023 | return 0 | |
|
1024 | ||
|
1025 | self.flagIsNewBlock = 0 | |
|
1026 | ||
|
1027 | if self.dataOut.flagDiscontinuousBlock: | |
|
1028 | self.data_spc.fill(0) | |
|
1029 | if self.dataOut.data_cspc is not None: | |
|
1030 | self.data_cspc.fill(0) | |
|
1031 | if self.dataOut.data_dc is not None: | |
|
1032 | self.data_dc.fill(0) | |
|
1033 | self.setNextFile() | |
|
1034 | ||
|
1035 | if self.flagIsNewFile == 0: | |
|
1036 | self.setBasicHeader() | |
|
1037 | ||
|
1038 | self.data_spc = self.dataOut.data_spc.copy() | |
|
1039 | ||
|
1040 | if self.dataOut.data_cspc is not None: | |
|
1041 | self.data_cspc = self.dataOut.data_cspc.copy() | |
|
1042 | ||
|
1043 | if self.dataOut.data_dc is not None: | |
|
1044 | self.data_dc = self.dataOut.data_dc.copy() | |
|
1045 | ||
|
1046 | ======= | |
|
1047 | 590 | Return: |
|
1048 | 591 | 0 : Si no hay data o no hay mas files que puedan escribirse |
|
1049 | 592 | 1 : Si se escribio la data de un bloque en un file |
@@ -1071,51 +614,18 class SpectraWriter(JRODataWriter, Operation): | |||
|
1071 | 614 | if self.dataOut.data_dc is not None: |
|
1072 | 615 | self.data_dc = self.dataOut.data_dc.copy() |
|
1073 | 616 | |
|
1074 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
1075 | 617 | # #self.processingHeaderObj.dataBlocksPerFile) |
|
1076 | 618 | if self.hasAllDataInBuffer(): |
|
1077 | 619 | # self.setFirstHeader() |
|
1078 | 620 | self.writeNextBlock() |
|
1079 | <<<<<<< HEAD | |
|
1080 | ||
|
1081 | return 1 | |
|
1082 | ||
|
1083 | ======= | |
|
1084 | 621 | |
|
1085 | 622 | return 1 |
|
1086 | 623 | |
|
1087 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
624 | ||
|
1088 | 625 | def __getBlockSize(self): |
|
1089 | 626 | ''' |
|
1090 | 627 | Este metodos determina el cantidad de bytes para un bloque de datos de tipo Spectra |
|
1091 | 628 | ''' |
|
1092 | <<<<<<< HEAD | |
|
1093 | ||
|
1094 | dtype_width = self.getDtypeWidth() | |
|
1095 | ||
|
1096 | pts2write = self.dataOut.nHeights * self.dataOut.nFFTPoints | |
|
1097 | ||
|
1098 | pts2write_SelfSpectra = int(self.dataOut.nChannels * pts2write) | |
|
1099 | blocksize = (pts2write_SelfSpectra*dtype_width) | |
|
1100 | ||
|
1101 | if self.dataOut.data_cspc is not None: | |
|
1102 | pts2write_CrossSpectra = int(self.dataOut.nPairs * pts2write) | |
|
1103 | blocksize += (pts2write_CrossSpectra*dtype_width*2) | |
|
1104 | ||
|
1105 | if self.dataOut.data_dc is not None: | |
|
1106 | pts2write_DCchannels = int(self.dataOut.nChannels * self.dataOut.nHeights) | |
|
1107 | blocksize += (pts2write_DCchannels*dtype_width*2) | |
|
1108 | ||
|
1109 | # blocksize = blocksize #* datatypeValue * 2 #CORREGIR ESTO | |
|
1110 | ||
|
1111 | return blocksize | |
|
1112 | ||
|
1113 | def setFirstHeader(self): | |
|
1114 | ||
|
1115 | """ | |
|
1116 | Obtiene una copia del First Header | |
|
1117 | ||
|
1118 | ======= | |
|
1119 | 629 | |
|
1120 | 630 | dtype_width = self.getDtypeWidth() |
|
1121 | 631 | |
@@ -1141,22 +651,11 class SpectraWriter(JRODataWriter, Operation): | |||
|
1141 | 651 | """ |
|
1142 | 652 | Obtiene una copia del First Header |
|
1143 | 653 |
|
|
1144 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
1145 | 654 | Affected: |
|
1146 | 655 | self.systemHeaderObj |
|
1147 | 656 | self.radarControllerHeaderObj |
|
1148 | 657 | self.dtype |
|
1149 | 658 |
|
|
1150 | <<<<<<< HEAD | |
|
1151 | Return: | |
|
1152 | None | |
|
1153 | """ | |
|
1154 | ||
|
1155 | self.systemHeaderObj = self.dataOut.systemHeaderObj.copy() | |
|
1156 | self.systemHeaderObj.nChannels = self.dataOut.nChannels | |
|
1157 | self.radarControllerHeaderObj = self.dataOut.radarControllerHeaderObj.copy() | |
|
1158 | ||
|
1159 | ======= | |
|
1160 | 659 | Return: |
|
1161 | 660 | None |
|
1162 | 661 | """ |
@@ -1165,73 +664,44 class SpectraWriter(JRODataWriter, Operation): | |||
|
1165 | 664 | self.systemHeaderObj.nChannels = self.dataOut.nChannels |
|
1166 | 665 | self.radarControllerHeaderObj = self.dataOut.radarControllerHeaderObj.copy() |
|
1167 | 666 | |
|
1168 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
1169 | 667 | self.processingHeaderObj.dtype = 1 # Spectra |
|
1170 | 668 | self.processingHeaderObj.blockSize = self.__getBlockSize() |
|
1171 | 669 | self.processingHeaderObj.profilesPerBlock = self.dataOut.nFFTPoints |
|
1172 | 670 | self.processingHeaderObj.dataBlocksPerFile = self.blocksPerFile |
|
1173 | 671 | self.processingHeaderObj.nWindows = 1 #podria ser 1 o self.dataOut.processingHeaderObj.nWindows |
|
1174 | 672 | self.processingHeaderObj.nCohInt = self.dataOut.nCohInt# Se requiere para determinar el valor de timeInterval |
|
1175 | <<<<<<< HEAD | |
|
1176 | self.processingHeaderObj.nIncohInt = self.dataOut.nIncohInt | |
|
1177 | self.processingHeaderObj.totalSpectra = self.dataOut.nPairs + self.dataOut.nChannels | |
|
1178 | self.processingHeaderObj.shif_fft = self.dataOut.flagShiftFFT | |
|
1179 | ||
|
1180 | ======= | |
|
1181 | 673 | self.processingHeaderObj.nIncohInt = self.dataOut.nIncohInt |
|
1182 | 674 | self.processingHeaderObj.totalSpectra = self.dataOut.nPairs + self.dataOut.nChannels |
|
1183 | 675 | self.processingHeaderObj.shif_fft = self.dataOut.flagShiftFFT |
|
1184 | 676 | |
|
1185 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
677 | ||
|
1186 | 678 | if self.processingHeaderObj.totalSpectra > 0: |
|
1187 | 679 | channelList = [] |
|
1188 | 680 | for channel in range(self.dataOut.nChannels): |
|
1189 | 681 | channelList.append(channel) |
|
1190 | 682 | channelList.append(channel) |
|
1191 | <<<<<<< HEAD | |
|
1192 | ||
|
1193 | ======= | |
|
1194 | 683 | |
|
1195 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
1196 | 684 | pairsList = [] |
|
1197 | 685 | if self.dataOut.nPairs > 0: |
|
1198 | 686 | for pair in self.dataOut.pairsList: |
|
1199 | 687 | pairsList.append(pair[0]) |
|
1200 | 688 | pairsList.append(pair[1]) |
|
1201 | <<<<<<< HEAD | |
|
1202 | ||
|
1203 | spectraComb = channelList + pairsList | |
|
1204 | spectraComb = numpy.array(spectraComb, dtype="u1") | |
|
1205 | self.processingHeaderObj.spectraComb = spectraComb | |
|
1206 | ||
|
1207 | ======= | |
|
1208 | 689 | |
|
1209 | 690 | spectraComb = channelList + pairsList |
|
1210 | 691 | spectraComb = numpy.array(spectraComb, dtype="u1") |
|
1211 | 692 | self.processingHeaderObj.spectraComb = spectraComb |
|
1212 | 693 | |
|
1213 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
1214 | 694 | if self.dataOut.code is not None: |
|
1215 | 695 | self.processingHeaderObj.code = self.dataOut.code |
|
1216 | 696 | self.processingHeaderObj.nCode = self.dataOut.nCode |
|
1217 | 697 | self.processingHeaderObj.nBaud = self.dataOut.nBaud |
|
1218 | <<<<<<< HEAD | |
|
1219 | ||
|
1220 | ======= | |
|
1221 | 698 | |
|
1222 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
1223 | 699 | if self.processingHeaderObj.nWindows != 0: |
|
1224 | 700 | self.processingHeaderObj.firstHeight = self.dataOut.heightList[0] |
|
1225 | 701 | self.processingHeaderObj.deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
1226 | 702 | self.processingHeaderObj.nHeights = self.dataOut.nHeights |
|
1227 | 703 | self.processingHeaderObj.samplesWin = self.dataOut.nHeights |
|
1228 | <<<<<<< HEAD | |
|
1229 | ||
|
1230 | self.processingHeaderObj.processFlags = self.getProcessFlags() | |
|
1231 | ||
|
1232 | ======= | |
|
1233 | 704 | |
|
1234 | 705 | self.processingHeaderObj.processFlags = self.getProcessFlags() |
|
1235 | 706 | |
|
1236 | >>>>>>> 08c4507d6c3c48f6c52326d5dedfa1972fb26356 | |
|
1237 | 707 | self.setBasicHeader() |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -427,10 +427,16 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
427 | 427 | self.dataOut.flagNoData = False |
|
428 | 428 | |
|
429 | 429 | self.getBasicHeader() |
|
430 | ||
|
430 | ||
|
431 | #print self.basicHeaderObj.printInfo() | |
|
432 | #print self.systemHeaderObj.printInfo() | |
|
433 | #print self.radarControllerHeaderObj.printInfo() | |
|
434 | #print self.processingHeaderObj.printInfo() | |
|
435 | ||
|
431 | 436 | self.dataOut.realtime = self.online |
|
432 | 437 | |
|
433 | 438 | return self.dataOut.data |
|
439 | ||
|
434 | 440 | |
|
435 | 441 | class VoltageWriter(JRODataWriter, Operation): |
|
436 | 442 | """ |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
This diff has been collapsed as it changes many lines, (965 lines changed) Show them Hide them | |||
@@ -1,20 +1,62 | |||
|
1 | 1 | import numpy |
|
2 | 2 |
|
|
3 | 3 |
|
|
4 | import scipy | |
|
4 | 5 |
|
|
5 | 6 |
|
|
6 | 7 |
|
|
7 | 8 |
|
|
8 | 9 |
|
|
9 | 10 |
|
|
11 | from multiprocessing import Pool, TimeoutError | |
|
12 | from multiprocessing.pool import ThreadPool | |
|
13 | import copy_reg | |
|
14 | import cPickle | |
|
15 | import types | |
|
16 | from functools import partial | |
|
17 | import time | |
|
18 | #from sklearn.cluster import KMeans | |
|
10 | 19 | |
|
20 | import matplotlib.pyplot as plt | |
|
21 | ||
|
22 | from scipy.optimize import fmin_l_bfgs_b #optimize with bounds on state papameters | |
|
11 | 23 |
|
|
12 | 24 |
|
|
13 | 25 |
|
|
14 | 26 |
|
|
15 | 27 | |
|
28 | import warnings | |
|
29 | from numpy import NaN | |
|
30 | warnings.filterwarnings('ignore') | |
|
31 | ||
|
16 | 32 |
|
|
17 | 33 | |
|
34 | ||
|
35 | '''solving pickling issue''' | |
|
36 | ||
|
37 | def _pickle_method(method): | |
|
38 | func_name = method.im_func.__name__ | |
|
39 | obj = method.im_self | |
|
40 | cls = method.im_class | |
|
41 | return _unpickle_method, (func_name, obj, cls) | |
|
42 | ||
|
43 | def _unpickle_method(func_name, obj, cls): | |
|
44 | for cls in cls.mro(): | |
|
45 | try: | |
|
46 | func = cls.__dict__[func_name] | |
|
47 | except KeyError: | |
|
48 | pass | |
|
49 | else: | |
|
50 | break | |
|
51 | return func.__get__(obj, cls) | |
|
52 | ||
|
53 | ||
|
54 | ||
|
55 | ||
|
56 | ||
|
57 | ||
|
58 | ||
|
59 | ||
|
18 | 60 |
|
|
19 | 61 |
|
|
20 | 62 |
|
@@ -57,11 +99,13 class ParametersProc(ProcessingUnit): | |||
|
57 | 99 |
|
|
58 | 100 |
|
|
59 | 101 |
|
|
60 |
|
|
|
102 | self.dataOut.timeInterval1 = self.dataIn.timeInterval | |
|
61 | 103 |
|
|
62 | 104 |
|
|
63 | 105 |
|
|
64 | 106 |
|
|
107 | ||
|
108 | ||
|
65 | 109 |
|
|
66 | 110 |
|
|
67 | 111 |
|
@@ -80,18 +124,25 class ParametersProc(ProcessingUnit): | |||
|
80 | 124 |
|
|
81 | 125 | |
|
82 | 126 |
|
|
127 | print 'self.dataIn.data_spc', self.dataIn.data_spc.shape | |
|
83 | 128 |
|
|
84 |
|
|
|
129 | self.dataOut.spc_noise = self.dataIn.getNoise() | |
|
130 | self.dataOut.spc_range = (self.dataIn.getFreqRange(1)/1000. , self.dataIn.getAcfRange(1) , self.dataIn.getVelRange(1) ) | |
|
131 | ||
|
85 | 132 |
|
|
86 |
|
|
|
133 | #self.dataOut.outputInterval = self.dataIn.outputInterval | |
|
87 | 134 |
|
|
88 | 135 |
|
|
89 | ||
|
136 | #print 'datain chandist ',self.dataIn.ChanDist | |
|
90 | 137 |
|
|
91 | 138 |
|
|
139 | else: self.dataOut.ChanDist = None | |
|
140 | ||
|
141 | print 'datain chandist ',self.dataOut.ChanDist | |
|
92 | 142 |
|
|
93 | 143 |
|
|
94 | 144 |
|
|
145 | else: self.dataOut.VelRange = None | |
|
95 | 146 |
|
|
96 | 147 |
|
|
97 | 148 |
|
@@ -132,71 +183,843 class ParametersProc(ProcessingUnit): | |||
|
132 | 183 |
|
|
133 | 184 |
|
|
134 | 185 |
|
|
186 | ||
|
187 | ||
|
188 | def target(tups): | |
|
189 | ||
|
190 | obj, args = tups | |
|
191 | #print 'TARGETTT', obj, args | |
|
192 | return obj.FitGau(args) | |
|
193 | ||
|
194 | class GaussianFit(Operation): | |
|
195 | ||
|
196 | ''' | |
|
197 | Function that fit of one and two generalized gaussians (gg) based | |
|
198 | on the PSD shape across an "power band" identified from a cumsum of | |
|
199 | the measured spectrum - noise. | |
|
200 | ||
|
201 | Input: | |
|
202 | self.dataOut.data_pre : SelfSpectra | |
|
203 | ||
|
204 | Output: | |
|
205 | self.dataOut.GauSPC : SPC_ch1, SPC_ch2 | |
|
206 | ||
|
207 | ''' | |
|
208 | def __init__(self, **kwargs): | |
|
209 | Operation.__init__(self, **kwargs) | |
|
210 | self.i=0 | |
|
211 | ||
|
212 | ||
|
213 | def run(self, dataOut, num_intg=7, pnoise=1., vel_arr=None, SNRlimit=-9): #num_intg: Incoherent integrations, pnoise: Noise, vel_arr: range of velocities, similar to the ftt points | |
|
214 | """This routine will find a couple of generalized Gaussians to a power spectrum | |
|
215 | input: spc | |
|
216 | output: | |
|
217 | Amplitude0,shift0,width0,p0,Amplitude1,shift1,width1,p1,noise | |
|
218 | """ | |
|
219 | ||
|
220 | self.spc = dataOut.data_pre[0].copy() | |
|
221 | ||
|
222 | ||
|
223 | print 'SelfSpectra Shape', numpy.asarray(self.spc).shape | |
|
224 | ||
|
225 | ||
|
226 | #plt.figure(50) | |
|
227 | #plt.subplot(121) | |
|
228 | #plt.plot(self.spc,'k',label='spc(66)') | |
|
229 | #plt.plot(xFrec,ySamples[1],'g',label='Ch1') | |
|
230 | #plt.plot(xFrec,ySamples[2],'r',label='Ch2') | |
|
231 | #plt.plot(xFrec,FitGauss,'yo:',label='fit') | |
|
232 | #plt.legend() | |
|
233 | #plt.title('DATOS A ALTURA DE 7500 METROS') | |
|
234 | #plt.show() | |
|
235 | ||
|
236 | self.Num_Hei = self.spc.shape[2] | |
|
237 | #self.Num_Bin = len(self.spc) | |
|
238 | self.Num_Bin = self.spc.shape[1] | |
|
239 | self.Num_Chn = self.spc.shape[0] | |
|
240 | ||
|
241 | Vrange = dataOut.abscissaList | |
|
242 | ||
|
243 | #print 'self.spc2', numpy.asarray(self.spc).shape | |
|
244 | ||
|
245 | GauSPC = numpy.empty([2,self.Num_Bin,self.Num_Hei]) | |
|
246 | SPC_ch1 = numpy.empty([self.Num_Bin,self.Num_Hei]) | |
|
247 | SPC_ch2 = numpy.empty([self.Num_Bin,self.Num_Hei]) | |
|
248 | SPC_ch1[:] = numpy.NaN | |
|
249 | SPC_ch2[:] = numpy.NaN | |
|
250 | ||
|
251 | ||
|
252 | start_time = time.time() | |
|
253 | ||
|
254 | noise_ = dataOut.spc_noise[0].copy() | |
|
255 | ||
|
256 | ||
|
257 | ||
|
258 | pool = Pool(processes=self.Num_Chn) | |
|
259 | args = [(Vrange, Ch, pnoise, noise_, num_intg, SNRlimit) for Ch in range(self.Num_Chn)] | |
|
260 | objs = [self for __ in range(self.Num_Chn)] | |
|
261 | attrs = zip(objs, args) | |
|
262 | gauSPC = pool.map(target, attrs) | |
|
263 | dataOut.GauSPC = numpy.asarray(gauSPC) | |
|
264 | # ret = [] | |
|
265 | # for n in range(self.Num_Chn): | |
|
266 | # self.FitGau(args[n]) | |
|
267 | # dataOut.GauSPC = ret | |
|
268 | ||
|
269 | ||
|
270 | ||
|
271 | # for ch in range(self.Num_Chn): | |
|
272 | # | |
|
273 | # for ht in range(self.Num_Hei): | |
|
274 | # #print (numpy.asarray(self.spc).shape) | |
|
275 | # spc = numpy.asarray(self.spc)[ch,:,ht] | |
|
276 | # | |
|
277 | # ############################################# | |
|
278 | # # normalizing spc and noise | |
|
279 | # # This part differs from gg1 | |
|
280 | # spc_norm_max = max(spc) | |
|
281 | # spc = spc / spc_norm_max | |
|
282 | # pnoise = pnoise / spc_norm_max | |
|
283 | # ############################################# | |
|
284 | # | |
|
285 | # if abs(vel_arr[0])<15.0: # this switch is for spectra collected with different length IPP's | |
|
286 | # fatspectra=1.0 | |
|
287 | # else: | |
|
288 | # fatspectra=0.5 | |
|
289 | # | |
|
290 | # wnoise = noise_ / spc_norm_max | |
|
291 | # #print 'wnoise', noise_, dataOut.spc_noise[0], wnoise | |
|
292 | # #wnoise,stdv,i_max,index =enoise(spc,num_intg) #noise estimate using Hildebrand Sekhon, only wnoise is used | |
|
293 | # #if wnoise>1.1*pnoise: # to be tested later | |
|
294 | # # wnoise=pnoise | |
|
295 | # noisebl=wnoise*0.9; noisebh=wnoise*1.1 | |
|
296 | # spc=spc-wnoise | |
|
297 | # | |
|
298 | # minx=numpy.argmin(spc) | |
|
299 | # spcs=numpy.roll(spc,-minx) | |
|
300 | # cum=numpy.cumsum(spcs) | |
|
301 | # tot_noise=wnoise * self.Num_Bin #64; | |
|
302 | # #tot_signal=sum(cum[-5:])/5.; ''' How does this line work? ''' | |
|
303 | # #snr=tot_signal/tot_noise | |
|
304 | # #snr=cum[-1]/tot_noise | |
|
305 | # | |
|
306 | # #print 'spc' , spcs[5:8] , 'tot_noise', tot_noise | |
|
307 | # | |
|
308 | # snr = sum(spcs)/tot_noise | |
|
309 | # snrdB=10.*numpy.log10(snr) | |
|
310 | # | |
|
311 | # #if snrdB < -9 : | |
|
312 | # # snrdB = numpy.NaN | |
|
313 | # # continue | |
|
314 | # | |
|
315 | # #print 'snr',snrdB # , sum(spcs) , tot_noise | |
|
316 | # | |
|
317 | # | |
|
318 | # #if snrdB<-18 or numpy.isnan(snrdB) or num_intg<4: | |
|
319 | # # return [None,]*4,[None,]*4,None,snrdB,None,None,[None,]*5,[None,]*9,None | |
|
320 | # | |
|
321 | # cummax=max(cum); epsi=0.08*fatspectra # cumsum to narrow down the energy region | |
|
322 | # cumlo=cummax*epsi; | |
|
323 | # cumhi=cummax*(1-epsi) | |
|
324 | # powerindex=numpy.array(numpy.where(numpy.logical_and(cum>cumlo, cum<cumhi))[0]) | |
|
325 | # | |
|
326 | # #if len(powerindex)==1: | |
|
327 | # ##return [numpy.mod(powerindex[0]+minx,64),None,None,None,],[None,]*4,None,snrdB,None,None,[None,]*5,[None,]*9,None | |
|
328 | # #return [numpy.mod(powerindex[0]+minx, self.Num_Bin ),None,None,None,],[None,]*4,None,snrdB,None,None,[None,]*5,[None,]*9,None | |
|
329 | # #elif len(powerindex)<4*fatspectra: | |
|
330 | # #return [None,]*4,[None,]*4,None,snrdB,None,None,[None,]*5,[None,]*9,None | |
|
331 | # | |
|
332 | # if len(powerindex) < 1:# case for powerindex 0 | |
|
333 | # continue | |
|
334 | # powerlo=powerindex[0] | |
|
335 | # powerhi=powerindex[-1] | |
|
336 | # powerwidth=powerhi-powerlo | |
|
337 | # | |
|
338 | # firstpeak=powerlo+powerwidth/10.# first gaussian energy location | |
|
339 | # secondpeak=powerhi-powerwidth/10.#second gaussian energy location | |
|
340 | # midpeak=(firstpeak+secondpeak)/2. | |
|
341 | # firstamp=spcs[int(firstpeak)] | |
|
342 | # secondamp=spcs[int(secondpeak)] | |
|
343 | # midamp=spcs[int(midpeak)] | |
|
344 | # #x=numpy.spc.shape[1] | |
|
345 | # | |
|
346 | # #x=numpy.arange(64) | |
|
347 | # x=numpy.arange( self.Num_Bin ) | |
|
348 | # y_data=spc+wnoise | |
|
349 | # | |
|
350 | # # single gaussian | |
|
351 | # #shift0=numpy.mod(midpeak+minx,64) | |
|
352 | # shift0=numpy.mod(midpeak+minx, self.Num_Bin ) | |
|
353 | # width0=powerwidth/4.#Initialization entire power of spectrum divided by 4 | |
|
354 | # power0=2. | |
|
355 | # amplitude0=midamp | |
|
356 | # state0=[shift0,width0,amplitude0,power0,wnoise] | |
|
357 | # #bnds=((0,63),(1,powerwidth),(0,None),(0.5,3.),(noisebl,noisebh)) | |
|
358 | # bnds=(( 0,(self.Num_Bin-1) ),(1,powerwidth),(0,None),(0.5,3.),(noisebl,noisebh)) | |
|
359 | # #bnds=(( 0,(self.Num_Bin-1) ),(1,powerwidth),(0,None),(0.5,3.),(0.1,0.5)) | |
|
360 | # # bnds = range of fft, power width, amplitude, power, noise | |
|
361 | # lsq1=fmin_l_bfgs_b(self.misfit1,state0,args=(y_data,x,num_intg),bounds=bnds,approx_grad=True) | |
|
362 | # | |
|
363 | # chiSq1=lsq1[1]; | |
|
364 | # jack1= self.y_jacobian1(x,lsq1[0]) | |
|
365 | # | |
|
366 | # | |
|
367 | # try: | |
|
368 | # sigmas1=numpy.sqrt(chiSq1*numpy.diag(numpy.linalg.inv(numpy.dot(jack1.T,jack1)))) | |
|
369 | # except: | |
|
370 | # std1=32.; sigmas1=numpy.ones(5) | |
|
371 | # else: | |
|
372 | # std1=sigmas1[0] | |
|
373 | # | |
|
374 | # | |
|
375 | # if fatspectra<1.0 and powerwidth<4: | |
|
376 | # choice=0 | |
|
377 | # Amplitude0=lsq1[0][2] | |
|
378 | # shift0=lsq1[0][0] | |
|
379 | # width0=lsq1[0][1] | |
|
380 | # p0=lsq1[0][3] | |
|
381 | # Amplitude1=0. | |
|
382 | # shift1=0. | |
|
383 | # width1=0. | |
|
384 | # p1=0. | |
|
385 | # noise=lsq1[0][4] | |
|
386 | # #return (numpy.array([shift0,width0,Amplitude0,p0]), | |
|
387 | # # numpy.array([shift1,width1,Amplitude1,p1]),noise,snrdB,chiSq1,6.,sigmas1,[None,]*9,choice) | |
|
388 | # | |
|
389 | # # two gaussians | |
|
390 | # #shift0=numpy.mod(firstpeak+minx,64); shift1=numpy.mod(secondpeak+minx,64) | |
|
391 | # shift0=numpy.mod(firstpeak+minx, self.Num_Bin ); | |
|
392 | # shift1=numpy.mod(secondpeak+minx, self.Num_Bin ) | |
|
393 | # width0=powerwidth/6.; | |
|
394 | # width1=width0 | |
|
395 | # power0=2.; | |
|
396 | # power1=power0 | |
|
397 | # amplitude0=firstamp; | |
|
398 | # amplitude1=secondamp | |
|
399 | # state0=[shift0,width0,amplitude0,power0,shift1,width1,amplitude1,power1,wnoise] | |
|
400 | # #bnds=((0,63),(1,powerwidth/2.),(0,None),(0.5,3.),(0,63),(1,powerwidth/2.),(0,None),(0.5,3.),(noisebl,noisebh)) | |
|
401 | # bnds=(( 0,(self.Num_Bin-1) ),(1,powerwidth/2.),(0,None),(0.5,3.),( 0,(self.Num_Bin-1)),(1,powerwidth/2.),(0,None),(0.5,3.),(noisebl,noisebh)) | |
|
402 | # #bnds=(( 0,(self.Num_Bin-1) ),(1,powerwidth/2.),(0,None),(0.5,3.),( 0,(self.Num_Bin-1)),(1,powerwidth/2.),(0,None),(0.5,3.),(0.1,0.5)) | |
|
403 | # | |
|
404 | # lsq2=fmin_l_bfgs_b(self.misfit2,state0,args=(y_data,x,num_intg),bounds=bnds,approx_grad=True) | |
|
405 | # | |
|
406 | # | |
|
407 | # chiSq2=lsq2[1]; jack2=self.y_jacobian2(x,lsq2[0]) | |
|
408 | # | |
|
409 | # | |
|
410 | # try: | |
|
411 | # sigmas2=numpy.sqrt(chiSq2*numpy.diag(numpy.linalg.inv(numpy.dot(jack2.T,jack2)))) | |
|
412 | # except: | |
|
413 | # std2a=32.; std2b=32.; sigmas2=numpy.ones(9) | |
|
414 | # else: | |
|
415 | # std2a=sigmas2[0]; std2b=sigmas2[4] | |
|
416 | # | |
|
417 | # | |
|
418 | # | |
|
419 | # oneG=(chiSq1<5 and chiSq1/chiSq2<2.0) and (abs(lsq2[0][0]-lsq2[0][4])<(lsq2[0][1]+lsq2[0][5])/3. or abs(lsq2[0][0]-lsq2[0][4])<10) | |
|
420 | # | |
|
421 | # if snrdB>-9: # when SNR is strong pick the peak with least shift (LOS velocity) error | |
|
422 | # if oneG: | |
|
423 | # choice=0 | |
|
424 | # else: | |
|
425 | # w1=lsq2[0][1]; w2=lsq2[0][5] | |
|
426 | # a1=lsq2[0][2]; a2=lsq2[0][6] | |
|
427 | # p1=lsq2[0][3]; p2=lsq2[0][7] | |
|
428 | # s1=(2**(1+1./p1))*scipy.special.gamma(1./p1)/p1; s2=(2**(1+1./p2))*scipy.special.gamma(1./p2)/p2; | |
|
429 | # gp1=a1*w1*s1; gp2=a2*w2*s2 # power content of each ggaussian with proper p scaling | |
|
430 | # | |
|
431 | # if gp1>gp2: | |
|
432 | # if a1>0.7*a2: | |
|
433 | # choice=1 | |
|
434 | # else: | |
|
435 | # choice=2 | |
|
436 | # elif gp2>gp1: | |
|
437 | # if a2>0.7*a1: | |
|
438 | # choice=2 | |
|
439 | # else: | |
|
440 | # choice=1 | |
|
441 | # else: | |
|
442 | # choice=numpy.argmax([a1,a2])+1 | |
|
443 | # #else: | |
|
444 | # #choice=argmin([std2a,std2b])+1 | |
|
445 | # | |
|
446 | # else: # with low SNR go to the most energetic peak | |
|
447 | # choice=numpy.argmax([lsq1[0][2]*lsq1[0][1],lsq2[0][2]*lsq2[0][1],lsq2[0][6]*lsq2[0][5]]) | |
|
448 | # | |
|
449 | # #print 'choice',choice | |
|
450 | # | |
|
451 | # if choice==0: # pick the single gaussian fit | |
|
452 | # Amplitude0=lsq1[0][2] | |
|
453 | # shift0=lsq1[0][0] | |
|
454 | # width0=lsq1[0][1] | |
|
455 | # p0=lsq1[0][3] | |
|
456 | # Amplitude1=0. | |
|
457 | # shift1=0. | |
|
458 | # width1=0. | |
|
459 | # p1=0. | |
|
460 | # noise=lsq1[0][4] | |
|
461 | # elif choice==1: # take the first one of the 2 gaussians fitted | |
|
462 | # Amplitude0 = lsq2[0][2] | |
|
463 | # shift0 = lsq2[0][0] | |
|
464 | # width0 = lsq2[0][1] | |
|
465 | # p0 = lsq2[0][3] | |
|
466 | # Amplitude1 = lsq2[0][6] # This is 0 in gg1 | |
|
467 | # shift1 = lsq2[0][4] # This is 0 in gg1 | |
|
468 | # width1 = lsq2[0][5] # This is 0 in gg1 | |
|
469 | # p1 = lsq2[0][7] # This is 0 in gg1 | |
|
470 | # noise = lsq2[0][8] | |
|
471 | # else: # the second one | |
|
472 | # Amplitude0 = lsq2[0][6] | |
|
473 | # shift0 = lsq2[0][4] | |
|
474 | # width0 = lsq2[0][5] | |
|
475 | # p0 = lsq2[0][7] | |
|
476 | # Amplitude1 = lsq2[0][2] # This is 0 in gg1 | |
|
477 | # shift1 = lsq2[0][0] # This is 0 in gg1 | |
|
478 | # width1 = lsq2[0][1] # This is 0 in gg1 | |
|
479 | # p1 = lsq2[0][3] # This is 0 in gg1 | |
|
480 | # noise = lsq2[0][8] | |
|
481 | # | |
|
482 | # #print len(noise + Amplitude0*numpy.exp(-0.5*(abs(x-shift0))/width0)**p0) | |
|
483 | # SPC_ch1[:,ht] = noise + Amplitude0*numpy.exp(-0.5*(abs(x-shift0))/width0)**p0 | |
|
484 | # SPC_ch2[:,ht] = noise + Amplitude1*numpy.exp(-0.5*(abs(x-shift1))/width1)**p1 | |
|
485 | # #print 'SPC_ch1.shape',SPC_ch1.shape | |
|
486 | # #print 'SPC_ch2.shape',SPC_ch2.shape | |
|
487 | # #dataOut.data_param = SPC_ch1 | |
|
488 | # GauSPC[0] = SPC_ch1 | |
|
489 | # GauSPC[1] = SPC_ch2 | |
|
490 | ||
|
491 | # #plt.gcf().clear() | |
|
492 | # plt.figure(50+self.i) | |
|
493 | # self.i=self.i+1 | |
|
494 | # #plt.subplot(121) | |
|
495 | # plt.plot(self.spc,'k')#,label='spc(66)') | |
|
496 | # plt.plot(SPC_ch1[ch,ht],'b')#,label='gg1') | |
|
497 | # #plt.plot(SPC_ch2,'r')#,label='gg2') | |
|
498 | # #plt.plot(xFrec,ySamples[1],'g',label='Ch1') | |
|
499 | # #plt.plot(xFrec,ySamples[2],'r',label='Ch2') | |
|
500 | # #plt.plot(xFrec,FitGauss,'yo:',label='fit') | |
|
501 | # plt.legend() | |
|
502 | # plt.title('DATOS A ALTURA DE 7500 METROS') | |
|
503 | # plt.show() | |
|
504 | # print 'shift0', shift0 | |
|
505 | # print 'Amplitude0', Amplitude0 | |
|
506 | # print 'width0', width0 | |
|
507 | # print 'p0', p0 | |
|
508 | # print '========================' | |
|
509 | # print 'shift1', shift1 | |
|
510 | # print 'Amplitude1', Amplitude1 | |
|
511 | # print 'width1', width1 | |
|
512 | # print 'p1', p1 | |
|
513 | # print 'noise', noise | |
|
514 | # print 's_noise', wnoise | |
|
515 | ||
|
516 | print '========================================================' | |
|
517 | print 'total_time: ', time.time()-start_time | |
|
518 | ||
|
519 | # re-normalizing spc and noise | |
|
520 | # This part differs from gg1 | |
|
521 | ||
|
522 | ||
|
523 | ||
|
524 | ''' Parameters: | |
|
525 | 1. Amplitude | |
|
526 | 2. Shift | |
|
527 | 3. Width | |
|
528 | 4. Power | |
|
529 | ''' | |
|
530 | ||
|
531 | ||
|
532 | ############################################################################### | |
|
533 | def FitGau(self, X): | |
|
534 | ||
|
535 | Vrange, ch, pnoise, noise_, num_intg, SNRlimit = X | |
|
536 | #print 'VARSSSS', ch, pnoise, noise, num_intg | |
|
537 | ||
|
538 | #print 'HEIGHTS', self.Num_Hei | |
|
539 | ||
|
540 | GauSPC = [] | |
|
541 | SPC_ch1 = numpy.empty([self.Num_Bin,self.Num_Hei]) | |
|
542 | SPC_ch2 = numpy.empty([self.Num_Bin,self.Num_Hei]) | |
|
543 | SPC_ch1[:] = 0#numpy.NaN | |
|
544 | SPC_ch2[:] = 0#numpy.NaN | |
|
545 | ||
|
546 | ||
|
547 | ||
|
548 | for ht in range(self.Num_Hei): | |
|
549 | #print (numpy.asarray(self.spc).shape) | |
|
550 | ||
|
551 | #print 'TTTTT', ch , ht | |
|
552 | #print self.spc.shape | |
|
553 | ||
|
554 | ||
|
555 | spc = numpy.asarray(self.spc)[ch,:,ht] | |
|
556 | ||
|
557 | ############################################# | |
|
558 | # normalizing spc and noise | |
|
559 | # This part differs from gg1 | |
|
560 | spc_norm_max = max(spc) | |
|
561 | spc = spc / spc_norm_max | |
|
562 | pnoise = pnoise / spc_norm_max | |
|
563 | ############################################# | |
|
564 | ||
|
565 | fatspectra=1.0 | |
|
566 | ||
|
567 | wnoise = noise_ / spc_norm_max | |
|
568 | #wnoise,stdv,i_max,index =enoise(spc,num_intg) #noise estimate using Hildebrand Sekhon, only wnoise is used | |
|
569 | #if wnoise>1.1*pnoise: # to be tested later | |
|
570 | # wnoise=pnoise | |
|
571 | noisebl=wnoise*0.9; noisebh=wnoise*1.1 | |
|
572 | spc=spc-wnoise | |
|
573 | # print 'wnoise', noise_[0], spc_norm_max, wnoise | |
|
574 | minx=numpy.argmin(spc) | |
|
575 | spcs=numpy.roll(spc,-minx) | |
|
576 | cum=numpy.cumsum(spcs) | |
|
577 | tot_noise=wnoise * self.Num_Bin #64; | |
|
578 | #print 'spc' , spcs[5:8] , 'tot_noise', tot_noise | |
|
579 | #tot_signal=sum(cum[-5:])/5.; ''' How does this line work? ''' | |
|
580 | #snr=tot_signal/tot_noise | |
|
581 | #snr=cum[-1]/tot_noise | |
|
582 | snr = sum(spcs)/tot_noise | |
|
583 | snrdB=10.*numpy.log10(snr) | |
|
584 | ||
|
585 | if snrdB < SNRlimit : | |
|
586 | snr = numpy.NaN | |
|
587 | SPC_ch1[:,ht] = 0#numpy.NaN | |
|
588 | SPC_ch1[:,ht] = 0#numpy.NaN | |
|
589 | GauSPC = (SPC_ch1,SPC_ch2) | |
|
590 | continue | |
|
591 | #print 'snr',snrdB #, sum(spcs) , tot_noise | |
|
592 | ||
|
593 | ||
|
594 | ||
|
595 | #if snrdB<-18 or numpy.isnan(snrdB) or num_intg<4: | |
|
596 | # return [None,]*4,[None,]*4,None,snrdB,None,None,[None,]*5,[None,]*9,None | |
|
597 | ||
|
598 | cummax=max(cum); epsi=0.08*fatspectra # cumsum to narrow down the energy region | |
|
599 | cumlo=cummax*epsi; | |
|
600 | cumhi=cummax*(1-epsi) | |
|
601 | powerindex=numpy.array(numpy.where(numpy.logical_and(cum>cumlo, cum<cumhi))[0]) | |
|
602 | ||
|
603 | ||
|
604 | if len(powerindex) < 1:# case for powerindex 0 | |
|
605 | continue | |
|
606 | powerlo=powerindex[0] | |
|
607 | powerhi=powerindex[-1] | |
|
608 | powerwidth=powerhi-powerlo | |
|
609 | ||
|
610 | firstpeak=powerlo+powerwidth/10.# first gaussian energy location | |
|
611 | secondpeak=powerhi-powerwidth/10.#second gaussian energy location | |
|
612 | midpeak=(firstpeak+secondpeak)/2. | |
|
613 | firstamp=spcs[int(firstpeak)] | |
|
614 | secondamp=spcs[int(secondpeak)] | |
|
615 | midamp=spcs[int(midpeak)] | |
|
616 | ||
|
617 | x=numpy.arange( self.Num_Bin ) | |
|
618 | y_data=spc+wnoise | |
|
619 | ||
|
620 | # single gaussian | |
|
621 | shift0=numpy.mod(midpeak+minx, self.Num_Bin ) | |
|
622 | width0=powerwidth/4.#Initialization entire power of spectrum divided by 4 | |
|
623 | power0=2. | |
|
624 | amplitude0=midamp | |
|
625 | state0=[shift0,width0,amplitude0,power0,wnoise] | |
|
626 | bnds=(( 0,(self.Num_Bin-1) ),(1,powerwidth),(0,None),(0.5,3.),(noisebl,noisebh)) | |
|
627 | lsq1=fmin_l_bfgs_b(self.misfit1,state0,args=(y_data,x,num_intg),bounds=bnds,approx_grad=True) | |
|
628 | ||
|
629 | chiSq1=lsq1[1]; | |
|
630 | jack1= self.y_jacobian1(x,lsq1[0]) | |
|
631 | ||
|
632 | ||
|
633 | try: | |
|
634 | sigmas1=numpy.sqrt(chiSq1*numpy.diag(numpy.linalg.inv(numpy.dot(jack1.T,jack1)))) | |
|
635 | except: | |
|
636 | std1=32.; sigmas1=numpy.ones(5) | |
|
637 | else: | |
|
638 | std1=sigmas1[0] | |
|
639 | ||
|
640 | ||
|
641 | if fatspectra<1.0 and powerwidth<4: | |
|
642 | choice=0 | |
|
643 | Amplitude0=lsq1[0][2] | |
|
644 | shift0=lsq1[0][0] | |
|
645 | width0=lsq1[0][1] | |
|
646 | p0=lsq1[0][3] | |
|
647 | Amplitude1=0. | |
|
648 | shift1=0. | |
|
649 | width1=0. | |
|
650 | p1=0. | |
|
651 | noise=lsq1[0][4] | |
|
652 | #return (numpy.array([shift0,width0,Amplitude0,p0]), | |
|
653 | # numpy.array([shift1,width1,Amplitude1,p1]),noise,snrdB,chiSq1,6.,sigmas1,[None,]*9,choice) | |
|
654 | ||
|
655 | # two gaussians | |
|
656 | #shift0=numpy.mod(firstpeak+minx,64); shift1=numpy.mod(secondpeak+minx,64) | |
|
657 | shift0=numpy.mod(firstpeak+minx, self.Num_Bin ); | |
|
658 | shift1=numpy.mod(secondpeak+minx, self.Num_Bin ) | |
|
659 | width0=powerwidth/6.; | |
|
660 | width1=width0 | |
|
661 | power0=2.; | |
|
662 | power1=power0 | |
|
663 | amplitude0=firstamp; | |
|
664 | amplitude1=secondamp | |
|
665 | state0=[shift0,width0,amplitude0,power0,shift1,width1,amplitude1,power1,wnoise] | |
|
666 | #bnds=((0,63),(1,powerwidth/2.),(0,None),(0.5,3.),(0,63),(1,powerwidth/2.),(0,None),(0.5,3.),(noisebl,noisebh)) | |
|
667 | bnds=(( 0,(self.Num_Bin-1) ),(1,powerwidth/2.),(0,None),(0.5,3.),( 0,(self.Num_Bin-1)),(1,powerwidth/2.),(0,None),(0.5,3.),(noisebl,noisebh)) | |
|
668 | #bnds=(( 0,(self.Num_Bin-1) ),(1,powerwidth/2.),(0,None),(0.5,3.),( 0,(self.Num_Bin-1)),(1,powerwidth/2.),(0,None),(0.5,3.),(0.1,0.5)) | |
|
669 | ||
|
670 | lsq2=fmin_l_bfgs_b(self.misfit2,state0,args=(y_data,x,num_intg),bounds=bnds,approx_grad=True) | |
|
671 | ||
|
672 | ||
|
673 | chiSq2=lsq2[1]; jack2=self.y_jacobian2(x,lsq2[0]) | |
|
674 | ||
|
675 | ||
|
676 | try: | |
|
677 | sigmas2=numpy.sqrt(chiSq2*numpy.diag(numpy.linalg.inv(numpy.dot(jack2.T,jack2)))) | |
|
678 | except: | |
|
679 | std2a=32.; std2b=32.; sigmas2=numpy.ones(9) | |
|
680 | else: | |
|
681 | std2a=sigmas2[0]; std2b=sigmas2[4] | |
|
682 | ||
|
683 | ||
|
684 | ||
|
685 | oneG=(chiSq1<5 and chiSq1/chiSq2<2.0) and (abs(lsq2[0][0]-lsq2[0][4])<(lsq2[0][1]+lsq2[0][5])/3. or abs(lsq2[0][0]-lsq2[0][4])<10) | |
|
686 | ||
|
687 | if snrdB>-6: # when SNR is strong pick the peak with least shift (LOS velocity) error | |
|
688 | if oneG: | |
|
689 | choice=0 | |
|
690 | else: | |
|
691 | w1=lsq2[0][1]; w2=lsq2[0][5] | |
|
692 | a1=lsq2[0][2]; a2=lsq2[0][6] | |
|
693 | p1=lsq2[0][3]; p2=lsq2[0][7] | |
|
694 | s1=(2**(1+1./p1))*scipy.special.gamma(1./p1)/p1; | |
|
695 | s2=(2**(1+1./p2))*scipy.special.gamma(1./p2)/p2; | |
|
696 | gp1=a1*w1*s1; gp2=a2*w2*s2 # power content of each ggaussian with proper p scaling | |
|
697 | ||
|
698 | if gp1>gp2: | |
|
699 | if a1>0.7*a2: | |
|
700 | choice=1 | |
|
701 | else: | |
|
702 | choice=2 | |
|
703 | elif gp2>gp1: | |
|
704 | if a2>0.7*a1: | |
|
705 | choice=2 | |
|
706 | else: | |
|
707 | choice=1 | |
|
708 | else: | |
|
709 | choice=numpy.argmax([a1,a2])+1 | |
|
710 | #else: | |
|
711 | #choice=argmin([std2a,std2b])+1 | |
|
712 | ||
|
713 | else: # with low SNR go to the most energetic peak | |
|
714 | choice=numpy.argmax([lsq1[0][2]*lsq1[0][1],lsq2[0][2]*lsq2[0][1],lsq2[0][6]*lsq2[0][5]]) | |
|
715 | ||
|
716 | ||
|
717 | shift0=lsq2[0][0]; vel0=Vrange[0] + shift0*(Vrange[1]-Vrange[0]) | |
|
718 | shift1=lsq2[0][4]; vel1=Vrange[0] + shift1*(Vrange[1]-Vrange[0]) | |
|
719 | ||
|
720 | max_vel = 20 | |
|
721 | ||
|
722 | #first peak will be 0, second peak will be 1 | |
|
723 | if vel0 > 0 and vel0 < max_vel : #first peak is in the correct range | |
|
724 | shift0=lsq2[0][0] | |
|
725 | width0=lsq2[0][1] | |
|
726 | Amplitude0=lsq2[0][2] | |
|
727 | p0=lsq2[0][3] | |
|
728 | ||
|
729 | shift1=lsq2[0][4] | |
|
730 | width1=lsq2[0][5] | |
|
731 | Amplitude1=lsq2[0][6] | |
|
732 | p1=lsq2[0][7] | |
|
733 | noise=lsq2[0][8] | |
|
734 | else: | |
|
735 | shift1=lsq2[0][0] | |
|
736 | width1=lsq2[0][1] | |
|
737 | Amplitude1=lsq2[0][2] | |
|
738 | p1=lsq2[0][3] | |
|
739 | ||
|
740 | shift0=lsq2[0][4] | |
|
741 | width0=lsq2[0][5] | |
|
742 | Amplitude0=lsq2[0][6] | |
|
743 | p0=lsq2[0][7] | |
|
744 | noise=lsq2[0][8] | |
|
745 | ||
|
746 | if Amplitude0<0.1: # in case the peak is noise | |
|
747 | shift0,width0,Amplitude0,p0 = 4*[numpy.NaN] | |
|
748 | if Amplitude1<0.1: | |
|
749 | shift1,width1,Amplitude1,p1 = 4*[numpy.NaN] | |
|
750 | ||
|
751 | ||
|
752 | # if choice==0: # pick the single gaussian fit | |
|
753 | # Amplitude0=lsq1[0][2] | |
|
754 | # shift0=lsq1[0][0] | |
|
755 | # width0=lsq1[0][1] | |
|
756 | # p0=lsq1[0][3] | |
|
757 | # Amplitude1=0. | |
|
758 | # shift1=0. | |
|
759 | # width1=0. | |
|
760 | # p1=0. | |
|
761 | # noise=lsq1[0][4] | |
|
762 | # elif choice==1: # take the first one of the 2 gaussians fitted | |
|
763 | # Amplitude0 = lsq2[0][2] | |
|
764 | # shift0 = lsq2[0][0] | |
|
765 | # width0 = lsq2[0][1] | |
|
766 | # p0 = lsq2[0][3] | |
|
767 | # Amplitude1 = lsq2[0][6] # This is 0 in gg1 | |
|
768 | # shift1 = lsq2[0][4] # This is 0 in gg1 | |
|
769 | # width1 = lsq2[0][5] # This is 0 in gg1 | |
|
770 | # p1 = lsq2[0][7] # This is 0 in gg1 | |
|
771 | # noise = lsq2[0][8] | |
|
772 | # else: # the second one | |
|
773 | # Amplitude0 = lsq2[0][6] | |
|
774 | # shift0 = lsq2[0][4] | |
|
775 | # width0 = lsq2[0][5] | |
|
776 | # p0 = lsq2[0][7] | |
|
777 | # Amplitude1 = lsq2[0][2] # This is 0 in gg1 | |
|
778 | # shift1 = lsq2[0][0] # This is 0 in gg1 | |
|
779 | # width1 = lsq2[0][1] # This is 0 in gg1 | |
|
780 | # p1 = lsq2[0][3] # This is 0 in gg1 | |
|
781 | # noise = lsq2[0][8] | |
|
782 | ||
|
783 | #print len(noise + Amplitude0*numpy.exp(-0.5*(abs(x-shift0))/width0)**p0) | |
|
784 | SPC_ch1[:,ht] = noise + Amplitude0*numpy.exp(-0.5*(abs(x-shift0))/width0)**p0 | |
|
785 | SPC_ch2[:,ht] = noise + Amplitude1*numpy.exp(-0.5*(abs(x-shift1))/width1)**p1 | |
|
786 | #print 'SPC_ch1.shape',SPC_ch1.shape | |
|
787 | #print 'SPC_ch2.shape',SPC_ch2.shape | |
|
788 | #dataOut.data_param = SPC_ch1 | |
|
789 | GauSPC = (SPC_ch1,SPC_ch2) | |
|
790 | #GauSPC[1] = SPC_ch2 | |
|
791 | ||
|
792 | # print 'shift0', shift0 | |
|
793 | # print 'Amplitude0', Amplitude0 | |
|
794 | # print 'width0', width0 | |
|
795 | # print 'p0', p0 | |
|
796 | # print '========================' | |
|
797 | # print 'shift1', shift1 | |
|
798 | # print 'Amplitude1', Amplitude1 | |
|
799 | # print 'width1', width1 | |
|
800 | # print 'p1', p1 | |
|
801 | # print 'noise', noise | |
|
802 | # print 's_noise', wnoise | |
|
803 | ||
|
804 | return GauSPC | |
|
805 | ||
|
806 | ||
|
807 | def y_jacobian1(self,x,state): # This function is for further analysis of generalized Gaussians, it is not too importan for the signal discrimination. | |
|
808 | y_model=self.y_model1(x,state) | |
|
809 | s0,w0,a0,p0,n=state | |
|
810 | e0=((x-s0)/w0)**2; | |
|
811 | ||
|
812 | e0u=((x-s0-self.Num_Bin)/w0)**2; | |
|
813 | ||
|
814 | e0d=((x-s0+self.Num_Bin)/w0)**2 | |
|
815 | m0=numpy.exp(-0.5*e0**(p0/2.)); | |
|
816 | m0u=numpy.exp(-0.5*e0u**(p0/2.)); | |
|
817 | m0d=numpy.exp(-0.5*e0d**(p0/2.)) | |
|
818 | JA=m0+m0u+m0d | |
|
819 | JP=(-1/4.)*a0*m0*e0**(p0/2.)*numpy.log(e0)+(-1/4.)*a0*m0u*e0u**(p0/2.)*numpy.log(e0u)+(-1/4.)*a0*m0d*e0d**(p0/2.)*numpy.log(e0d) | |
|
820 | ||
|
821 | JS=(p0/w0/2.)*a0*m0*e0**(p0/2.-1)*((x-s0)/w0)+(p0/w0/2.)*a0*m0u*e0u**(p0/2.-1)*((x-s0- self.Num_Bin )/w0)+(p0/w0/2.)*a0*m0d*e0d**(p0/2.-1)*((x-s0+ self.Num_Bin )/w0) | |
|
822 | ||
|
823 | JW=(p0/w0/2.)*a0*m0*e0**(p0/2.-1)*((x-s0)/w0)**2+(p0/w0/2.)*a0*m0u*e0u**(p0/2.-1)*((x-s0- self.Num_Bin )/w0)**2+(p0/w0/2.)*a0*m0d*e0d**(p0/2.-1)*((x-s0+ self.Num_Bin )/w0)**2 | |
|
824 | jack1=numpy.sqrt(7)*numpy.array([JS/y_model,JW/y_model,JA/y_model,JP/y_model,1./y_model]) | |
|
825 | return jack1.T | |
|
826 | ||
|
827 | def y_jacobian2(self,x,state): | |
|
828 | y_model=self.y_model2(x,state) | |
|
829 | s0,w0,a0,p0,s1,w1,a1,p1,n=state | |
|
830 | e0=((x-s0)/w0)**2; | |
|
831 | ||
|
832 | e0u=((x-s0- self.Num_Bin )/w0)**2; | |
|
833 | ||
|
834 | e0d=((x-s0+ self.Num_Bin )/w0)**2 | |
|
835 | e1=((x-s1)/w1)**2; | |
|
836 | ||
|
837 | e1u=((x-s1- self.Num_Bin )/w1)**2; | |
|
838 | ||
|
839 | e1d=((x-s1+ self.Num_Bin )/w1)**2 | |
|
840 | m0=numpy.exp(-0.5*e0**(p0/2.)); | |
|
841 | m0u=numpy.exp(-0.5*e0u**(p0/2.)); | |
|
842 | m0d=numpy.exp(-0.5*e0d**(p0/2.)) | |
|
843 | m1=numpy.exp(-0.5*e1**(p1/2.)); | |
|
844 | m1u=numpy.exp(-0.5*e1u**(p1/2.)); | |
|
845 | m1d=numpy.exp(-0.5*e1d**(p1/2.)) | |
|
846 | JA=m0+m0u+m0d | |
|
847 | JA1=m1+m1u+m1d | |
|
848 | JP=(-1/4.)*a0*m0*e0**(p0/2.)*numpy.log(e0)+(-1/4.)*a0*m0u*e0u**(p0/2.)*numpy.log(e0u)+(-1/4.)*a0*m0d*e0d**(p0/2.)*numpy.log(e0d) | |
|
849 | JP1=(-1/4.)*a1*m1*e1**(p1/2.)*numpy.log(e1)+(-1/4.)*a1*m1u*e1u**(p1/2.)*numpy.log(e1u)+(-1/4.)*a1*m1d*e1d**(p1/2.)*numpy.log(e1d) | |
|
850 | ||
|
851 | JS=(p0/w0/2.)*a0*m0*e0**(p0/2.-1)*((x-s0)/w0)+(p0/w0/2.)*a0*m0u*e0u**(p0/2.-1)*((x-s0- self.Num_Bin )/w0)+(p0/w0/2.)*a0*m0d*e0d**(p0/2.-1)*((x-s0+ self.Num_Bin )/w0) | |
|
852 | ||
|
853 | JS1=(p1/w1/2.)*a1*m1*e1**(p1/2.-1)*((x-s1)/w1)+(p1/w1/2.)*a1*m1u*e1u**(p1/2.-1)*((x-s1- self.Num_Bin )/w1)+(p1/w1/2.)*a1*m1d*e1d**(p1/2.-1)*((x-s1+ self.Num_Bin )/w1) | |
|
854 | ||
|
855 | JW=(p0/w0/2.)*a0*m0*e0**(p0/2.-1)*((x-s0)/w0)**2+(p0/w0/2.)*a0*m0u*e0u**(p0/2.-1)*((x-s0- self.Num_Bin )/w0)**2+(p0/w0/2.)*a0*m0d*e0d**(p0/2.-1)*((x-s0+ self.Num_Bin )/w0)**2 | |
|
856 | ||
|
857 | JW1=(p1/w1/2.)*a1*m1*e1**(p1/2.-1)*((x-s1)/w1)**2+(p1/w1/2.)*a1*m1u*e1u**(p1/2.-1)*((x-s1- self.Num_Bin )/w1)**2+(p1/w1/2.)*a1*m1d*e1d**(p1/2.-1)*((x-s1+ self.Num_Bin )/w1)**2 | |
|
858 | jack2=numpy.sqrt(7)*numpy.array([JS/y_model,JW/y_model,JA/y_model,JP/y_model,JS1/y_model,JW1/y_model,JA1/y_model,JP1/y_model,1./y_model]) | |
|
859 | return jack2.T | |
|
860 | ||
|
861 | def y_model1(self,x,state): | |
|
862 | shift0,width0,amplitude0,power0,noise=state | |
|
863 | model0=amplitude0*numpy.exp(-0.5*abs((x-shift0)/width0)**power0) | |
|
864 | ||
|
865 | model0u=amplitude0*numpy.exp(-0.5*abs((x-shift0- self.Num_Bin )/width0)**power0) | |
|
866 | ||
|
867 | model0d=amplitude0*numpy.exp(-0.5*abs((x-shift0+ self.Num_Bin )/width0)**power0) | |
|
868 | return model0+model0u+model0d+noise | |
|
869 | ||
|
870 | def y_model2(self,x,state): #Equation for two generalized Gaussians with Nyquist | |
|
871 | shift0,width0,amplitude0,power0,shift1,width1,amplitude1,power1,noise=state | |
|
872 | model0=amplitude0*numpy.exp(-0.5*abs((x-shift0)/width0)**power0) | |
|
873 | ||
|
874 | model0u=amplitude0*numpy.exp(-0.5*abs((x-shift0- self.Num_Bin )/width0)**power0) | |
|
875 | ||
|
876 | model0d=amplitude0*numpy.exp(-0.5*abs((x-shift0+ self.Num_Bin )/width0)**power0) | |
|
877 | model1=amplitude1*numpy.exp(-0.5*abs((x-shift1)/width1)**power1) | |
|
878 | ||
|
879 | model1u=amplitude1*numpy.exp(-0.5*abs((x-shift1- self.Num_Bin )/width1)**power1) | |
|
880 | ||
|
881 | model1d=amplitude1*numpy.exp(-0.5*abs((x-shift1+ self.Num_Bin )/width1)**power1) | |
|
882 | return model0+model0u+model0d+model1+model1u+model1d+noise | |
|
883 | ||
|
884 | def misfit1(self,state,y_data,x,num_intg): # This function compares how close real data is with the model data, the close it is, the better it is. | |
|
885 | ||
|
886 | return num_intg*sum((numpy.log(y_data)-numpy.log(self.y_model1(x,state)))**2)#/(64-5.) # /(64-5.) can be commented | |
|
887 | ||
|
888 | def misfit2(self,state,y_data,x,num_intg): | |
|
889 | return num_intg*sum((numpy.log(y_data)-numpy.log(self.y_model2(x,state)))**2)#/(64-9.) | |
|
135 | 890 |
|
|
136 | 891 | |
|
137 | 892 |
|
|
138 | 893 |
|
|
139 | 894 | ''' |
|
140 |
|
|
|
895 | Operator that estimates Reflectivity factor (Z), and estimates rainfall Rate (R) | |
|
141 | 896 | |
|
142 | 897 | Input: |
|
143 | 898 | self.dataOut.data_pre : SelfSpectra |
|
144 | 899 | |
|
145 | ||
|
146 | ||
|
147 | Output: | |
|
900 | Output: | |
|
148 | 901 | |
|
149 | 902 | self.dataOut.data_output : Reflectivity factor, rainfall Rate |
|
150 | 903 | |
|
151 | 904 | |
|
152 |
Parameters affected: |
|
|
905 | Parameters affected: | |
|
153 | 906 | ''' |
|
907 | ||
|
154 | 908 |
|
|
155 | def run(self, dataOut): | |
|
909 | def run(self, dataOut, radar=None, Pt=None, Gt=None, Gr=None, Lambda=None, aL=None, | |
|
910 | tauW=None, ThetaT=None, ThetaR=None, Km = 0.93, Altitude=None): | |
|
156 | 911 |
|
|
157 | #numpy.set_printoptions(threshold=numpy.NaN) | |
|
912 | self.spc = dataOut.data_pre[0].copy() | |
|
913 | self.Num_Hei = self.spc.shape[2] | |
|
914 | self.Num_Bin = self.spc.shape[1] | |
|
915 | self.Num_Chn = self.spc.shape[0] | |
|
158 | 916 |
|
|
159 | spc = dataOut.data_pre[0].copy() | |
|
160 | NPW = dataOut.NPW | |
|
161 | COFA = dataOut.COFA | |
|
162 | #print 'COFA',COFA.shape | |
|
163 | #spc = numpy.where(spc<0,spc, numpy.NaN ) | |
|
917 | Velrange = dataOut.abscissaList | |
|
918 | ||
|
919 | if radar == "MIRA35C" : | |
|
920 | ||
|
921 | Ze = self.dBZeMODE2(dataOut) | |
|
922 | ||
|
923 | else: | |
|
924 | ||
|
925 | self.Pt = Pt | |
|
926 | self.Gt = Gt | |
|
927 | self.Gr = Gr | |
|
928 | self.Lambda = Lambda | |
|
929 | self.aL = aL | |
|
930 | self.tauW = tauW | |
|
931 | self.ThetaT = ThetaT | |
|
932 | self.ThetaR = ThetaR | |
|
933 | ||
|
934 | RadarConstant = GetRadarConstant() | |
|
935 | SPCmean = numpy.mean(self.spc,0) | |
|
936 | ETA = numpy.zeros(self.Num_Hei) | |
|
937 | Pr = numpy.sum(SPCmean,0) | |
|
938 | ||
|
939 | #for R in range(self.Num_Hei): | |
|
940 | # ETA[R] = RadarConstant * Pr[R] * R**2 #Reflectivity (ETA) | |
|
941 | ||
|
942 | D_range = numpy.zeros(self.Num_Hei) | |
|
943 | EqSec = numpy.zeros(self.Num_Hei) | |
|
944 | del_V = numpy.zeros(self.Num_Hei) | |
|
945 | ||
|
946 | for R in range(self.Num_Hei): | |
|
947 | ETA[R] = RadarConstant * Pr[R] * R**2 #Reflectivity (ETA) | |
|
948 | ||
|
949 | h = R + Altitude #Range from ground to radar pulse altitude | |
|
950 | del_V[R] = 1 + 3.68 * 10**-5 * h + 1.71 * 10**-9 * h**2 #Density change correction for velocity | |
|
951 | ||
|
952 | D_range[R] = numpy.log( (9.65 - (Velrange[R]/del_V[R])) / 10.3 ) / -0.6 #Range of Diameter of drops related to velocity | |
|
953 | SIGMA[R] = numpy.pi**5 / Lambda**4 * Km * D_range[R]**6 #Equivalent Section of drops (sigma) | |
|
954 | ||
|
955 | N_dist[R] = ETA[R] / SIGMA[R] | |
|
956 | ||
|
957 | Ze = (ETA * Lambda**4) / (numpy.pi * Km) | |
|
958 | Z = numpy.sum( N_dist * D_range**6 ) | |
|
959 | RR = 6*10**-4*numpy.pi * numpy.sum( D_range**3 * N_dist * Velrange ) #Rainfall rate | |
|
164 | 960 |
|
|
165 | SNR = numpy.array([spc[0,:,:] / NPW[0] , spc[1,:,:] / NPW[1]]) | |
|
166 | 961 |
|
|
962 | RR = (Ze/200)**(1/1.6) | |
|
963 | dBRR = 10*numpy.log10(RR) | |
|
167 | 964 |
|
|
168 | #print 'SNR',SNR.shape | |
|
169 | #print ' ' | |
|
965 | dBZe = 10*numpy.log10(Ze) | |
|
966 | dataOut.data_output = Ze | |
|
967 | dataOut.data_param = numpy.ones([2,self.Num_Hei]) | |
|
968 | dataOut.channelList = [0,1] | |
|
969 | print 'channelList', dataOut.channelList | |
|
970 | dataOut.data_param[0]=dBZe | |
|
971 | dataOut.data_param[1]=dBRR | |
|
972 | print 'RR SHAPE', dBRR.shape | |
|
973 | print 'Ze SHAPE', dBZe.shape | |
|
974 | print 'dataOut.data_param SHAPE', dataOut.data_param.shape | |
|
975 | ||
|
976 | ||
|
977 | def dBZeMODE2(self, dataOut): # Processing for MIRA35C | |
|
978 | ||
|
979 | NPW = dataOut.NPW | |
|
980 | COFA = dataOut.COFA | |
|
981 | ||
|
982 | SNR = numpy.array([self.spc[0,:,:] / NPW[0]]) #, self.spc[1,:,:] / NPW[1]]) | |
|
170 | 983 |
|
|
171 | 984 |
|
|
172 | #Lambda = SPEED_OF_LIGHT/frequency | |
|
173 | ||
|
174 | Num_Hei = spc.shape[2] | |
|
175 | Num_Bin = spc.shape[1] | |
|
176 | Num_Chn = spc.shape[0] | |
|
177 | ETA = numpy.zeros(([Num_Chn ,Num_Hei])) | |
|
178 | data_output = numpy.ones([Num_Chn ,Num_Hei])*numpy.NaN | |
|
179 | 985 |
|
|
180 | Km = 0.93 | |
|
986 | ETA = numpy.zeros(([self.Num_Chn ,self.Num_Hei])) | |
|
987 | data_output = numpy.ones([self.Num_Chn , self.Num_Hei])*numpy.NaN | |
|
181 | 988 |
|
|
182 | 989 |
|
|
183 | ETA = numpy.where(ETA > 0. , ETA, numpy.NaN) | |
|
990 | print 'ETA' , ETA | |
|
991 | ETA = numpy.where(ETA is not 0. , ETA, numpy.NaN) | |
|
184 | 992 |
|
|
185 |
|
|
|
993 | Ze = numpy.ones([self.Num_Chn, self.Num_Hei] ) | |
|
186 | 994 |
|
|
187 |
|
|
|
995 | for r in range(self.Num_Hei): | |
|
188 | 996 |
|
|
189 | 997 |
|
|
190 |
|
|
|
998 | #Ze[1,r] = ( ETA[1,r] ) * COFA[1,r][0] * RadarConst * ((r/5000.)**2) | |
|
191 | 999 |
|
|
1000 | return Ze | |
|
1001 | ||
|
1002 | def GetRadarConstant(self): | |
|
1003 | ||
|
1004 | """ | |
|
1005 | Constants: | |
|
192 | 1006 |
|
|
193 | dBZe = 10*numpy.log10(Ze) | |
|
194 | dataOut.data_output = Ze | |
|
195 | dataOut.data_param = dBZe | |
|
1007 | Pt: Transmission Power dB | |
|
1008 | Gt: Transmission Gain dB | |
|
1009 | Gr: Reception Gain dB | |
|
1010 | Lambda: Wavelenght m | |
|
1011 | aL: Attenuation loses dB | |
|
1012 | tauW: Width of transmission pulse s | |
|
1013 | ThetaT: Transmission antenna bean angle rad | |
|
1014 | ThetaR: Reception antenna beam angle rad | |
|
196 | 1015 |
|
|
197 | print 'dBZe',dBZe[0,:] | |
|
1016 | """ | |
|
1017 | Numerator = ( (4*numpy.pi)**3 * aL**2 * 16 * numpy.log(2) ) | |
|
1018 | Denominator = ( Pt * Gt * Gr * Lambda**2 * SPEED_OF_LIGHT * TauW * numpy.pi * ThetaT * TheraR) | |
|
1019 | RadarConstant = Numerator / Denominator | |
|
1020 | ||
|
1021 | return RadarConstant | |
|
198 | 1022 |
|
|
199 | ||
|
200 | 1023 |
|
|
201 | 1024 |
|
|
202 | 1025 |
|
@@ -218,7 +1041,7 class FullSpectralAnalysis(Operation): | |||
|
218 | 1041 | Parameters affected: Winds, height range, SNR |
|
219 | 1042 | |
|
220 | 1043 | """ |
|
221 | def run(self, dataOut): | |
|
1044 | def run(self, dataOut, E01=None, E02=None, E12=None, N01=None, N02=None, N12=None): | |
|
222 | 1045 |
|
|
223 | 1046 |
|
|
224 | 1047 |
|
@@ -227,9 +1050,18 class FullSpectralAnalysis(Operation): | |||
|
227 | 1050 |
|
|
228 | 1051 |
|
|
229 | 1052 |
|
|
230 |
|
|
|
231 |
|
|
|
232 | VelRange= dataOut.VelRange | |
|
1053 | pairsList = dataOut.groupList | |
|
1054 | if dataOut.ChanDist is not None : | |
|
1055 | ChanDist = dataOut.ChanDist | |
|
1056 | else: | |
|
1057 | ChanDist = numpy.array([[E01, N01],[E02,N02],[E12,N12]]) | |
|
1058 | ||
|
1059 | #print 'ChanDist', ChanDist | |
|
1060 | ||
|
1061 | if dataOut.VelRange is not None: | |
|
1062 | VelRange= dataOut.VelRange | |
|
1063 | else: | |
|
1064 | VelRange= dataOut.abscissaList | |
|
233 | 1065 |
|
|
234 | 1066 |
|
|
235 | 1067 |
|
@@ -240,6 +1072,7 class FullSpectralAnalysis(Operation): | |||
|
240 | 1072 |
|
|
241 | 1073 |
|
|
242 | 1074 |
|
|
1075 | print 'noise',noise | |
|
243 | 1076 |
|
|
244 | 1077 |
|
|
245 | 1078 |
|
@@ -257,20 +1090,20 class FullSpectralAnalysis(Operation): | |||
|
257 | 1090 |
|
|
258 | 1091 |
|
|
259 | 1092 |
|
|
260 | ||
|
261 | ||
|
262 | 1093 |
|
|
263 | 1094 |
|
|
264 |
|
|
|
1095 | if abs(Vzon)<100. and abs(Vzon)> 0.: | |
|
265 | 1096 |
|
|
266 | 1097 |
|
|
267 | 1098 |
|
|
1099 | print 'Vzon',Vzon | |
|
268 | 1100 |
|
|
269 | ||
|
270 |
|
|
|
1101 | ||
|
1102 | if abs(Vmer)<100. and abs(Vmer) > 0.: | |
|
271 | 1103 |
|
|
272 | 1104 |
|
|
273 | 1105 |
|
|
1106 | print 'Vmer',Vmer | |
|
274 | 1107 |
|
|
275 | 1108 |
|
|
276 | 1109 |
|
@@ -278,10 +1111,10 class FullSpectralAnalysis(Operation): | |||
|
278 | 1111 |
|
|
279 | 1112 |
|
|
280 | 1113 |
|
|
281 | if SNRdBMean[Height] <12: | |
|
282 | FirstMoment[Height] = numpy.NaN | |
|
283 | velocityX[Height] = numpy.NaN | |
|
284 | velocityY[Height] = numpy.NaN | |
|
1114 | # if SNRdBMean[Height] <12: | |
|
1115 | # FirstMoment[Height] = numpy.NaN | |
|
1116 | # velocityX[Height] = numpy.NaN | |
|
1117 | # velocityY[Height] = numpy.NaN | |
|
285 | 1118 |
|
|
286 | 1119 |
|
|
287 | 1120 |
|
@@ -291,8 +1124,9 class FullSpectralAnalysis(Operation): | |||
|
291 | 1124 |
|
|
292 | 1125 |
|
|
293 | 1126 |
|
|
1127 | print 'velocityX',data_output[0] | |
|
294 | 1128 |
|
|
295 |
|
|
|
1129 | print 'velocityY',data_output[1] | |
|
296 | 1130 |
|
|
297 | 1131 |
|
|
298 | 1132 |
|
@@ -309,7 +1143,7 class FullSpectralAnalysis(Operation): | |||
|
309 | 1143 |
|
|
310 | 1144 |
|
|
311 | 1145 |
|
|
312 |
|
|
|
1146 | return a*numpy.exp(-(xSamples-x0)**2/(2*sigma**2)) | |
|
313 | 1147 |
|
|
314 | 1148 |
|
|
315 | 1149 |
|
@@ -353,9 +1187,17 class FullSpectralAnalysis(Operation): | |||
|
353 | 1187 |
|
|
354 | 1188 |
|
|
355 | 1189 |
|
|
356 |
|
|
|
1190 | ||
|
1191 | print ' ' | |
|
1192 | print ' ' | |
|
1193 | print ' ' | |
|
1194 | print 'SmoothSPC',SmoothSPC | |
|
1195 | print 'noise',noise | |
|
1196 | print'zline',zline | |
|
1197 | print'FactNorm',FactNorm | |
|
1198 | ||
|
357 | 1199 |
|
|
358 |
|
|
|
1200 | ||
|
359 | 1201 | '''****** Line of Data CSPC ******''' |
|
360 | 1202 |
|
|
361 | 1203 |
|
@@ -372,6 +1214,8 class FullSpectralAnalysis(Operation): | |||
|
372 | 1214 |
|
|
373 | 1215 |
|
|
374 | 1216 |
|
|
1217 | ||
|
1218 | print 'CSPCSamples', CSPCSamples | |
|
375 | 1219 |
|
|
376 | 1220 | '''****** Getting fij width ******''' |
|
377 | 1221 |
|
@@ -385,7 +1229,15 class FullSpectralAnalysis(Operation): | |||
|
385 | 1229 |
|
|
386 | 1230 |
|
|
387 | 1231 |
|
|
388 | if (abs(meanGauss/sigma**2) > 0.00001) : | |
|
1232 | print '****************************' | |
|
1233 | print 'len(xSamples): ',len(xSamples) | |
|
1234 | print 'yMean: ', yMean | |
|
1235 | print 'ySamples', ySamples | |
|
1236 | print 'xSamples: ',xSamples | |
|
1237 | ||
|
1238 | print 'meanGauss',meanGauss | |
|
1239 | print 'sigma',sigma | |
|
1240 | if (abs(meanGauss/sigma**2) > 0.000000001):#0.00001) : | |
|
389 | 1241 |
|
|
390 | 1242 |
|
|
391 | 1243 |
|
@@ -399,7 +1251,7 class FullSpectralAnalysis(Operation): | |||
|
399 | 1251 |
|
|
400 | 1252 |
|
|
401 | 1253 |
|
|
402 |
|
|
|
1254 | ||
|
403 | 1255 |
|
|
404 | 1256 |
|
|
405 | 1257 |
|
@@ -474,12 +1326,13 class FullSpectralAnalysis(Operation): | |||
|
474 | 1326 |
|
|
475 | 1327 |
|
|
476 | 1328 |
|
|
1329 | ||
|
477 | 1330 |
|
|
478 | 1331 |
|
|
479 | 1332 |
|
|
480 | 1333 |
|
|
481 | 1334 |
|
|
482 | ||
|
1335 | print 'vzon y vmer', Vzon, Vmer | |
|
483 | 1336 |
|
|
484 | 1337 |
|
|
485 | 1338 |
|
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -902,3 +902,4 class IncohInt(Operation): | |||
|
902 | 902 | dataOut.nIncohInt *= self.n |
|
903 | 903 | dataOut.utctime = avgdatatime |
|
904 | 904 | dataOut.flagNoData = False |
|
905 |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,1 +1,1 | |||
|
1 |
<Project description="Reader/Writer experiment" id="196" name="test01"><ReadUnit datatype="BLTRReader" id="1961" inputId="0" name="BLTRReader"><Operation id="19611" name="run" priority="1" type="self"><Parameter format="str" id="196111" name="datatype" value="BLTRReader" /><Parameter format="str" id="196112" name="path" value="/home/erick/Documents/Data" /><Parameter format="date" id="196113" name="startDate" value="2016/10/19" /><Parameter format="date" id="196114" name="endDate" value="2016/10/19" /><Parameter format="time" id="196115" name="startTime" value="00:00:00" /><Parameter format="time" id="196116" name="endTime" value="23:59:59" /><Parameter format="int" id="19611 |
|
|
1 | <Project description="Reader/Writer experiment" id="196" name="test01"><ReadUnit datatype="BLTRReader" id="1961" inputId="0" name="BLTRReader"><Operation id="19611" name="run" priority="1" type="self"><Parameter format="str" id="196111" name="datatype" value="BLTRReader" /><Parameter format="str" id="196112" name="path" value="/home/erick/Documents/Data" /><Parameter format="date" id="196113" name="startDate" value="2016/10/19" /><Parameter format="date" id="196114" name="endDate" value="2016/10/19" /><Parameter format="time" id="196115" name="startTime" value="00:00:00" /><Parameter format="time" id="196116" name="endTime" value="23:59:59" /><Parameter format="int" id="196118" name="walk" value="1" /></Operation></ReadUnit><ProcUnit datatype="BLTRProc" id="1962" inputId="1961" name="BLTRProc"><Operation id="19621" name="run" priority="1" type="self" /><Operation id="19622" name="PrintInfo" priority="2" type="other" /></ProcUnit></Project> No newline at end of file |
@@ -83,7 +83,7 opObj11.addParameter(name='n', value='6', format='float') | |||
|
83 | 83 | |
|
84 | 84 | opObj11 = procUnitConfObj1.addOperation(name='SpectraWriter', optype='other') |
|
85 | 85 | opObj11.addParameter(name='path', value='/home/alex/Downloads/pdata_hf') |
|
86 | opObj11.addParameter(name='blocksPerFile', value='1', format='int') | |
|
86 | opObj11.addParameter(name='blocksPerFile', value='1000', format='int') | |
|
87 | 87 | # |
|
88 | 88 | # |
|
89 | 89 | # # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -14,30 +14,36 if __name__ == '__main__': | |||
|
14 | 14 | controllerObj = Project() |
|
15 | 15 | controllerObj.setup(id='191', name='test01', description=desc) |
|
16 | 16 | |
|
17 |
proc1 = controllerObj.addProcUnit(name='Receiver |
|
|
17 | proc1 = controllerObj.addProcUnit(name='PlotterReceiver') | |
|
18 | 18 | proc1.addParameter(name='realtime', value='0', format='bool') |
|
19 |
proc1.addParameter(name='plottypes', value='rti |
|
|
20 |
proc1.addParameter(name='throttle', value=' |
|
|
21 |
proc1.addParameter(name=' |
|
|
19 | proc1.addParameter(name='plottypes', value='rti', format='str') | |
|
20 | proc1.addParameter(name='throttle', value='2', format='int') | |
|
21 | proc1.addParameter(name='server', value='erick2', format='str') | |
|
22 | # proc1.addParameter(name='interactive', value='0', format='bool') | |
|
22 | 23 | # proc1.addParameter(name='server', value='tcp://10.10.10.82:7000', format='str') |
|
23 | 24 | ## TODO Agregar direccion de server de publicacion a graficos como variable |
|
24 | 25 | |
|
25 | 26 | op1 = proc1.addOperation(name='PlotRTIData', optype='other') |
|
26 |
op1.addParameter(name='wintitle', value=' |
|
|
27 |
op1.addParameter(name='save', value='/home/ |
|
|
27 | op1.addParameter(name='wintitle', value='MIRA35c RTI', format='str') | |
|
28 | op1.addParameter(name='save', value='/home/erick/Pictures', format='str') | |
|
28 | 29 | op1.addParameter(name='show', value='0', format='bool') |
|
29 | 30 | op1.addParameter(name='colormap', value='jet', format='str') |
|
31 | op1.addParameter(name='zmin', value='-90', format='int') | |
|
32 | op1.addParameter(name='zmax', value='-40', format='int') | |
|
33 | #op1.addParameter(name='xrange', value='1', format='int') | |
|
34 | #op1.addParameter(name='xmin', value='23', format='int') | |
|
35 | #op1.addParameter(name='xmax', value='3', format='int') | |
|
30 | 36 | # |
|
31 | op2 = proc1.addOperation(name='PlotCOHData', optype='other') | |
|
32 | op2.addParameter(name='wintitle', value='Julia 150Km', format='str') | |
|
33 | op2.addParameter(name='save', value='/home/nanosat/Pictures', format='str') | |
|
34 | op2.addParameter(name='colormap', value='jet', format='str') | |
|
35 | op2.addParameter(name='show', value='0', format='bool') | |
|
36 | # # # | |
|
37 | op6 = proc1.addOperation(name='PlotPHASEData', optype='other') | |
|
38 | op6.addParameter(name='wintitle', value='Julia 150Km', format='str') | |
|
39 | op6.addParameter(name='save', value='/home/nanosat/Pictures', format='str') | |
|
40 | op6.addParameter(name='show', value='1', format='bool') | |
|
37 | # op2 = proc1.addOperation(name='PlotCOHData', optype='other') | |
|
38 | # op2.addParameter(name='wintitle', value='Julia 150Km', format='str') | |
|
39 | # op2.addParameter(name='save', value='/home/nanosat/Pictures', format='str') | |
|
40 | # op2.addParameter(name='colormap', value='jet', format='str') | |
|
41 | # op2.addParameter(name='show', value='0', format='bool') | |
|
42 | # # # # | |
|
43 | # op6 = proc1.addOperation(name='PlotPHASEData', optype='other') | |
|
44 | # op6.addParameter(name='wintitle', value='Julia 150Km', format='str') | |
|
45 | # op6.addParameter(name='save', value='/home/nanosat/Pictures', format='str') | |
|
46 | # op6.addParameter(name='show', value='1', format='bool') | |
|
41 | 47 | # # |
|
42 | 48 | # # proc2 = controllerObj.addProcUnit(name='ReceiverData') |
|
43 | 49 | # # proc2.addParameter(name='server', value='juanca', format='str') |
@@ -1,1 +1,1 | |||
|
1 | <Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="Spectra" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/data/sp1_f0" /><Parameter format="date" id="191113" name="startDate" value="2017/01/28" /><Parameter format="date" id="191114" name="endDate" value="2017/01/28" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="cursor" value="5" /><Parameter format="int" id="191119" name="skip" value="177" /><Parameter format="int" id="191120" name="walk" value="1" /><Parameter format="int" id="191121" name="verbose" value="1" /><Parameter format="int" id="191122" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="Parameters" id="1913" inputId="1911" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralMoments" priority="2" type="other" /><Operation id="19133" name="PublishData" priority="3" type="other"><Parameter format="int" id="191331" name="zeromq" value="1" /><Parameter format="bool" id="191332" name="verbose" value="0" /><Parameter format="int" id="191333" name="delay" value="0" /></Operation></ProcUnit><ProcUnit datatype="Spectra" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /></ProcUnit></Project> No newline at end of file | |
|
1 | <Project description="Segundo Test" id="191" name="test01"><ReadUnit datatype="VoltageReader" id="1911" inputId="0" name="VoltageReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="VoltageReader" /><Parameter format="str" id="191112" name="path" value="/home/erick/Documents/Data/Claire_Data/raw" /><Parameter format="date" id="191113" name="startDate" value="2017/07/26" /><Parameter format="date" id="191114" name="endDate" value="2017/10/28" /><Parameter format="time" id="191115" name="startTime" value="09:40:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:00" /><Parameter format="int" id="191118" name="online" value="0" /><Parameter format="int" id="191119" name="walk" value="1" /></Operation><Operation id="19112" name="printNumberOfBlock" priority="2" type="self" /></ReadUnit><ProcUnit datatype="SpectraProc" id="1913" inputId="1912" name="SpectraProc"><Operation id="19131" name="run" priority="1" type="self"><Parameter format="int" id="191311" name="nFFTPoints" value="256" /><Parameter format="pairslist" id="191312" name="pairsList" value="(0,1),(0,2),(1,2)" /></Operation><Operation id="19132" name="removeDC" priority="2" type="self" /><Operation id="19133" name="IncohInt" priority="3" type="external"><Parameter format="float" id="191331" name="n" value="30" /></Operation><Operation id="19134" name="SpectraPlot" priority="4" type="external"><Parameter format="int" id="191341" name="id" value="11" /><Parameter format="str" id="191342" name="wintitle" value="SpectraPlot" /><Parameter format="str" id="191343" name="xaxis" value="velocity" /><Parameter format="int" id="191344" name="zmin" value="0" /><Parameter format="float" id="191345" name="ymin" value="1.5" /><Parameter format="int" id="191346" name="ymax" value="7" /><Parameter format="int" id="191347" name="zmax" value="40" /><Parameter format="int" id="191348" name="save" value="1" /></Operation><Operation id="19135" name="RTIPlot" priority="5" type="other"><Parameter format="int" id="191351" name="id" value="30" /><Parameter format="str" id="191352" name="wintitle" value="RTI" /><Parameter format="int" id="191353" name="zmin" value="0" /><Parameter format="int" id="191354" name="zmax" value="40" /><Parameter format="float" id="191355" name="ymin" value="1.5" /><Parameter format="int" id="191356" name="ymax" value="8" /><Parameter format="int" id="191357" name="showprofile" value="1" /><Parameter format="float" id="191358" name="xmin" value="0" /><Parameter format="float" id="191359" name="xmax" value="23.9" /><Parameter format="int" id="191360" name="save" value="1" /></Operation><Operation id="19136" name="CrossSpectraPlot" priority="6" type="other"><Parameter format="str" id="191361" name="phase_cmap" value="bwr" /><Parameter format="int" id="191362" name="id" value="2005" /><Parameter format="str" id="191363" name="wintitle" value="CrossSpectraPlot_ShortPulse" /><Parameter format="str" id="191364" name="xaxis" value="Velocity" /><Parameter format="float" id="191365" name="ymin" value="1.5" /><Parameter format="int" id="191366" name="ymax" value="7" /></Operation></ProcUnit><ProcUnit datatype="VoltageProc" id="1912" inputId="1911" name="VoltageProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="setRadarFrequency" priority="2" type="self"><Parameter format="float" id="191221" name="frequency" value="445.09e6" /></Operation><Operation id="19123" name="selectHeights" priority="3" type="self"><Parameter format="float" id="191231" name="minHei" value="0" /><Parameter format="float" id="191232" name="maxHei" value="64" /></Operation></ProcUnit><ProcUnit datatype="Parameters" id="1914" inputId="1913" name="ParametersProc"><Operation id="19141" name="run" priority="1" type="self" /><Operation id="19142" name="SpectralMoments" priority="2" type="other" /><Operation id="19143" name="FullSpectralAnalysis" priority="3" type="other"><Parameter format="float" id="191431" name="E01" value="1.5" /><Parameter format="float" id="191432" name="E02" value="1.5" /><Parameter format="float" id="191433" name="E12" value="0" /><Parameter format="float" id="191434" name="N01" value="0.875" /><Parameter format="float" id="191435" name="N02" value="-0.875" /><Parameter format="float" id="191436" name="N12" value="-1.75" /></Operation><Operation id="19144" name="WindProfilerPlot" priority="4" type="other"><Parameter format="int" id="191441" name="id" value="4" /><Parameter format="str" id="191442" name="wintitle" value="Wind Profiler" /><Parameter format="bool" id="191443" name="save" value="1" /><Parameter format="float" id="191444" name="ymin" value="1.5" /><Parameter format="int" id="191445" name="ymax" value="7" /><Parameter format="float" id="191446" name="zmin" value="-0.00" /><Parameter format="float" id="191447" name="zmax" value="1.1" /></Operation></ProcUnit></Project> No newline at end of file |
@@ -1,11 +1,11 | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | import os, sys |
|
3 | 3 | |
|
4 | path = os.path.dirname(os.getcwd()) | |
|
5 | path = os.path.join(path, 'source') | |
|
6 | sys.path.insert(0, '../') | |
|
4 | # path = os.path.dirname(os.getcwd()) | |
|
5 | # path = os.path.join(path, 'source') | |
|
6 | # sys.path.insert(0, '../') | |
|
7 | 7 | |
|
8 | from controller import Project | |
|
8 | from schainpy.controller import Project | |
|
9 | 9 | |
|
10 | 10 | xmin = '15.5' |
|
11 | 11 | xmax = '24' |
@@ -16,42 +16,42 filename = "ProcBLTR.xml" | |||
|
16 | 16 | controllerObj = Project() |
|
17 | 17 | |
|
18 | 18 | |
|
19 |
controllerObj.setup(id |
|
|
19 | controllerObj.setup(id='191', name='test01', description=desc) | |
|
20 | 20 | |
|
21 | 21 | readUnitConfObj = controllerObj.addReadUnit(datatype='BLTRReader', |
|
22 |
path='/home/erick/Documents/Data/BLTR_Data/fdt/', |
|
|
23 |
|
|
|
22 | path='/home/erick/Documents/Data/BLTR_Data/fdt/', | |
|
23 | ||
|
24 | 24 | endDate='2017/10/19', |
|
25 | 25 | startTime='13:00:00', |
|
26 | ||
|
26 | startDate='2016/11/8', | |
|
27 | 27 | endTime='23:59:59', |
|
28 | 28 | |
|
29 | 29 | |
|
30 | 30 | online=0, |
|
31 | 31 | walk=0, |
|
32 | 32 | ReadMode='1') |
|
33 | #expLabel='') | |
|
33 | # expLabel='') | |
|
34 | 34 | |
|
35 | #opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock') | |
|
35 | # opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock') | |
|
36 | 36 | |
|
37 | 37 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId()) |
|
38 | 38 | |
|
39 | 39 | |
|
40 | 40 | |
|
41 | 41 | opObj11 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') |
|
42 |
opObj11.addParameter(name='n', value=' |
|
|
42 | opObj11.addParameter(name='n', value='2', format='float') | |
|
43 | 43 | |
|
44 | 44 | opObj10 = procUnitConfObj1.addOperation(name='removeDC') |
|
45 | 45 | |
|
46 | #opObj10 = procUnitConfObj1.addOperation(name='calcMag') | |
|
46 | # opObj10 = procUnitConfObj1.addOperation(name='calcMag') | |
|
47 | 47 | |
|
48 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |
|
49 | opObj11.addParameter(name='id', value='21', format='int') | |
|
50 | opObj11.addParameter(name='wintitle', value='SpectraCutPlot', format='str') | |
|
51 | opObj11.addParameter(name='xaxis', value='frequency', format='str') | |
|
52 | opObj11.addParameter(name='colormap', value='winter', format='str') | |
|
53 | opObj11.addParameter(name='xmin', value='-0.005', format='float') | |
|
54 | opObj11.addParameter(name='xmax', value='0.005', format='float') | |
|
48 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |
|
49 | # opObj11.addParameter(name='id', value='21', format='int') | |
|
50 | # opObj11.addParameter(name='wintitle', value='SpectraCutPlot', format='str') | |
|
51 | # opObj11.addParameter(name='xaxis', value='frequency', format='str') | |
|
52 | # opObj11.addParameter(name='colormap', value='winter', format='str') | |
|
53 | # opObj11.addParameter(name='xmin', value='-0.005', format='float') | |
|
54 | # opObj11.addParameter(name='xmax', value='0.005', format='float') | |
|
55 | 55 | # #opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
56 | 56 | # #opObj10.addParameter(name='channelList', value='0,1', format='intlist') |
|
57 | 57 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
@@ -59,53 +59,53 opObj11.addParameter(name='xmax', value='0.005', format='float') | |||
|
59 | 59 | # opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') |
|
60 | 60 | # #opObj11.addParameter(name='xaxis', value='Velocity', format='str') |
|
61 | 61 | |
|
62 | #opObj11.addParameter(name='xaxis', value='velocity', format='str') | |
|
63 | #opObj11.addParameter(name='xmin', value='-0.005', format='float') | |
|
64 | #opObj11.addParameter(name='xmax', value='0.005', format='float') | |
|
62 | # opObj11.addParameter(name='xaxis', value='velocity', format='str') | |
|
63 | # opObj11.addParameter(name='xmin', value='-0.005', format='float') | |
|
64 | # opObj11.addParameter(name='xmax', value='0.005', format='float') | |
|
65 | 65 | |
|
66 | #opObj11.addParameter(name='ymin', value='225', format='float') | |
|
67 | #opObj11.addParameter(name='ymax', value='3000', format='float') | |
|
66 | # opObj11.addParameter(name='ymin', value='225', format='float') | |
|
67 | # opObj11.addParameter(name='ymax', value='3000', format='float') | |
|
68 | 68 | # opObj11.addParameter(name='zmin', value='-100', format='int') |
|
69 | 69 | # opObj11.addParameter(name='zmax', value='-65', format='int') |
|
70 | 70 | |
|
71 | #opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |
|
72 | #opObj11.addParameter(name='id', value='10', format='int') | |
|
73 | #opObj11.addParameter(name='wintitle', value='RTI', format='str') | |
|
71 | # opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |
|
72 | # opObj11.addParameter(name='id', value='10', format='int') | |
|
73 | # opObj11.addParameter(name='wintitle', value='RTI', format='str') | |
|
74 | 74 | # opObj11.addParameter(name='ymin', value='0', format='float') |
|
75 | 75 | # opObj11.addParameter(name='ymax', value='4000', format='float') |
|
76 | ##opObj11.addParameter(name='zmin', value='-100', format='int') | |
|
77 | ##opObj11.addParameter(name='zmax', value='-70', format='int') | |
|
76 | # #opObj11.addParameter(name='zmin', value='-100', format='int') | |
|
77 | # #opObj11.addParameter(name='zmax', value='-70', format='int') | |
|
78 | 78 | # opObj11.addParameter(name='zmin', value='-90', format='int') |
|
79 | 79 | # opObj11.addParameter(name='zmax', value='-40', format='int') |
|
80 | #opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
81 | #opObj11.addParameter(name='timerange', value=str(2*60*60), format='int') | |
|
82 | ||
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 | ||
|
96 | #procUnitConfObj2 = controllerObj.addProcUnit(datatype='CorrelationProc', inputId=procUnitConfObj1.getId()) | |
|
97 | #procUnitConfObj2.addParameter(name='pairsList', value='(0,1),(0,2),(1,2)', format='pairsList') | |
|
98 | ||
|
99 |
procUnitConfObj2 = controllerObj.addProcUnit(datatype='Parameters', inputId= |
|
|
80 | # opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
81 | # opObj11.addParameter(name='timerange', value=str(2*60*60), format='int') | |
|
82 | ||
|
83 | opObj11 = procUnitConfObj1.addOperation(name='CrossSpectraPlot', optype='other') | |
|
84 | procUnitConfObj1.addParameter(name='pairsList', value='(0,1),(0,2),(1,2)', format='pairsList') | |
|
85 | opObj11.addParameter(name='id', value='2005', format='int') | |
|
86 | opObj11.addParameter(name='wintitle', value='CrossSpectraPlot_ShortPulse', format='str') | |
|
87 | # opObj11.addParameter(name='exp_code', value='13', format='int') | |
|
88 | opObj11.addParameter(name='xaxis', value='Velocity', format='str') | |
|
89 | #opObj11.addParameter(name='xmin', value='-10', format='float') | |
|
90 | #opObj11.addParameter(name='xmax', value='10', format='float') | |
|
91 | #opObj11.addParameter(name='ymin', value='225', format='float') | |
|
92 | #opObj11.addParameter(name='ymax', value='3000', format='float') | |
|
93 | #opObj11.addParameter(name='phase_min', value='-4', format='int') | |
|
94 | #opObj11.addParameter(name='phase_max', value='4', format='int') | |
|
95 | ||
|
96 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='CorrelationProc', inputId=procUnitConfObj1.getId()) | |
|
97 | # procUnitConfObj2.addParameter(name='pairsList', value='(0,1),(0,2),(1,2)', format='pairsList') | |
|
98 | ||
|
99 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='Parameters', inputId=procUnitConfObj1.getId()) | |
|
100 | 100 | opObj11 = procUnitConfObj2.addOperation(name='SpectralMoments', optype='other') |
|
101 | 101 | opObj22 = procUnitConfObj2.addOperation(name='FullSpectralAnalysis', optype='other') |
|
102 | ||
|
102 | # | |
|
103 | 103 | opObj22 = procUnitConfObj2.addOperation(name='WindProfilerPlot', optype='other') |
|
104 | 104 | opObj22.addParameter(name='id', value='4', format='int') |
|
105 | 105 | opObj22.addParameter(name='wintitle', value='Wind Profiler', format='str') |
|
106 | 106 | opObj22.addParameter(name='save', value='1', format='bool') |
|
107 | 107 | # opObj22.addParameter(name='figpath', value = '/home/erick/Pictures', format='str') |
|
108 | ||
|
108 | ||
|
109 | 109 | opObj22.addParameter(name='zmin', value='-20', format='int') |
|
110 | 110 | opObj22.addParameter(name='zmax', value='20', format='int') |
|
111 | 111 | opObj22.addParameter(name='zmin_ver', value='-250', format='float') |
@@ -115,29 +115,32 opObj22.addParameter(name='SNRmax', value='30', format='int') | |||
|
115 | 115 | # opObj22.addParameter(name='SNRthresh', value='-3.5', format='float') |
|
116 | 116 | opObj22.addParameter(name='xmin', value=0, format='float') |
|
117 | 117 | opObj22.addParameter(name='xmax', value=24, format='float') |
|
118 |
|
|
|
118 | opObj22.addParameter(name='ymin', value='225', format='float') | |
|
119 | 119 | #opObj22.addParameter(name='ymax', value='2000', format='float') |
|
120 | ||
|
121 | ||
|
122 | # opObj11.addParameter(name='pairlist', value='(1,0),(0,2),(1,2)', format='pairsList') | |
|
123 | #opObj10 = procUnitConfObj1.addOperation(name='selectHeights') | |
|
124 | #opObj10.addParameter(name='minHei', value='225', format='float') | |
|
125 | #opObj10.addParameter(name='maxHei', value='1000', format='float') | |
|
126 | ||
|
127 | # opObj11 = procUnitConfObj1.addOperation(name='CoherenceMap', optype='other') | |
|
128 | # opObj11.addParameter(name='id', value='102', format='int') | |
|
129 | # opObj11.addParameter(name='wintitle', value='Coherence', format='str') | |
|
130 | # opObj11.addParameter(name='ymin', value='225', format='float') | |
|
131 | # opObj11.addParameter(name='ymax', value='4000', format='float') | |
|
132 | ||
|
133 | # opObj11.addParameter(name='phase_cmap', value='jet', format='str') | |
|
134 | # opObj11.addParameter(name='xmin', value='8.5', format='float') | |
|
135 | # opObj11.addParameter(name='xmax', value='9.5', format='float') | |
|
136 | # opObj11.addParameter(name='figpath', value=figpath, format='str') | |
|
137 | # opObj11.addParameter(name='save', value=1, format='bool') | |
|
138 | # opObj11.addParameter(name='pairsList', value='(1,0),(3,2)', format='pairsList') | |
|
139 | ||
|
140 | # opObj12 = procUnitConfObj1.addOperation(name='PublishData', optype='other') | |
|
141 | # opObj12.addParameter(name='zeromq', value=1, format='int') | |
|
142 | # opObj12.addParameter(name='verbose', value=0, format='bool') | |
|
143 | # opObj12.addParameter(name='server', value='erick2', format='str') | |
|
144 | controllerObj.start() | |
|
120 | 145 | |
|
121 | 146 | |
|
122 | # # opObj11.addParameter(name='pairlist', value='(1,0),(0,2),(1,2)', format='pairsList') | |
|
123 | # #opObj10 = procUnitConfObj1.addOperation(name='selectHeights') | |
|
124 | # #opObj10.addParameter(name='minHei', value='225', format='float') | |
|
125 | # #opObj10.addParameter(name='maxHei', value='1000', format='float') | |
|
126 | ||
|
127 | #opObj11 = procUnitConfObj1.addOperation(name='CoherenceMap', optype='other') | |
|
128 | #opObj11.addParameter(name='id', value='102', format='int') | |
|
129 | #opObj11.addParameter(name='wintitle', value='Coherence', format='str') | |
|
130 | #opObj11.addParameter(name='ymin', value='225', format='float') | |
|
131 | #opObj11.addParameter(name='ymax', value='4000', format='float') | |
|
132 | ||
|
133 | # # opObj11.addParameter(name='phase_cmap', value='jet', format='str') | |
|
134 | # # opObj11.addParameter(name='xmin', value='8.5', format='float') | |
|
135 | # # opObj11.addParameter(name='xmax', value='9.5', format='float') | |
|
136 | # # opObj11.addParameter(name='figpath', value=figpath, format='str') | |
|
137 | # # opObj11.addParameter(name='save', value=1, format='bool') | |
|
138 | # # opObj11.addParameter(name='pairsList', value='(1,0),(3,2)', format='pairsList') | |
|
139 | ||
|
140 | ||
|
141 | controllerObj.createObjects() | |
|
142 | controllerObj.connectObjects() | |
|
143 | controllerObj.run() |
@@ -17,9 +17,9 def main(): | |||
|
17 | 17 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
18 | 18 | |
|
19 | 19 | readUnitConfObj = controllerObj.addReadUnit(datatype='Spectra', |
|
20 |
path=' |
|
|
20 | path='/home/erick/Documents/Data/d2015106', | |
|
21 | 21 | startDate='2010/12/18', |
|
22 |
endDate='201 |
|
|
22 | endDate='2017/12/22', | |
|
23 | 23 | startTime='00:00:00', |
|
24 | 24 | endTime='23:59:59', |
|
25 | 25 | online=0, |
@@ -30,32 +30,70 def main(): | |||
|
30 | 30 | |
|
31 | 31 | opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
32 | 32 | opObj10.addParameter(name='channelList', value='0,1', format='intlist') |
|
33 | ||
|
34 | opObj10 = procUnitConfObj1.addOperation(name='selectHeights') | |
|
35 | opObj10.addParameter(name='minHei', value='90', format='float') | |
|
36 | opObj10.addParameter(name='maxHei', value='180', format='float') | |
|
33 | ||
|
34 | #opObj10 = procUnitConfObj1.addOperation(name='selectHeights') | |
|
35 | #opObj10.addParameter(name='minHei', value='90', format='float') | |
|
36 | #opObj10.addParameter(name='maxHei', value='180', format='float') | |
|
37 | 37 | |
|
38 | 38 | opObj10 = procUnitConfObj1.addOperation(name='removeDC') |
|
39 | 39 | |
|
40 | opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |
|
41 | opObj12.addParameter(name='n', value='1', format='int') | |
|
40 | #opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |
|
41 | #opObj12.addParameter(name='n', value='1', format='int') | |
|
42 | 42 | |
|
43 | 43 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
|
44 | 44 | opObj11.addParameter(name='id', value='1', format='int') |
|
45 | 45 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') |
|
46 | opObj11.addParameter(name='xaxis', value='velocity', format='str') | |
|
46 | 47 | opObj11.addParameter(name='showprofile', value='1', format='int') |
|
47 |
opObj11.addParameter(name='save', value=' |
|
|
48 |
opObj11.addParameter(name='figpath', value='/ |
|
|
49 | ||
|
50 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |
|
51 | opObj11.addParameter(name='id', value='10', format='int') | |
|
52 | opObj11.addParameter(name='wintitle', value='RTI', format='str') | |
|
48 | opObj11.addParameter(name='save', value='1', format='int') | |
|
49 | opObj11.addParameter(name='figpath', value='/home/erick/Documents/Data/d2015106') | |
|
50 | ||
|
51 | #opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |
|
52 | #opObj11.addParameter(name='id', value='10', format='int') | |
|
53 | #opObj11.addParameter(name='wintitle', value='RTI', format='str') | |
|
53 | 54 | # opObj11.addParameter(name='xmin', value='21', format='float') |
|
54 | 55 | # opObj11.addParameter(name='xmax', value='22', format='float') |
|
55 | opObj11.addParameter(name='zmin', value='12', format='int') | |
|
56 | opObj11.addParameter(name='zmax', value='32', format='int') | |
|
57 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
58 | opObj11.addParameter(name='timerange', value=str(2*60*60), format='int') | |
|
56 | #opObj11.addParameter(name='zmin', value='12', format='int') | |
|
57 | #opObj11.addParameter(name='zmax', value='32', format='int') | |
|
58 | #opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
59 | #opObj11.addParameter(name='timerange', value=str(2*60*60), format='int') | |
|
60 | ||
|
61 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='Parameters', inputId=readUnitConfObj.getId()) | |
|
62 | opObj11 = procUnitConfObj2.addOperation(name='GaussianFit', optype='other') | |
|
63 | opObj11.addParameter(name='vel_arr', value='32,0,0,0', format='intList') | |
|
64 | opObj11.addParameter(name='SNRlimit', value='-3', format='int') | |
|
65 | ||
|
66 | #opObj12 = procUnitConfObj2.addOperation(name='ParametersPlot', optype='other') | |
|
67 | #opObj12.addParameter(name='id',value='4',format='int') | |
|
68 | #opObj12.addParameter(name='wintitle',value='First_gg',format='str') | |
|
69 | ||
|
70 | opObj11 = procUnitConfObj2.addOperation(name='FitGauPlot', optype='other') | |
|
71 | opObj11.addParameter(name='id', value='21', format='int') | |
|
72 | opObj11.addParameter(name='wintitle', value='FitGauPlot', format='str') | |
|
73 | opObj11.addParameter(name='xaxis', value='frequency', format='str') | |
|
74 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
75 | opObj11.addParameter(name='zmin', value='-20', format='int') | |
|
76 | opObj11.addParameter(name='zmax', value='20', format='int') | |
|
77 | opObj11.addParameter(name='GauSelector', value='1', format='int') | |
|
78 | #opObj11.addParameter(name='save', value='1', format='int') | |
|
79 | #opObj11.addParameter(name='figpath', value='/home/erick/Documents/Data/d2015106') | |
|
80 | ||
|
81 | opObj11 = procUnitConfObj2.addOperation(name='FitGauPlot', optype='other') | |
|
82 | opObj11.addParameter(name='id', value='22', format='int') | |
|
83 | opObj11.addParameter(name='wintitle', value='FitGauPlot', format='str') | |
|
84 | opObj11.addParameter(name='xaxis', value='frequency', format='str') | |
|
85 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
86 | opObj11.addParameter(name='zmin', value='-20', format='int') | |
|
87 | opObj11.addParameter(name='zmax', value='20', format='int') | |
|
88 | opObj11.addParameter(name='GauSelector', value='0', format='int') | |
|
89 | ||
|
90 | #opObj11 = procUnitConfObj2.addOperation(name='SpectraPlot', optype='other') | |
|
91 | #opObj11.addParameter(name='id', value='55', format='int') | |
|
92 | #opObj11.addParameter(name='wintitle', value='SpectraPlot1', format='str') | |
|
93 | #opObj11.addParameter(name='xaxis', value='velocity', format='str') | |
|
94 | #opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
95 | #opObj11.addParameter(name='save', value='1', format='int') | |
|
96 | #opObj11.addParameter(name='figpath', value='/home/erick/Documents/Data/d2015106') | |
|
59 | 97 | |
|
60 | 98 | controllerObj.start() |
|
61 | 99 |
@@ -14,26 +14,25 desc = "ProcBLTR Test" | |||
|
14 | 14 | |
|
15 | 15 | |
|
16 | 16 | filename = "ProcBLTR.xml" |
|
17 | ||
|
17 | ||
|
18 | 18 | controllerObj = Project() |
|
19 | ||
|
20 | ||
|
19 | ||
|
20 | ||
|
21 | 21 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
22 | ||
|
22 | ||
|
23 | 23 | readUnitConfObj = controllerObj.addReadUnit(datatype='MIRA35CReader', |
|
24 | 24 | path='/home/erick/Documents/MIRA35C/20160117', |
|
25 | 25 | startDate='2016/11/8', |
|
26 | 26 | endDate='2017/10/19', |
|
27 | 27 | startTime='13:00:00', |
|
28 | ||
|
28 | ||
|
29 | 29 | endTime='23:59:59', |
|
30 | ||
|
31 | ||
|
30 | ||
|
31 | ||
|
32 | 32 | online=0, |
|
33 |
walk=0 |
|
|
34 |
|
|
|
35 | #expLabel='') | |
|
36 | ||
|
33 | walk=0) | |
|
34 | ||
|
35 | ||
|
37 | 36 | #opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock') |
|
38 | 37 | |
|
39 | 38 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId()) |
@@ -55,7 +54,7 opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |||
|
55 | 54 | opObj11.addParameter(name='id', value='21', format='int') |
|
56 | 55 | opObj11.addParameter(name='wintitle', value='SpectraCutPlot', format='str') |
|
57 | 56 | opObj11.addParameter(name='xaxis', value='velocity', format='str') |
|
58 |
opObj11.addParameter(name='colormap', value=' |
|
|
57 | opObj11.addParameter(name='colormap', value='nipy_spectral', format='str') | |
|
59 | 58 | opObj11.addParameter(name='normFactor', value='1', format='float') |
|
60 | 59 | #opObj11.addParameter(name='xaxis', value='velocity', format='str') |
|
61 | 60 | #opObj11.addParameter(name='xmin', value='-1.', format='float') |
@@ -67,7 +66,6 opObj11.addParameter(name='normFactor', value='1', format='float') | |||
|
67 | 66 | opObj11.addParameter(name='zmin', value='-20', format='int') |
|
68 | 67 | opObj11.addParameter(name='zmax', value='20', format='int') |
|
69 | 68 | |
|
70 | ||
|
71 | 69 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') |
|
72 | 70 | opObj11.addParameter(name='id', value='10', format='int') |
|
73 | 71 | opObj11.addParameter(name='wintitle', value='RTI', format='str') |
@@ -79,6 +77,8 opObj11.addParameter(name='normFactor', value='1', format='float') | |||
|
79 | 77 | #opObj11.addParameter(name='xmax', value='24', format='float') |
|
80 | 78 | opObj11.addParameter(name='zmin', value='-20', format='int') |
|
81 | 79 | opObj11.addParameter(name='zmax', value='20', format='int') |
|
80 | opObj11.addParameter(name='timerange', value='10800', format='int') | |
|
81 | opObj11.addParameter(name='HEIGHT', value='400', format='int') | |
|
82 | 82 | # opObj11.addParameter(name='zmin', value='-90', format='int') |
|
83 | 83 | # opObj11.addParameter(name='zmax', value='-40', format='int') |
|
84 | 84 | #opObj11.addParameter(name='showprofile', value='1', format='int') |
@@ -87,27 +87,35 opObj11.addParameter(name='zmax', value='20', format='int') | |||
|
87 | 87 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='Parameters', inputId=readUnitConfObj.getId()) |
|
88 | 88 | #opObj11 = procUnitConfObj2.addOperation(name='SpectralMoments', optype='other') |
|
89 | 89 | opObj22 = procUnitConfObj2.addOperation(name='PrecipitationProc', optype='other') |
|
90 | opObj22.addParameter(name='radar', value='MIRA35C', format='str') | |
|
90 | 91 | |
|
91 | 92 | opObj22 = procUnitConfObj2.addOperation(name='ParametersPlot', optype='other') |
|
92 | 93 | opObj22.addParameter(name='id', value='4', format='int') |
|
93 | 94 | opObj22.addParameter(name='wintitle', value='PrecipitationProc', format='str') |
|
94 | 95 | opObj22.addParameter(name='save', value='1', format='bool') |
|
95 |
opObj22.addParameter(name='colormap', value=' |
|
|
96 | opObj22.addParameter(name='colormap', value='nipy_spectral', format='str') | |
|
96 | 97 | # opObj22.addParameter(name='figpath', value = '/home/erick/Pictures', format='str') |
|
97 |
opObj22.addParameter(name='zmin', value='- |
|
|
98 | opObj22.addParameter(name='zmax', value='0', format='int') | |
|
98 | opObj22.addParameter(name='zmin', value='-60', format='int') | |
|
99 | opObj22.addParameter(name='zmax', value='-20', format='int') | |
|
100 | opObj22.addParameter(name='timerange', value='10800', format='int') | |
|
101 | #opObj22.addParameter(name='channelList', value='0', format='intlist') | |
|
102 | #opObj22.addParameter(name='colormap', value='nipy_spectral', format='str') | |
|
103 | opObj22.addParameter(name='HEIGHT', value='500', format='int') | |
|
99 | 104 | #opObj22.addParameter(name='zmin_ver', value='-250', format='float') |
|
100 | 105 | #opObj22.addParameter(name='zmax_ver', value='250', format='float') |
|
101 | 106 | #opObj22.addParameter(name='SNRmin', value='-5', format='int') |
|
102 | 107 | #opObj22.addParameter(name='SNRmax', value='30', format='int') |
|
103 | 108 | # opObj22.addParameter(name='SNRthresh', value='-3.5', format='float') |
|
104 | opObj22.addParameter(name='xmin', value=0, format='float') | |
|
105 | opObj22.addParameter(name='xmax', value=2, format='float') | |
|
109 | #opObj22.addParameter(name='xmin', value=0, format='float') | |
|
110 | #opObj22.addParameter(name='xmax', value=2, format='float') | |
|
106 | 111 | #opObj22.addParameter(name='ymin', value='225', format='float') |
|
107 | 112 | #opObj22.addParameter(name='ymax', value='5000', format='float') |
|
108 | 113 | |
|
114 | # opObj12 = procUnitConfObj1.addOperation(name='PublishData', optype='other') | |
|
115 | # opObj12.addParameter(name='zeromq', value=1, format='int') | |
|
116 | # opObj12.addParameter(name='verbose', value=0, format='bool') | |
|
117 | # opObj12.addParameter(name='server', value='Jose', format='str') | |
|
109 | 118 | |
|
110 | ||
|
111 |
controllerObj.c |
|
|
112 |
controllerObj. |
|
|
113 | controllerObj.run() | |
|
119 | #controllerObj.createObjects() | |
|
120 | #controllerObj.connectObjects() | |
|
121 | controllerObj.start() |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -41,7 +41,7 setup(name="schainpy", | |||
|
41 | 41 | scripts=['schainpy/gui/schainGUI'], |
|
42 | 42 | ext_modules=[Extension("cSchain", ["schainpy/model/proc/extensions.c"])], |
|
43 | 43 | install_requires=[ |
|
44 |
"scipy >= 0.1 |
|
|
44 | "scipy >= 0.13.0", | |
|
45 | 45 | "h5py >= 2.2.1", |
|
46 | 46 | "matplotlib >= 1.4.2", |
|
47 | 47 | "pyfits >= 3.4", |
General Comments 0
You need to be logged in to leave comments.
Login now