From f7e4a1824cf4573a717155cd27c88fa98b86ffef 2022-09-13 21:46:50 From: Roberto Flores Date: 2022-09-13 21:46:50 Subject: [PATCH] Now RTIPlot and SpcPlot can show different dBrange --- diff --git a/schainpy/model/graphics/jroplot_base.py b/schainpy/model/graphics/jroplot_base.py index 98a6b5c..a6d5fbc 100644 --- a/schainpy/model/graphics/jroplot_base.py +++ b/schainpy/model/graphics/jroplot_base.py @@ -407,7 +407,7 @@ class Plot(Operation): ax.set_ylabel(self.ylabel) if self.showprofile: self.pf_axes[n].set_ylim(ymin, ymax) - self.pf_axes[n].set_xlim(self.zmin, self.zmax) + self.pf_axes[n].set_xlim(self.zmin[n], self.zmax[n]) self.pf_axes[n].set_xlabel('dB') self.pf_axes[n].grid(b=True, axis='x') [tick.set_visible(False) diff --git a/schainpy/model/graphics/jroplot_spectra.py b/schainpy/model/graphics/jroplot_spectra.py index 182edaa..160740c 100644 --- a/schainpy/model/graphics/jroplot_spectra.py +++ b/schainpy/model/graphics/jroplot_spectra.py @@ -8,6 +8,7 @@ import os import numpy +import collections.abc from schainpy.model.graphics.jroplot_base import Plot, plt, log @@ -94,6 +95,17 @@ 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] @@ -105,12 +117,12 @@ class SpectraPlot(Plot): if ax.firsttime: self.xmax = self.xmax if self.xmax else numpy.nanmax(x) 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) + #self.zmin = self.zmin if self.zmin else numpy.nanmin(z) + #self.zmax = self.zmax if self.zmax else numpy.nanmax(z) ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin, - vmax=self.zmax, + vmin=self.zmin[n], + vmax=self.zmax[n], cmap=plt.get_cmap(self.colormap), ) @@ -713,14 +725,28 @@ 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) + 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.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: ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin, - vmax=self.zmax, + vmin=self.zmin[n], + vmax=self.zmax[n], cmap=plt.get_cmap(self.colormap) ) if self.showprofile: @@ -731,8 +757,8 @@ class RTIPlot(Plot): else: ax.collections.remove(ax.collections[0]) ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin, - vmax=self.zmax, + vmin=self.zmin[n], + vmax=self.zmax[n], 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 20bd2ed..93fac28 100644 --- a/schainpy/model/graphics/jroplot_voltage_lags.py +++ b/schainpy/model/graphics/jroplot_voltage_lags.py @@ -4,6 +4,7 @@ import time import math import datetime import numpy +import collections.abc from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator #YONG from .jroplot_spectra import RTIPlot, NoisePlot @@ -110,7 +111,7 @@ class RTILPPlot(RTIPlot): def setup(self): self.xaxis = 'time' self.ncols = 1 - self.nrows = 4 + self.nrows = 2 self.nplots = self.nrows self.ylabel = 'Range [km]' @@ -152,12 +153,24 @@ 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: @@ -166,8 +179,8 @@ class RTILPPlot(RTIPlot): ax.plt = ax.pcolormesh(x, y, z[n].T, - vmin=self.zmin, - vmax=self.zmax, + vmin=self.zmin[n], + vmax=self.zmax[n], cmap=plt.get_cmap(self.colormap) ) @@ -176,8 +189,8 @@ class RTILPPlot(RTIPlot): #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, - vmax=self.zmax, + vmin=self.zmin[n], + vmax=self.zmax[n], cmap=plt.get_cmap(self.colormap) ) @@ -618,6 +631,7 @@ class FracsHPPlot(Plot): ax.errorbar(phe, self.y[cut:], fmt='k^', xerr=ephe,elinewidth=1.0,color='b',linewidth=2.0, label='He+') plt.legend(loc='lower right') ax.yaxis.set_minor_locator(MultipleLocator(15)) + ax.grid(which='minor') class EDensityPlot(Plot): ''' diff --git a/schainpy/model/proc/jroproc_parameters.py b/schainpy/model/proc/jroproc_parameters.py index 0970ff8..c6fe251 100644 --- a/schainpy/model/proc/jroproc_parameters.py +++ b/schainpy/model/proc/jroproc_parameters.py @@ -6745,5 +6745,5 @@ class MergeProc(ProcessingUnit): self.dataOut.NRANGE = self.dataOut.data_acf.shape[-1] ''' #print(numpy.shape(self.dataOut.data_spc)) - print("*************************GOOD*************************") + #print("*************************GOOD*************************") #exit(1) diff --git a/schainpy/model/proc/jroproc_spectra_lags_faraday.py b/schainpy/model/proc/jroproc_spectra_lags_faraday.py index 7a3d4ad..52753a2 100644 --- a/schainpy/model/proc/jroproc_spectra_lags_faraday.py +++ b/schainpy/model/proc/jroproc_spectra_lags_faraday.py @@ -510,7 +510,7 @@ class removeDCLagFlip(Operation): def run(self, dataOut, mode=2): - print("***********************************Remove DC***********************************") + #print("***********************************Remove DC***********************************") ##print(dataOut.FlipChannels) #exit(1) self.dataOut = dataOut diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 5e25884..31974e9 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -5089,6 +5089,9 @@ class DataSaveCleanerHP(Operation): dataOut.acfs_LP=dataOut.acfs_LP.transpose() dataOut.acfs_error_LP=dataOut.acfs_error_LP.transpose() + dataOut.DensityFinal *= 1.e6 #Convert units to m^⁻3 + dataOut.EDensityFinal *= 1.e6 #Convert units to m^⁻3 + return dataOut @@ -7255,7 +7258,7 @@ class IntegrationHP(IntegrationDP): #print(dataOut.kabxys_integrated[8][53,6,0]+dataOut.kabxys_integrated[11][53,6,0]) #print(dataOut.kabxys_integrated[8][53,9,0]+dataOut.kabxys_integrated[11][53,9,0]) #exit(1) - print(dataOut.flagNoData) + #print(dataOut.flagNoData) return dataOut class SumFlipsHP(SumFlips):