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