@@ -142,7 +142,7 class CrossSpectraPlot(Plot): | |||
|
142 | 142 | else: |
|
143 | 143 | x = self.data.xrange[2] |
|
144 | 144 | self.xlabel = "Velocity (m/s)" |
|
145 | ||
|
145 | ||
|
146 | 146 | self.titles = [] |
|
147 | 147 | |
|
148 | 148 | y = self.data.heights |
@@ -155,17 +155,17 class CrossSpectraPlot(Plot): | |||
|
155 | 155 | pair = self.data.pairs[n] |
|
156 | 156 | ax = self.axes[4 * n] |
|
157 | 157 | spc0 = 10.*numpy.log10(spc[pair[0]]/self.data.factor) |
|
158 | if ax.firsttime: | |
|
159 |
self.xmax = self.xmax if self.xmax else numpy.nanmax(x) |
|
|
160 |
self.xmin = self.xmin if self.xmin else -self.xmax |
|
|
161 |
self.zmin = self.zmin if self.zmin else numpy.nanmin(spc) |
|
|
162 |
self.zmax = self.zmax if self.zmax else numpy.nanmax(spc) |
|
|
158 | if ax.firsttime: | |
|
159 | self.xmax = self.xmax if self.xmax else numpy.nanmax(x) | |
|
160 | self.xmin = self.xmin if self.xmin else -self.xmax | |
|
161 | self.zmin = self.zmin if self.zmin else numpy.nanmin(spc) | |
|
162 | self.zmax = self.zmax if self.zmax else numpy.nanmax(spc) | |
|
163 | 163 | ax.plt = ax.pcolormesh(x , y , spc0.T, |
|
164 | 164 | vmin=self.zmin, |
|
165 | 165 | vmax=self.zmax, |
|
166 | 166 | cmap=plt.get_cmap(self.colormap) |
|
167 |
) |
|
|
168 | else: | |
|
167 | ) | |
|
168 | else: | |
|
169 | 169 | ax.plt.set_array(spc0.T.ravel()) |
|
170 | 170 | self.titles.append('CH {}: {:3.2f}dB'.format(pair[0], noise)) |
|
171 | 171 | |
@@ -177,10 +177,10 class CrossSpectraPlot(Plot): | |||
|
177 | 177 | vmax=self.zmax, |
|
178 | 178 | cmap=plt.get_cmap(self.colormap) |
|
179 | 179 | ) |
|
180 |
else: |
|
|
180 | else: | |
|
181 | 181 | ax.plt.set_array(spc1.T.ravel()) |
|
182 | 182 | self.titles.append('CH {}: {:3.2f}dB'.format(pair[1], noise)) |
|
183 | ||
|
183 | ||
|
184 | 184 | out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]]) |
|
185 | 185 | coh = numpy.abs(out) |
|
186 | 186 | phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi |
@@ -196,13 +196,13 class CrossSpectraPlot(Plot): | |||
|
196 | 196 | ax.plt.set_array(coh.T.ravel()) |
|
197 | 197 | self.titles.append( |
|
198 | 198 | 'Coherence Ch{} * Ch{}'.format(pair[0], pair[1])) |
|
199 | ||
|
199 | ||
|
200 | 200 | ax = self.axes[4 * n + 3] |
|
201 | 201 | if ax.firsttime: |
|
202 | 202 | ax.plt = ax.pcolormesh(x, y, phase.T, |
|
203 | 203 | vmin=-180, |
|
204 | 204 | vmax=180, |
|
205 |
cmap=plt.get_cmap(self.colormap_phase) |
|
|
205 | cmap=plt.get_cmap(self.colormap_phase) | |
|
206 | 206 | ) |
|
207 | 207 | else: |
|
208 | 208 | ax.plt.set_array(phase.T.ravel()) |
@@ -313,7 +313,7 class PhasePlot(CoherencePlot): | |||
|
313 | 313 | |
|
314 | 314 | class NoisePlot(Plot): |
|
315 | 315 | ''' |
|
316 |
Plot for noise |
|
|
316 | Plot for noise | |
|
317 | 317 | ''' |
|
318 | 318 | |
|
319 | 319 | CODE = 'noise' |
@@ -655,12 +655,12 class ScopePlot(Plot): | |||
|
655 | 655 | |
|
656 | 656 | ''' |
|
657 | 657 | Plot for Scope |
|
658 |
''' |
|
|
658 | ''' | |
|
659 | 659 | |
|
660 | 660 | CODE = 'scope' |
|
661 | 661 | plot_name = 'Scope' |
|
662 | 662 | plot_type = 'scatter' |
|
663 | ||
|
663 | ||
|
664 | 664 | def setup(self): |
|
665 | 665 | |
|
666 | 666 | self.xaxis = 'Range (Km)' |
@@ -674,20 +674,20 class ScopePlot(Plot): | |||
|
674 | 674 | rowspan = 1 |
|
675 | 675 | |
|
676 | 676 | def plot_iq(self, x, y, channelIndexList, thisDatetime, wintitle): |
|
677 | ||
|
677 | ||
|
678 | 678 | yreal = y[channelIndexList,:].real |
|
679 | 679 | yimag = y[channelIndexList,:].imag |
|
680 | 680 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
681 | 681 | self.xlabel = "Range (Km)" |
|
682 | 682 | self.ylabel = "Intensity - IQ" |
|
683 | ||
|
683 | ||
|
684 | 684 | self.y = yreal |
|
685 | 685 | self.x = x |
|
686 | 686 | self.xmin = min(x) |
|
687 | 687 | self.xmax = max(x) |
|
688 | ||
|
689 | 688 | |
|
690 | self.titles[0] = title | |
|
689 | ||
|
690 | self.titles[0] = title | |
|
691 | 691 | |
|
692 | 692 | for i,ax in enumerate(self.axes): |
|
693 | 693 | title = "Channel %d" %(i) |
@@ -698,7 +698,7 class ScopePlot(Plot): | |||
|
698 | 698 | #pass |
|
699 | 699 | ax.plt_r.set_data(x, yreal[i,:]) |
|
700 | 700 | ax.plt_i.set_data(x, yimag[i,:]) |
|
701 | ||
|
701 | ||
|
702 | 702 | def plot_power(self, x, y, channelIndexList, thisDatetime, wintitle): |
|
703 | 703 | y = y[channelIndexList,:] * numpy.conjugate(y[channelIndexList,:]) |
|
704 | 704 | yreal = y.real |
@@ -708,70 +708,70 class ScopePlot(Plot): | |||
|
708 | 708 | self.ylabel = "Intensity" |
|
709 | 709 | self.xmin = min(x) |
|
710 | 710 | self.xmax = max(x) |
|
711 | ||
|
712 | ||
|
711 | ||
|
712 | ||
|
713 | 713 | self.titles[0] = title |
|
714 | 714 | |
|
715 | 715 | for i,ax in enumerate(self.axes): |
|
716 | 716 | title = "Channel %d" %(i) |
|
717 | ||
|
717 | ||
|
718 | 718 | ychannel = yreal[i,:] |
|
719 | ||
|
720 |
if ax.firsttime: |
|
|
719 | ||
|
720 | if ax.firsttime: | |
|
721 | 721 | ax.plt_r = ax.plot(x, ychannel)[0] |
|
722 | 722 | else: |
|
723 | 723 | #pass |
|
724 | 724 | ax.plt_r.set_data(x, ychannel) |
|
725 | ||
|
725 | ||
|
726 | 726 | |
|
727 | 727 | def plot(self): |
|
728 | ||
|
728 | ||
|
729 | 729 | if self.channels: |
|
730 | 730 | channels = self.channels |
|
731 | 731 | else: |
|
732 | 732 | channels = self.data.channels |
|
733 | 733 | |
|
734 | ||
|
735 | ||
|
734 | ||
|
735 | ||
|
736 | 736 | thisDatetime = datetime.datetime.utcfromtimestamp(self.data.times[-1]) |
|
737 | ||
|
737 | ||
|
738 | 738 | scope = self.data['scope'] |
|
739 | ||
|
740 | ||
|
739 | ||
|
740 | ||
|
741 | 741 | if self.data.flagDataAsBlock: |
|
742 | ||
|
742 | ||
|
743 | 743 | for i in range(self.data.nProfiles): |
|
744 | 744 | |
|
745 | 745 | wintitle1 = " [Profile = %d] " %i |
|
746 | 746 | |
|
747 | 747 | if self.type == "power": |
|
748 |
self.plot_power(self.data.heights, |
|
|
749 |
scope[:,i,:], |
|
|
748 | self.plot_power(self.data.heights, | |
|
749 | scope[:,i,:], | |
|
750 | 750 | channels, |
|
751 |
thisDatetime, |
|
|
751 | thisDatetime, | |
|
752 | 752 | wintitle1 |
|
753 | 753 | ) |
|
754 | 754 | |
|
755 | 755 | if self.type == "iq": |
|
756 |
self.plot_iq(self.data.heights, |
|
|
756 | self.plot_iq(self.data.heights, | |
|
757 | 757 | scope[:,i,:], |
|
758 | 758 | channels, |
|
759 |
thisDatetime, |
|
|
760 |
wintitle1 |
|
|
759 | thisDatetime, | |
|
760 | wintitle1 | |
|
761 | 761 | ) |
|
762 | 762 | else: |
|
763 | 763 | wintitle = " [Profile = %d] " %self.data.profileIndex |
|
764 | ||
|
764 | ||
|
765 | 765 | if self.type == "power": |
|
766 |
self.plot_power(self.data.heights, |
|
|
766 | self.plot_power(self.data.heights, | |
|
767 | 767 | scope, |
|
768 | 768 | channels, |
|
769 | 769 | thisDatetime, |
|
770 | 770 | wintitle |
|
771 | 771 | ) |
|
772 | ||
|
772 | ||
|
773 | 773 | if self.type == "iq": |
|
774 |
self.plot_iq(self.data.heights, |
|
|
774 | self.plot_iq(self.data.heights, | |
|
775 | 775 | scope, |
|
776 | 776 | channels, |
|
777 | 777 | thisDatetime, |
@@ -324,7 +324,6 class AMISRReader(ProcessingUnit): | |||
|
324 | 324 | else: |
|
325 | 325 | #get the last file - 1 |
|
326 | 326 | self.filenameList = [self.filenameList[-2]] |
|
327 | ||
|
328 | 327 | new_dirnameList = [] |
|
329 | 328 | for dirname in self.dirnameList: |
|
330 | 329 | junk = numpy.array([dirname in x for x in self.filenameList]) |
@@ -383,7 +382,6 class AMISRReader(ProcessingUnit): | |||
|
383 | 382 | if not(idFile < len(self.filenameList)): |
|
384 | 383 | self.flagNoMoreFiles = 1 |
|
385 | 384 | print("No more Files") |
|
386 | self.dataOut.error = True | |
|
387 | 385 | return 0 |
|
388 | 386 | |
|
389 | 387 | filename = self.filenameList[idFile] |
@@ -409,9 +407,11 class AMISRReader(ProcessingUnit): | |||
|
409 | 407 | self.__selectDataForTimes(online=True) |
|
410 | 408 | filename = self.filenameList[0] |
|
411 | 409 | wait = 0 |
|
410 | #self.__waitForNewFile=5 ## DEBUG: | |
|
412 | 411 | while self.__filename_online == filename: |
|
413 | 412 | print('waiting %d seconds to get a new file...'%(self.__waitForNewFile)) |
|
414 | 413 | if wait == 5: |
|
414 | self.flagNoMoreFiles = 1 | |
|
415 | 415 | return 0 |
|
416 | 416 | sleep(self.__waitForNewFile) |
|
417 | 417 | self.__selectDataForTimes(online=True) |
@@ -550,6 +550,7 class AMISRReader(ProcessingUnit): | |||
|
550 | 550 | newFile = self.__setNextFileOnline() |
|
551 | 551 | |
|
552 | 552 | if not(newFile): |
|
553 | self.dataOut.error = True | |
|
553 | 554 | return 0 |
|
554 | 555 | #if self.__firstFile: |
|
555 | 556 | self.readAMISRHeader(self.amisrFilePointer) |
General Comments 0
You need to be logged in to leave comments.
Login now