Loading pysen/plot/nseplotlib.py +15 −13 Original line number Diff line number Diff line Loading @@ -40,10 +40,10 @@ def _get_lambda(params): def plot_field(ax,t,v,**kwargs): "plot mag field" axis = kwargs.get('axis', -1) label = kwargs.get('label' , '') max_chi2 = kwargs.get('max_chi2', MAX_CHI2_DEFAULT_BFIELD) axis = kwargs.pop('axis', -1) label = kwargs.pop('label' , '') max_chi2 = kwargs.pop('max_chi2', MAX_CHI2_DEFAULT_BFIELD) stats = kwargs.pop('stats', False) v0 = sqrt(np.sum(v**2,axis=-1)) if axis>0: v0 = v[:,axis-1] Loading @@ -60,14 +60,15 @@ def plot_field(ax,t,v,**kwargs): vmin = va-max(vd,1.5) vmax = va+max(vd,1.5) ax.plot(t,v0, 'o--', lw=1, label=label) ax.plot(t,v1, '-') #for _axis in axes: # ax.plot(t,v[:,_axis], '+', lw=1, label="%s (%s)" % (label,_axis)) ax.set_ylim(bottom=vmin, top=vmax) if stats: ax.plot(t,v1, '-') ax.text(0.05,0.20,descr1, transform=ax.transAxes, fontsize=7) ax.text(0.05,0.10,descr2, transform=ax.transAxes, fontsize=7) ax.grid(True, lw=0.5) ax.legend(loc='upper left') ax.legend(loc='upper right') ok = chi2<max_chi2 if not ok: ax.set_facecolor('yellow') Loading @@ -79,10 +80,11 @@ def plot_magnetic_fields(hdfile, iecho=None, **kwargs): # #pylint: disable=too-many-locals #FIXME: refactor this monster (plot_magnetic_fields) axis = kwargs.get('axis', -1) max_chi2 = kwargs.get('max_chi2', MAX_CHI2_DEFAULT_BFIELD) first_point = kwargs.get('first_point', 1) # skip 1st point units = kwargs.get('units', GAUSS/MICRO) #axis = kwargs.get('axis', -1) #max_chi2 = kwargs.get('max_chi2', MAX_CHI2_DEFAULT_BFIELD) first_point = kwargs.pop('first_point', 1) # skip 1st point units = kwargs.pop('units', GAUSS/MICRO) #stats = kwargs.get('stats', True) # base = os.path.splitext(os.path.basename(hdfile.filename))[0] Loading Loading @@ -125,7 +127,7 @@ def plot_magnetic_fields(hdfile, iecho=None, **kwargs): label = bsensor.split('.')[-1] ax = axes[iplt//nxplot,iplt%nxplot] ok, res = plot_field(ax, dj[first_point:nph]/MICRO, bmag[first_point:nph,:]*units, label=label, max_chi2=max_chi2, axis=axis) label=label, **kwargs) if iplt%nxplot==0: if units==1: ax.set_ylabel('B [G') Loading pysen/revision.py +2 −2 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ PySEN revision module """ import sys __version__ = "2.1" __release__ = "b6" __date__ = "Apr 17, 2025" __release__ = "b7" __date__ = "Apr 22, 2025" def version(full=False): "get pysen version number" Loading pysen/ui/nseplot.py +2 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,8 @@ def add_bfield_options(subparser, parents=None): help='set max chi-square (default=%(default)s)') pars.add_argument('--axis', dest='axis', type=int, help='set axis to plot (default=%(default)s)') pars.add_argument('--show-stats', dest='stats', action='store_true', help='show statistics on field uniformity') def add_qtau_options(subparser, parents=None): "q-tau plot" Loading Loading
pysen/plot/nseplotlib.py +15 −13 Original line number Diff line number Diff line Loading @@ -40,10 +40,10 @@ def _get_lambda(params): def plot_field(ax,t,v,**kwargs): "plot mag field" axis = kwargs.get('axis', -1) label = kwargs.get('label' , '') max_chi2 = kwargs.get('max_chi2', MAX_CHI2_DEFAULT_BFIELD) axis = kwargs.pop('axis', -1) label = kwargs.pop('label' , '') max_chi2 = kwargs.pop('max_chi2', MAX_CHI2_DEFAULT_BFIELD) stats = kwargs.pop('stats', False) v0 = sqrt(np.sum(v**2,axis=-1)) if axis>0: v0 = v[:,axis-1] Loading @@ -60,14 +60,15 @@ def plot_field(ax,t,v,**kwargs): vmin = va-max(vd,1.5) vmax = va+max(vd,1.5) ax.plot(t,v0, 'o--', lw=1, label=label) ax.plot(t,v1, '-') #for _axis in axes: # ax.plot(t,v[:,_axis], '+', lw=1, label="%s (%s)" % (label,_axis)) ax.set_ylim(bottom=vmin, top=vmax) if stats: ax.plot(t,v1, '-') ax.text(0.05,0.20,descr1, transform=ax.transAxes, fontsize=7) ax.text(0.05,0.10,descr2, transform=ax.transAxes, fontsize=7) ax.grid(True, lw=0.5) ax.legend(loc='upper left') ax.legend(loc='upper right') ok = chi2<max_chi2 if not ok: ax.set_facecolor('yellow') Loading @@ -79,10 +80,11 @@ def plot_magnetic_fields(hdfile, iecho=None, **kwargs): # #pylint: disable=too-many-locals #FIXME: refactor this monster (plot_magnetic_fields) axis = kwargs.get('axis', -1) max_chi2 = kwargs.get('max_chi2', MAX_CHI2_DEFAULT_BFIELD) first_point = kwargs.get('first_point', 1) # skip 1st point units = kwargs.get('units', GAUSS/MICRO) #axis = kwargs.get('axis', -1) #max_chi2 = kwargs.get('max_chi2', MAX_CHI2_DEFAULT_BFIELD) first_point = kwargs.pop('first_point', 1) # skip 1st point units = kwargs.pop('units', GAUSS/MICRO) #stats = kwargs.get('stats', True) # base = os.path.splitext(os.path.basename(hdfile.filename))[0] Loading Loading @@ -125,7 +127,7 @@ def plot_magnetic_fields(hdfile, iecho=None, **kwargs): label = bsensor.split('.')[-1] ax = axes[iplt//nxplot,iplt%nxplot] ok, res = plot_field(ax, dj[first_point:nph]/MICRO, bmag[first_point:nph,:]*units, label=label, max_chi2=max_chi2, axis=axis) label=label, **kwargs) if iplt%nxplot==0: if units==1: ax.set_ylabel('B [G') Loading
pysen/revision.py +2 −2 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ PySEN revision module """ import sys __version__ = "2.1" __release__ = "b6" __date__ = "Apr 17, 2025" __release__ = "b7" __date__ = "Apr 22, 2025" def version(full=False): "get pysen version number" Loading
pysen/ui/nseplot.py +2 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,8 @@ def add_bfield_options(subparser, parents=None): help='set max chi-square (default=%(default)s)') pars.add_argument('--axis', dest='axis', type=int, help='set axis to plot (default=%(default)s)') pars.add_argument('--show-stats', dest='stats', action='store_true', help='show statistics on field uniformity') def add_qtau_options(subparser, parents=None): "q-tau plot" Loading