##// END OF EJS Templates
Fix zlimits when showprofile and flagSpreadF(Faraday) no needed
rflores -
r1551:15bafdde09b9
parent child
Show More
@@ -406,8 +406,10 class Plot(Operation):
406 if self.ylabel is not None:
406 if self.ylabel is not None:
407 ax.set_ylabel(self.ylabel)
407 ax.set_ylabel(self.ylabel)
408 if self.showprofile:
408 if self.showprofile:
409 if self.zlimits is not None:
410 self.zmin, self.zmax = self.zlimits[n]
409 self.pf_axes[n].set_ylim(ymin, ymax)
411 self.pf_axes[n].set_ylim(ymin, ymax)
410 self.pf_axes[n].set_xlim(self.zmin[n], self.zmax[n])
412 self.pf_axes[n].set_xlim(self.zmin, self.zmax)
411 self.pf_axes[n].set_xlabel('dB')
413 self.pf_axes[n].set_xlabel('dB')
412 self.pf_axes[n].grid(b=True, axis='x')
414 self.pf_axes[n].grid(b=True, axis='x')
413 [tick.set_visible(False)
415 [tick.set_visible(False)
@@ -569,7 +571,9 class Plot(Operation):
569 else:
571 else:
570 self.data.meta['colormap'] = 'Viridis'
572 self.data.meta['colormap'] = 'Viridis'
571 self.data.meta['interval'] = int(interval)
573 self.data.meta['interval'] = int(interval)
572
574 #print(last_time)
575 #print(time.time())
576 #exit(1)
573 self.sender_queue.append(last_time)
577 self.sender_queue.append(last_time)
574
578
575 while True:
579 while True:
@@ -95,18 +95,6 class SpectraPlot(Plot):
95
95
96 self.CODE2 = 'spc_oblique'
96 self.CODE2 = 'spc_oblique'
97
97
98 if not isinstance(self.zmin, collections.abc.Sequence):
99 if not self.zmin:
100 self.zmin = [numpy.min(self.z)]*len(self.axes)
101 else:
102 self.zmin = [self.zmin]*len(self.axes)
103
104 if not isinstance(self.zmax, collections.abc.Sequence):
105 if not self.zmax:
106 self.zmax = [numpy.max(self.z)]*len(self.axes)
107 else:
108 self.zmax = [self.zmax]*len(self.axes)
109
110 for n, ax in enumerate(self.axes):
98 for n, ax in enumerate(self.axes):
111 noise = data['noise'][n]
99 noise = data['noise'][n]
112 if self.CODE == 'spc_moments':
100 if self.CODE == 'spc_moments':
@@ -119,10 +107,12 class SpectraPlot(Plot):
119 self.xmin = self.xmin if self.xmin else numpy.nanmin(x)#-self.xmax
107 self.xmin = self.xmin if self.xmin else numpy.nanmin(x)#-self.xmax
120 #self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
108 #self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
121 #self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
109 #self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
110 if self.zlimits is not None:
111 self.zmin, self.zmax = self.zlimits[n]
122
112
123 ax.plt = ax.pcolormesh(x, y, z[n].T,
113 ax.plt = ax.pcolormesh(x, y, z[n].T,
124 vmin=self.zmin[n],
114 vmin=self.zmin,
125 vmax=self.zmax[n],
115 vmax=self.zmax,
126 cmap=plt.get_cmap(self.colormap),
116 cmap=plt.get_cmap(self.colormap),
127 )
117 )
128
118
@@ -137,6 +127,8 class SpectraPlot(Plot):
137 ax.plt_gau0 = ax.plot(gau0, y, color='r', lw=1)[0]
127 ax.plt_gau0 = ax.plot(gau0, y, color='r', lw=1)[0]
138 ax.plt_gau1 = ax.plot(gau1, y, color='y', lw=1)[0]
128 ax.plt_gau1 = ax.plot(gau1, y, color='y', lw=1)[0]
139 else:
129 else:
130 if self.zlimits is not None:
131 self.zmin, self.zmax = self.zlimits[n]
140 ax.plt.set_array(z[n].T.ravel())
132 ax.plt.set_array(z[n].T.ravel())
141 if self.showprofile:
133 if self.showprofile:
142 ax.plt_profile.set_data(data['rti'][n], y)
134 ax.plt_profile.set_data(data['rti'][n], y)
@@ -725,7 +717,7 class RTIPlot(Plot):
725 else:
717 else:
726 x, y, z = self.fill_gaps(*self.decimate())
718 x, y, z = self.fill_gaps(*self.decimate())
727
719
728
720 '''
729 if not isinstance(self.zmin, collections.abc.Sequence):
721 if not isinstance(self.zmin, collections.abc.Sequence):
730 if not self.zmin:
722 if not self.zmin:
731 self.zmin = [numpy.min(self.z)]*len(self.axes)
723 self.zmin = [numpy.min(self.z)]*len(self.axes)
@@ -737,16 +729,18 class RTIPlot(Plot):
737 self.zmax = [numpy.max(self.z)]*len(self.axes)
729 self.zmax = [numpy.max(self.z)]*len(self.axes)
738 else:
730 else:
739 self.zmax = [self.zmax]*len(self.axes)
731 self.zmax = [self.zmax]*len(self.axes)
740
732 '''
741 for n, ax in enumerate(self.axes):
733 for n, ax in enumerate(self.axes):
742
734
743 #self.zmin = self.zmin if self.zmin else numpy.min(self.z)
735 self.zmin = self.zmin if self.zmin else numpy.min(self.z)
744 #self.zmax = self.zmax if self.zmax else numpy.max(self.z)
736 self.zmax = self.zmax if self.zmax else numpy.max(self.z)
745
737
746 if ax.firsttime:
738 if ax.firsttime:
739 if self.zlimits is not None:
740 self.zmin, self.zmax = self.zlimits[n]
747 ax.plt = ax.pcolormesh(x, y, z[n].T,
741 ax.plt = ax.pcolormesh(x, y, z[n].T,
748 vmin=self.zmin[n],
742 vmin=self.zmin,
749 vmax=self.zmax[n],
743 vmax=self.zmax,
750 cmap=plt.get_cmap(self.colormap)
744 cmap=plt.get_cmap(self.colormap)
751 )
745 )
752 if self.showprofile:
746 if self.showprofile:
@@ -755,10 +749,12 class RTIPlot(Plot):
755 ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y,
749 ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y,
756 color="k", linestyle="dashed", lw=1)[0]
750 color="k", linestyle="dashed", lw=1)[0]
757 else:
751 else:
752 if self.zlimits is not None:
753 self.zmin, self.zmax = self.zlimits[n]
758 ax.collections.remove(ax.collections[0])
754 ax.collections.remove(ax.collections[0])
759 ax.plt = ax.pcolormesh(x, y, z[n].T,
755 ax.plt = ax.pcolormesh(x, y, z[n].T,
760 vmin=self.zmin[n],
756 vmin=self.zmin,
761 vmax=self.zmax[n],
757 vmax=self.zmax,
762 cmap=plt.get_cmap(self.colormap)
758 cmap=plt.get_cmap(self.colormap)
763 )
759 )
764 if self.showprofile:
760 if self.showprofile:
@@ -153,24 +153,12 class RTILPPlot(RTIPlot):
153 else:
153 else:
154 x, y, z = self.fill_gaps(*self.decimate())
154 x, y, z = self.fill_gaps(*self.decimate())
155
155
156 if not isinstance(self.zmin, collections.abc.Sequence):
157 if not self.zmin:
158 self.zmin = [numpy.min(self.z)]*len(self.axes)
159 else:
160 self.zmin = [self.zmin]*len(self.axes)
161
162 if not isinstance(self.zmax, collections.abc.Sequence):
163 if not self.zmax:
164 self.zmax = [numpy.max(self.z)]*len(self.axes)
165 else:
166 self.zmax = [self.zmax]*len(self.axes)
167
168 for n, ax in enumerate(self.axes):
156 for n, ax in enumerate(self.axes):
169
157
170 #self.zmax = self.zmax if self.zmax is not None else numpy.max(
158 self.zmax = self.zmax if self.zmax is not None else numpy.max(
171 #self.z[1][0,12:40])
159 self.z[1][0,12:40])
172 #self.zmin = self.zmin if self.zmin is not None else numpy.min(
160 self.zmin = self.zmin if self.zmin is not None else numpy.min(
173 #self.z[1][0,12:40])
161 self.z[1][0,12:40])
174
162
175 if ax.firsttime:
163 if ax.firsttime:
176
164
@@ -179,18 +167,18 class RTILPPlot(RTIPlot):
179
167
180
168
181 ax.plt = ax.pcolormesh(x, y, z[n].T,
169 ax.plt = ax.pcolormesh(x, y, z[n].T,
182 vmin=self.zmin[n],
170 vmin=self.zmin,
183 vmax=self.zmax[n],
171 vmax=self.zmax,
184 cmap=plt.get_cmap(self.colormap)
172 cmap=plt.get_cmap(self.colormap)
185 )
173 )
186
174
187 else:
175 else:
188 #if self.zlimits is not None:
176 if self.zlimits is not None:
189 #self.zmin, self.zmax = self.zlimits[n]
177 self.zmin, self.zmax = self.zlimits[n]
190 ax.collections.remove(ax.collections[0])
178 ax.collections.remove(ax.collections[0])
191 ax.plt = ax.pcolormesh(x, y, z[n].T,
179 ax.plt = ax.pcolormesh(x, y, z[n].T,
192 vmin=self.zmin[n],
180 vmin=self.zmin,
193 vmax=self.zmax[n],
181 vmax=self.zmax,
194 cmap=plt.get_cmap(self.colormap)
182 cmap=plt.get_cmap(self.colormap)
195 )
183 )
196
184
@@ -10,6 +10,7 from schainpy.utils import log
10 from time import time, mktime, strptime, gmtime, ctime
10 from time import time, mktime, strptime, gmtime, ctime
11 from scipy.optimize import least_squares
11 from scipy.optimize import least_squares
12 import datetime
12 import datetime
13 import collections.abc
13
14
14 try:
15 try:
15 from schainpy.model.proc import fitacf_guess
16 from schainpy.model.proc import fitacf_guess
@@ -2542,7 +2543,10 class CleanCohEchoes(Operation):
2542 dataOut.flagSpreadF = True
2543 dataOut.flagSpreadF = True
2543
2544
2544 #Removing echoes greater than 35 dB
2545 #Removing echoes greater than 35 dB
2546 if isinstance(dataOut.pbn, collections.abc.Sequence):
2545 maxdB = 10*numpy.log10(dataOut.pbn[0]) + 10 #Lag 0 NOise
2547 maxdB = 10*numpy.log10(dataOut.pbn[0]) + 10 #Lag 0 NOise
2548 else:
2549 maxdB = 10*numpy.log10(dataOut.pbn) + 10 #Lag 0 NOise
2546 #maxdB = 35 #DEBERÍA SER NOISE+ALGO!!!!!!!!!!!!!!!!!!!!!!
2550 #maxdB = 35 #DEBERÍA SER NOISE+ALGO!!!!!!!!!!!!!!!!!!!!!!
2547 #print("noise: ",maxdB - 10)
2551 #print("noise: ",maxdB - 10)
2548 #print(dataOut.kabxys_integrated[6][:,0,0])
2552 #print(dataOut.kabxys_integrated[6][:,0,0])
@@ -3498,7 +3502,8 class ElectronDensityFaraday(Operation):
3498 #print(dataOut.phi)
3502 #print(dataOut.phi)
3499 #exit(1)
3503 #exit(1)
3500 #'''
3504 #'''
3501 if dataOut.flagSpreadF:
3505 if hasattr(dataOut, 'flagSpreadF') and dataOut.flagSpreadF:
3506 #if dataOut.flagSpreadF:
3502 nanindex = numpy.argwhere(numpy.isnan(dataOut.phi))
3507 nanindex = numpy.argwhere(numpy.isnan(dataOut.phi))
3503 i1 = nanindex[-1][0]
3508 i1 = nanindex[-1][0]
3504 #Analizar cuando SpreadF es Pluma
3509 #Analizar cuando SpreadF es Pluma
@@ -3931,7 +3936,8 class NormalizeDPPowerRoberto_V2(Operation):
3931 dataOut.sdp2[i]/=dataOut.cf
3936 dataOut.sdp2[i]/=dataOut.cf
3932
3937
3933 #'''
3938 #'''
3934 if dataOut.flagSpreadF:
3939 #if dataOut.flagSpreadF:
3940 if hasattr(dataOut, 'flagSpreadF') and dataOut.flagSpreadF:
3935 i2=int((620-dataOut.range1[0])/dataOut.DH)
3941 i2=int((620-dataOut.range1[0])/dataOut.DH)
3936 nanindex = numpy.argwhere(numpy.isnan(dataOut.ph2))
3942 nanindex = numpy.argwhere(numpy.isnan(dataOut.ph2))
3937 print("nanindex",nanindex)
3943 print("nanindex",nanindex)
@@ -3944,7 +3950,7 class NormalizeDPPowerRoberto_V2(Operation):
3944 #print(dataOut.ph2[i1::])
3950 #print(dataOut.ph2[i1::])
3945 #'''
3951 #'''
3946 try:
3952 try:
3947 if dataOut.flagSpreadF and i1 > 30:
3953 if hasattr(dataOut, 'flagSpreadF') and dataOut.flagSpreadF and i1 > 30:
3948 dataOut.cf = numpy.nan
3954 dataOut.cf = numpy.nan
3949 else:
3955 else:
3950 dataOut.cf=self.normal(dataOut.dphi[i1::], dataOut.ph2[i1::], i2-i1, 1)
3956 dataOut.cf=self.normal(dataOut.dphi[i1::], dataOut.ph2[i1::], i2-i1, 1)
General Comments 0
You need to be logged in to leave comments. Login now