diff --git a/schainpy/model/graphics/jroplot_base.py b/schainpy/model/graphics/jroplot_base.py index a6d5fbc..1302d87 100644 --- a/schainpy/model/graphics/jroplot_base.py +++ b/schainpy/model/graphics/jroplot_base.py @@ -406,8 +406,10 @@ class Plot(Operation): if self.ylabel is not None: ax.set_ylabel(self.ylabel) if self.showprofile: + if self.zlimits is not None: + self.zmin, self.zmax = self.zlimits[n] self.pf_axes[n].set_ylim(ymin, ymax) - self.pf_axes[n].set_xlim(self.zmin[n], self.zmax[n]) + self.pf_axes[n].set_xlim(self.zmin, self.zmax) self.pf_axes[n].set_xlabel('dB') self.pf_axes[n].grid(b=True, axis='x') [tick.set_visible(False) @@ -569,7 +571,9 @@ class Plot(Operation): else: self.data.meta['colormap'] = 'Viridis' self.data.meta['interval'] = int(interval) - + #print(last_time) + #print(time.time()) + #exit(1) self.sender_queue.append(last_time) while True: diff --git a/schainpy/model/graphics/jroplot_spectra.py b/schainpy/model/graphics/jroplot_spectra.py index 160740c..38740d2 100644 --- a/schainpy/model/graphics/jroplot_spectra.py +++ b/schainpy/model/graphics/jroplot_spectra.py @@ -95,18 +95,6 @@ class SpectraPlot(Plot): self.CODE2 = 'spc_oblique' - if not isinstance(self.zmin, collections.abc.Sequence): - if not self.zmin: - self.zmin = [numpy.min(self.z)]*len(self.axes) - else: - self.zmin = [self.zmin]*len(self.axes) - - if not isinstance(self.zmax, collections.abc.Sequence): - if not self.zmax: - self.zmax = [numpy.max(self.z)]*len(self.axes) - else: - self.zmax = [self.zmax]*len(self.axes) - for n, ax in enumerate(self.axes): noise = data['noise'][n] if self.CODE == 'spc_moments': @@ -119,10 +107,12 @@ class SpectraPlot(Plot): self.xmin = self.xmin if self.xmin else numpy.nanmin(x)#-self.xmax #self.zmin = self.zmin if self.zmin else numpy.nanmin(z) #self.zmax = self.zmax if self.zmax else numpy.nanmax(z) + if self.zlimits is not None: + self.zmin, self.zmax = self.zlimits[n] ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin[n], - vmax=self.zmax[n], + vmin=self.zmin, + vmax=self.zmax, cmap=plt.get_cmap(self.colormap), ) @@ -137,6 +127,8 @@ class SpectraPlot(Plot): ax.plt_gau0 = ax.plot(gau0, y, color='r', lw=1)[0] ax.plt_gau1 = ax.plot(gau1, y, color='y', lw=1)[0] else: + if self.zlimits is not None: + self.zmin, self.zmax = self.zlimits[n] ax.plt.set_array(z[n].T.ravel()) if self.showprofile: ax.plt_profile.set_data(data['rti'][n], y) @@ -725,7 +717,7 @@ class RTIPlot(Plot): else: x, y, z = self.fill_gaps(*self.decimate()) - + ''' if not isinstance(self.zmin, collections.abc.Sequence): if not self.zmin: self.zmin = [numpy.min(self.z)]*len(self.axes) @@ -737,16 +729,18 @@ class RTIPlot(Plot): self.zmax = [numpy.max(self.z)]*len(self.axes) else: self.zmax = [self.zmax]*len(self.axes) - + ''' for n, ax in enumerate(self.axes): - #self.zmin = self.zmin if self.zmin else numpy.min(self.z) - #self.zmax = self.zmax if self.zmax else numpy.max(self.z) + self.zmin = self.zmin if self.zmin else numpy.min(self.z) + self.zmax = self.zmax if self.zmax else numpy.max(self.z) if ax.firsttime: + if self.zlimits is not None: + self.zmin, self.zmax = self.zlimits[n] ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin[n], - vmax=self.zmax[n], + vmin=self.zmin, + vmax=self.zmax, cmap=plt.get_cmap(self.colormap) ) if self.showprofile: @@ -755,10 +749,12 @@ class RTIPlot(Plot): ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y, color="k", linestyle="dashed", lw=1)[0] else: + if self.zlimits is not None: + self.zmin, self.zmax = self.zlimits[n] ax.collections.remove(ax.collections[0]) ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin[n], - vmax=self.zmax[n], + vmin=self.zmin, + vmax=self.zmax, cmap=plt.get_cmap(self.colormap) ) if self.showprofile: diff --git a/schainpy/model/graphics/jroplot_voltage_lags.py b/schainpy/model/graphics/jroplot_voltage_lags.py index 93fac28..1b24ebd 100644 --- a/schainpy/model/graphics/jroplot_voltage_lags.py +++ b/schainpy/model/graphics/jroplot_voltage_lags.py @@ -153,24 +153,12 @@ class RTILPPlot(RTIPlot): else: x, y, z = self.fill_gaps(*self.decimate()) - if not isinstance(self.zmin, collections.abc.Sequence): - if not self.zmin: - self.zmin = [numpy.min(self.z)]*len(self.axes) - else: - self.zmin = [self.zmin]*len(self.axes) - - if not isinstance(self.zmax, collections.abc.Sequence): - if not self.zmax: - self.zmax = [numpy.max(self.z)]*len(self.axes) - else: - self.zmax = [self.zmax]*len(self.axes) - for n, ax in enumerate(self.axes): - #self.zmax = self.zmax if self.zmax is not None else numpy.max( - #self.z[1][0,12:40]) - #self.zmin = self.zmin if self.zmin is not None else numpy.min( - #self.z[1][0,12:40]) + self.zmax = self.zmax if self.zmax is not None else numpy.max( + self.z[1][0,12:40]) + self.zmin = self.zmin if self.zmin is not None else numpy.min( + self.z[1][0,12:40]) if ax.firsttime: @@ -179,18 +167,18 @@ class RTILPPlot(RTIPlot): ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin[n], - vmax=self.zmax[n], + vmin=self.zmin, + vmax=self.zmax, cmap=plt.get_cmap(self.colormap) ) else: - #if self.zlimits is not None: - #self.zmin, self.zmax = self.zlimits[n] + if self.zlimits is not None: + self.zmin, self.zmax = self.zlimits[n] ax.collections.remove(ax.collections[0]) ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin[n], - vmax=self.zmax[n], + vmin=self.zmin, + vmax=self.zmax, cmap=plt.get_cmap(self.colormap) ) diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 31974e9..d0b8777 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -10,6 +10,7 @@ from schainpy.utils import log from time import time, mktime, strptime, gmtime, ctime from scipy.optimize import least_squares import datetime +import collections.abc try: from schainpy.model.proc import fitacf_guess @@ -2542,7 +2543,10 @@ class CleanCohEchoes(Operation): dataOut.flagSpreadF = True #Removing echoes greater than 35 dB - maxdB = 10*numpy.log10(dataOut.pbn[0]) + 10 #Lag 0 NOise + if isinstance(dataOut.pbn, collections.abc.Sequence): + maxdB = 10*numpy.log10(dataOut.pbn[0]) + 10 #Lag 0 NOise + else: + maxdB = 10*numpy.log10(dataOut.pbn) + 10 #Lag 0 NOise #maxdB = 35 #DEBERÍA SER NOISE+ALGO!!!!!!!!!!!!!!!!!!!!!! #print("noise: ",maxdB - 10) #print(dataOut.kabxys_integrated[6][:,0,0]) @@ -3498,7 +3502,8 @@ class ElectronDensityFaraday(Operation): #print(dataOut.phi) #exit(1) #''' - if dataOut.flagSpreadF: + if hasattr(dataOut, 'flagSpreadF') and dataOut.flagSpreadF: + #if dataOut.flagSpreadF: nanindex = numpy.argwhere(numpy.isnan(dataOut.phi)) i1 = nanindex[-1][0] #Analizar cuando SpreadF es Pluma @@ -3931,7 +3936,8 @@ class NormalizeDPPowerRoberto_V2(Operation): dataOut.sdp2[i]/=dataOut.cf #''' - if dataOut.flagSpreadF: + #if dataOut.flagSpreadF: + if hasattr(dataOut, 'flagSpreadF') and dataOut.flagSpreadF: i2=int((620-dataOut.range1[0])/dataOut.DH) nanindex = numpy.argwhere(numpy.isnan(dataOut.ph2)) print("nanindex",nanindex) @@ -3944,7 +3950,7 @@ class NormalizeDPPowerRoberto_V2(Operation): #print(dataOut.ph2[i1::]) #''' try: - if dataOut.flagSpreadF and i1 > 30: + if hasattr(dataOut, 'flagSpreadF') and dataOut.flagSpreadF and i1 > 30: dataOut.cf = numpy.nan else: dataOut.cf=self.normal(dataOut.dphi[i1::], dataOut.ph2[i1::], i2-i1, 1)