Loading examples/macro_consolidate +22 −9 Original line number Diff line number Diff line macro set r.postcoll_qcat 0.005e+10 ! ==== set paths ! datapath ./examples ! savepath ./out clear all ! ==== set binning bins pix nbins 8 Loading @@ -15,8 +10,8 @@ bins tof custom 2 13 26 39 set A 1e-10 set ns 1e-9 histo tau nbins 20 min 0.002*ns max 200.0*ns log histo q nbins 20 min 0.000/A max 0.5/A histo tau nbins 20 min 0.002*ns max 200.0*ns log ! histo q nbins 15 min 0.05/A max 0.35/A ! dq = 0.02 c ==== read data read s5848.echo s5849.echo s5850.echo s5851.echo s5852.echo s5853.echo as resolution Loading @@ -26,7 +21,25 @@ c === process match all fit res fit sam flag offset collect to test_0p005.dat collect histo tau iterate maxbins 50 xcatch 0.2 histo ! consolidate_colldata off set r.postcoll_qcat 0.000/A collect to testc_0p000.dat cp sqtmap.pdf testc_0p000_map.pdf histo ! consolidate_colldata same dq as binning dq/2 set r.postcoll_qcat 0.010/A collect to testc_0p010.dat cp sqtmap.pdf testc_0p010_map.pdf histo quit examples/q_binning_example.py 0 → 100755 +22 −0 Original line number Diff line number Diff line #!/usr/bin/env python import matplotlib.pyplot as plt import drspine data = [ # label filename ('IPTS-23530', '/home/zp1/Wrk/SpinEcho/ipts-23530/sample1_32C_bin.dat' ), ('IPTS-26896', '/home/zp1/Wrk/SpinEcho/ipts-26896-kuochih/sample1_45C_bin.dat'), ] for label, filename in data: drspine.plot_q(filename, logbin=True, bins=21, norm='sqt', density=True, histtype='step', label=label) plt.xscale('log') plt.yscale('log') plt.legend() plt.xlim(0.01,0.2) plt.show() python/drspine/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,6 @@ __all__ = ['plot_sqt', 'plot_sqt_bin', 'plot_chi2', 'plot_fits', 'plot_maps', 'plot_fit_pixel', 'plot_fit_map', 'drspine_version'] from .drspine import plot_sqt , plot_sqt_bin, plot_chi2, plot_q, plot_qvec, plot_qmap from .drspine import plot_sqt , plot_sqt_bin, plot_chi2, plot_q, plot_qvec, plot_qmap, load_sqt_bin from .fits import plot_fits, plot_maps, plot_fit_pixel, plot_fit_map from .version import __version__ as drspine_version python/drspine/drspine.py +28 −9 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ def plot_sqt(filename, **kwargs): #15,16 : chisq (res), chisq (sig) #17 : run_number #18-20 : q_vec def _load_sqt_bin(filename, full_bw=False): def load_sqt_bin(filename, full_bw=False): s = load_txt(filename, delimiter=',', cleanup=['NaN', 'Infinity']) if full_bw: Loading Loading @@ -308,7 +308,7 @@ def _plot_chi2_theory(bins, ndf, fmt='.', color='k', label=None): def plot_chi2(filename, chimax=100.0, nbins=101, ndf=19, full_bw=True): d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) label = '' if full_bw: label = '(full bw)' Loading @@ -328,17 +328,32 @@ def plot_chi2(filename, chimax=100.0, nbins=101, ndf=19, full_bw=True): plt.ylabel(r'Q [$\AA$]') plt.legend(loc='best') def _plot_q_helper(filename, full_bw, **kwargs): pass def plot_q(filename, full_bw=False, **kwargs): """plot q, i.e. histograms of abs(q)""" d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) bins = kwargs.pop('bins', 41) histtype = kwargs.pop('histtype', 'step') histtype = kwargs.pop('histtype', 'bar') norm = kwargs.pop('norm', None) logbin = kwargs.pop('logbin', False) q = d[:, 4] if norm=='sqt': w = 1/abs(d[:,6]) else: w = d[:,11] + d[:,13] q = d[:, 4] if isinstance(bins, int): q1, q2 = min(q), max(q) if logbin: bins = np.logspace(np.log10(q1), np.log10(q2), bins) else: bins = np.linspace(q1, q2, bins) plt.hist(q, weights=w, bins=bins, histtype=histtype, **kwargs) plt.grid(True, which='both') Loading @@ -347,11 +362,15 @@ def plot_q(filename, full_bw=False, **kwargs): def plot_qvec(filename, full_bw=False, **kwargs): """plot qvec, i.e. histograms of qx,qy and qz""" d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) bins = kwargs.pop('bins', 41) histtype = kwargs.pop('histtype', 'step') histtype = kwargs.pop('histtype', 'bar') norm = kwargs.pop('norm', None) q = d[:,18:21] if norm=='sqt': w = 1/abs(d[:,6]) else: w = d[:,11] + d[:,13] plt.hist(q[:,0], weights=w, bins=bins, histtype=histtype, label=r'$q_x$', **kwargs) Loading @@ -377,7 +396,7 @@ def plot_qmap(filename, full_bw=False, **kwargs): 'y': 2, 'z': 3,} d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) bins = kwargs.pop('bins', 41) maptype = kwargs.pop('type', 'yx') Loading Loading
examples/macro_consolidate +22 −9 Original line number Diff line number Diff line macro set r.postcoll_qcat 0.005e+10 ! ==== set paths ! datapath ./examples ! savepath ./out clear all ! ==== set binning bins pix nbins 8 Loading @@ -15,8 +10,8 @@ bins tof custom 2 13 26 39 set A 1e-10 set ns 1e-9 histo tau nbins 20 min 0.002*ns max 200.0*ns log histo q nbins 20 min 0.000/A max 0.5/A histo tau nbins 20 min 0.002*ns max 200.0*ns log ! histo q nbins 15 min 0.05/A max 0.35/A ! dq = 0.02 c ==== read data read s5848.echo s5849.echo s5850.echo s5851.echo s5852.echo s5853.echo as resolution Loading @@ -26,7 +21,25 @@ c === process match all fit res fit sam flag offset collect to test_0p005.dat collect histo tau iterate maxbins 50 xcatch 0.2 histo ! consolidate_colldata off set r.postcoll_qcat 0.000/A collect to testc_0p000.dat cp sqtmap.pdf testc_0p000_map.pdf histo ! consolidate_colldata same dq as binning dq/2 set r.postcoll_qcat 0.010/A collect to testc_0p010.dat cp sqtmap.pdf testc_0p010_map.pdf histo quit
examples/q_binning_example.py 0 → 100755 +22 −0 Original line number Diff line number Diff line #!/usr/bin/env python import matplotlib.pyplot as plt import drspine data = [ # label filename ('IPTS-23530', '/home/zp1/Wrk/SpinEcho/ipts-23530/sample1_32C_bin.dat' ), ('IPTS-26896', '/home/zp1/Wrk/SpinEcho/ipts-26896-kuochih/sample1_45C_bin.dat'), ] for label, filename in data: drspine.plot_q(filename, logbin=True, bins=21, norm='sqt', density=True, histtype='step', label=label) plt.xscale('log') plt.yscale('log') plt.legend() plt.xlim(0.01,0.2) plt.show()
python/drspine/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,6 @@ __all__ = ['plot_sqt', 'plot_sqt_bin', 'plot_chi2', 'plot_fits', 'plot_maps', 'plot_fit_pixel', 'plot_fit_map', 'drspine_version'] from .drspine import plot_sqt , plot_sqt_bin, plot_chi2, plot_q, plot_qvec, plot_qmap from .drspine import plot_sqt , plot_sqt_bin, plot_chi2, plot_q, plot_qvec, plot_qmap, load_sqt_bin from .fits import plot_fits, plot_maps, plot_fit_pixel, plot_fit_map from .version import __version__ as drspine_version
python/drspine/drspine.py +28 −9 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ def plot_sqt(filename, **kwargs): #15,16 : chisq (res), chisq (sig) #17 : run_number #18-20 : q_vec def _load_sqt_bin(filename, full_bw=False): def load_sqt_bin(filename, full_bw=False): s = load_txt(filename, delimiter=',', cleanup=['NaN', 'Infinity']) if full_bw: Loading Loading @@ -308,7 +308,7 @@ def _plot_chi2_theory(bins, ndf, fmt='.', color='k', label=None): def plot_chi2(filename, chimax=100.0, nbins=101, ndf=19, full_bw=True): d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) label = '' if full_bw: label = '(full bw)' Loading @@ -328,17 +328,32 @@ def plot_chi2(filename, chimax=100.0, nbins=101, ndf=19, full_bw=True): plt.ylabel(r'Q [$\AA$]') plt.legend(loc='best') def _plot_q_helper(filename, full_bw, **kwargs): pass def plot_q(filename, full_bw=False, **kwargs): """plot q, i.e. histograms of abs(q)""" d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) bins = kwargs.pop('bins', 41) histtype = kwargs.pop('histtype', 'step') histtype = kwargs.pop('histtype', 'bar') norm = kwargs.pop('norm', None) logbin = kwargs.pop('logbin', False) q = d[:, 4] if norm=='sqt': w = 1/abs(d[:,6]) else: w = d[:,11] + d[:,13] q = d[:, 4] if isinstance(bins, int): q1, q2 = min(q), max(q) if logbin: bins = np.logspace(np.log10(q1), np.log10(q2), bins) else: bins = np.linspace(q1, q2, bins) plt.hist(q, weights=w, bins=bins, histtype=histtype, **kwargs) plt.grid(True, which='both') Loading @@ -347,11 +362,15 @@ def plot_q(filename, full_bw=False, **kwargs): def plot_qvec(filename, full_bw=False, **kwargs): """plot qvec, i.e. histograms of qx,qy and qz""" d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) bins = kwargs.pop('bins', 41) histtype = kwargs.pop('histtype', 'step') histtype = kwargs.pop('histtype', 'bar') norm = kwargs.pop('norm', None) q = d[:,18:21] if norm=='sqt': w = 1/abs(d[:,6]) else: w = d[:,11] + d[:,13] plt.hist(q[:,0], weights=w, bins=bins, histtype=histtype, label=r'$q_x$', **kwargs) Loading @@ -377,7 +396,7 @@ def plot_qmap(filename, full_bw=False, **kwargs): 'y': 2, 'z': 3,} d = _load_sqt_bin(filename, full_bw) d = load_sqt_bin(filename, full_bw) bins = kwargs.pop('bins', 41) maptype = kwargs.pop('type', 'yx') Loading