Loading pysen/revision.py +2 −2 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ PySEN revision module """ import sys __version__ = "0.7.6" __version__ = "0.7.7" __release__ = "dev1" __date__ = "Feb 15, 2019" __date__ = "Feb 18, 2019" # VERSION = __version__ RELEASE = __release__ Loading scripts/nseplot.py +21 −14 Original line number Diff line number Diff line Loading @@ -42,15 +42,14 @@ def plot_field(ax,t,v,**kwargs): diag = cov[0,0]*cov[1,1] r = cov[1,0]/np.sqrt(diag) if diag>0 else np.nan #r = np.corrcoef(t,v0)[1,0] #maxd = max(abs(v0-v1)) maxd = max(abs(v0-v1)) descr1 = r'a=%.2e b=%.3g' % (a, b) descr2 = r'$\rho$=%.3g $\chi^2$=%.1e' % (r, chi2) #descr2 = r'$\rho$=%.3g $\chi^2$=%.1e $(\Delta B)_{max}$=%.3g' % (r, chi2, maxd) # va = np.average(v0) va = np.average((max(v0), min(v0))) vd = max(abs(v0-va)) vmin = va-max(vd,0.5) vmax = va+max(vd,0.5) vmin = va-max(vd,1.5) vmax = va+max(vd,1.5) ax.plot(t,v0, '.--', lw=1, label=label) ax.plot(t,v1, '-') ax.set_ylim(bottom=vmin, top=vmax) Loading @@ -58,10 +57,17 @@ def plot_field(ax,t,v,**kwargs): ax.text(0.05,0.10,descr2, transform=ax.transAxes, fontsize=7) ax.grid(True, lw=0.5) ax.legend(loc='upper left') # derivative #vp = (v0[1:]-v0[:-1])/(t[1:]-t[:-1]) #ax2 = ax.twinx() #ax2.plot(t[1:],vp, 'k.--') #ax2.set_ylim(bottom=-1,top=1) # res = True if chi2>max_chi2: ax.set_facecolor('yellow') return False, chi2 return True, chi2 res = False return res, dict(chi2=chi2, maxd=maxd, corr=r, slope=a, offset=b) def magnetic_fields_plot(hdfile, iecho=0, **kwargs): "plot magnetic fields" Loading Loading @@ -103,15 +109,17 @@ def magnetic_fields_plot(hdfile, iecho=0, **kwargs): fig.subplots_adjust(hspace=0.4, wspace=0.4) fig.suptitle(r'%s | %s | $\lambda$=%.2g$\AA$ $Q$=%.3f$\AA^{-1}$ $\tau$=%.3fns' % (sample, base, lam0/ANGSTROM, q0, tau0)) log = logging.getLogger() for iplt, bsensor in enumerate(bfield): bmag = bfield[bsensor] label = bsensor.split('.')[-1] ax = axes[iplt//nxplot,iplt%nxplot] res, chi2 = plot_field(ax, dj[first_point:nph]/MICRO, bmag[first_point:nph,:]*GAUSS/MICRO, label=label, max_chi2=max_chi2) if not res: log.warning('*** field variation detected %s %s', label,chi2) ok, res = plot_field(ax, dj[first_point:nph]/MICRO, bmag[first_point:nph,:]*GAUSS/MICRO, label=label, max_chi2=max_chi2) if not ok: log.warning('*** large B variation %s %s tau=%.3gns sensor=%s chi2=%.3g', base, echo.attrs['id'] , tau0, label,res['chi2']) #print("%s %2d %8.3g %8.3g %8.3g # %s" % (base, echo.attrs['id'], tau0, res['chi2'], res['maxd'], label)) for iplt in range(iplt+1, nxplot*nyplot): ax = axes[iplt//nxplot,iplt%nxplot] ax.axis('off') Loading Loading @@ -421,9 +429,8 @@ def echo_plot(hdfile, iecho=0, **kwargs): res = np.asarray(resolution) ax.plot(res[:,0],res[:,1], '.--') ax.set_xscale('log') ax.set_yscale('log') ax.set_ylim(bottom=min(0.1,min(res[:,1])), top=max(1.1,max(res[:,1]))) #ax.set_yscale('log') ax.set_ylim(bottom=min(0.1,min(res[:,1])), top=max(1.1,max(res[:,1]))) ax.grid(True) def setup_logger(loglevel): Loading Loading
pysen/revision.py +2 −2 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ PySEN revision module """ import sys __version__ = "0.7.6" __version__ = "0.7.7" __release__ = "dev1" __date__ = "Feb 15, 2019" __date__ = "Feb 18, 2019" # VERSION = __version__ RELEASE = __release__ Loading
scripts/nseplot.py +21 −14 Original line number Diff line number Diff line Loading @@ -42,15 +42,14 @@ def plot_field(ax,t,v,**kwargs): diag = cov[0,0]*cov[1,1] r = cov[1,0]/np.sqrt(diag) if diag>0 else np.nan #r = np.corrcoef(t,v0)[1,0] #maxd = max(abs(v0-v1)) maxd = max(abs(v0-v1)) descr1 = r'a=%.2e b=%.3g' % (a, b) descr2 = r'$\rho$=%.3g $\chi^2$=%.1e' % (r, chi2) #descr2 = r'$\rho$=%.3g $\chi^2$=%.1e $(\Delta B)_{max}$=%.3g' % (r, chi2, maxd) # va = np.average(v0) va = np.average((max(v0), min(v0))) vd = max(abs(v0-va)) vmin = va-max(vd,0.5) vmax = va+max(vd,0.5) vmin = va-max(vd,1.5) vmax = va+max(vd,1.5) ax.plot(t,v0, '.--', lw=1, label=label) ax.plot(t,v1, '-') ax.set_ylim(bottom=vmin, top=vmax) Loading @@ -58,10 +57,17 @@ def plot_field(ax,t,v,**kwargs): ax.text(0.05,0.10,descr2, transform=ax.transAxes, fontsize=7) ax.grid(True, lw=0.5) ax.legend(loc='upper left') # derivative #vp = (v0[1:]-v0[:-1])/(t[1:]-t[:-1]) #ax2 = ax.twinx() #ax2.plot(t[1:],vp, 'k.--') #ax2.set_ylim(bottom=-1,top=1) # res = True if chi2>max_chi2: ax.set_facecolor('yellow') return False, chi2 return True, chi2 res = False return res, dict(chi2=chi2, maxd=maxd, corr=r, slope=a, offset=b) def magnetic_fields_plot(hdfile, iecho=0, **kwargs): "plot magnetic fields" Loading Loading @@ -103,15 +109,17 @@ def magnetic_fields_plot(hdfile, iecho=0, **kwargs): fig.subplots_adjust(hspace=0.4, wspace=0.4) fig.suptitle(r'%s | %s | $\lambda$=%.2g$\AA$ $Q$=%.3f$\AA^{-1}$ $\tau$=%.3fns' % (sample, base, lam0/ANGSTROM, q0, tau0)) log = logging.getLogger() for iplt, bsensor in enumerate(bfield): bmag = bfield[bsensor] label = bsensor.split('.')[-1] ax = axes[iplt//nxplot,iplt%nxplot] res, chi2 = plot_field(ax, dj[first_point:nph]/MICRO, bmag[first_point:nph,:]*GAUSS/MICRO, label=label, max_chi2=max_chi2) if not res: log.warning('*** field variation detected %s %s', label,chi2) ok, res = plot_field(ax, dj[first_point:nph]/MICRO, bmag[first_point:nph,:]*GAUSS/MICRO, label=label, max_chi2=max_chi2) if not ok: log.warning('*** large B variation %s %s tau=%.3gns sensor=%s chi2=%.3g', base, echo.attrs['id'] , tau0, label,res['chi2']) #print("%s %2d %8.3g %8.3g %8.3g # %s" % (base, echo.attrs['id'], tau0, res['chi2'], res['maxd'], label)) for iplt in range(iplt+1, nxplot*nyplot): ax = axes[iplt//nxplot,iplt%nxplot] ax.axis('off') Loading Loading @@ -421,9 +429,8 @@ def echo_plot(hdfile, iecho=0, **kwargs): res = np.asarray(resolution) ax.plot(res[:,0],res[:,1], '.--') ax.set_xscale('log') ax.set_yscale('log') ax.set_ylim(bottom=min(0.1,min(res[:,1])), top=max(1.1,max(res[:,1]))) #ax.set_yscale('log') ax.set_ylim(bottom=min(0.1,min(res[:,1])), top=max(1.1,max(res[:,1]))) ax.grid(True) def setup_logger(loglevel): Loading