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