Loading README.rst +37 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,42 @@ pysen ------ The pysen package is a collection of Python modules and scripts that aid experiment planning, data collection, reduction, and analysis at the Neutron Spin Echo instrument (SNS-NSE) located at Beam Line 15 of the First Target Station at the Spallation Neutron Source. It may be also useful for any other neutron spin echo experimenter. PySEN is a Python package that aids experiment planning, data collection, reduction, and analysis at the Neutron Spin Echo instrument (SNS-NSE) located at Beam Line 15 of the First Target Station at the Spallation Neutron Source. The PySEN software package is written in Python . It grew out of scripts that were written to aid instrument staff in planning, executing, and evaluating experiments performed at SNS-NSE spectrometer, Oak Ridge National Laboratory, but hopefully will be useful for all NSE users. The source code is available at the ORNL git repository https://code.ornl.gov/zp1/pysen. Installation ------------- PySEN requires Python 3.7 or newer. Table below shows Python packages that are required to run PySEN. One of the simplest methods to install Python is to download Anaconda Python (anaconda.com). |Package | Minimal version | |------------|-----------------| |numpy | 1.16 | |scipy | 1.2 | |matplotlib | 3.0 | |PyQt | 5.0 | |pip | 19.0 | 1. Download PySEN from https://code.ornl.gov/zp1/pysen 2. Open a terminal and navigate to the directory, where PySEN sources reside. 3. Type the following command: `pip install .` or for a “per-user” installation `pip install –user ` pysen/plot/nseplot.py +10 −6 Original line number Diff line number Diff line Loading @@ -110,12 +110,12 @@ taus_11A = [50,70,100,120] # coverage data, a list of coverage statements data = [ # 8A coverage coverage(8.0, qmin=0.050, pos=’p2’, taus=taus_8A ), coverage(8.0, qmin=0.070, pos=’p2’, taus=taus_8A ), coverage(8.0, qmin=0.095, pos=’p2’, taus=taus_8A ), coverage(8.0, qmin=0.050, pos='p2', taus=taus_8A ), coverage(8.0, qmin=0.070, pos='p2', taus=taus_8A ), coverage(8.0, qmin=0.095, pos='p2', taus=taus_8A ), # 11A coverage coverage(11.0, qmin=0.050, pos=’p2’, taus=taus_11A), coverage(11.0, qmin=0.065, pos=’p2’, taus=taus_11A), coverage(11.0, qmin=0.050, pos='p2', taus=taus_11A), coverage(11.0, qmin=0.065, pos='p2', taus=taus_11A), ] """ savefig = kwargs.pop('savefig', None) Loading Loading @@ -158,9 +158,13 @@ data = [ if not data: data = [ coverage(lmax, qmin, pos=pos, mode=mode, tbins=tbins, taus=taus) ] try: cmap = mpl.colormaps.get_cmap(cmap) except AttributeError: pass _ , axes = plt.subplots(figsize=(8,6)) _ , qlim = plot_coverage(axes, *data, center=center, errors=errors, cmap=mpl.colormaps.get_cmap(cmap), full=full) cmap=cmap, full=full) axes.set_ylim(0.9*qlim[0], 1.1*qlim[1]) axes.set_xlabel(r'$\tau$ [ns]') axes.set_ylabel(r'Q [$\AA^{-1}$]') Loading pysen/plot/qplot.py +7 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ from ..constants import ANGSTROM from ..config import pcharge_per_second, wavelength_bandwitdh from ..inout import read_datfile, read_diffrun, read_transmission, read_datreat try: _DEFAULT_CMAP = mpl.colormaps.get_cmap() except AttributeError: _DEFAULT_CMAP = 'hsv' COLOR_MAP = { 0: None, 1: 'k', Loading @@ -40,7 +44,7 @@ def plot_detector_image(axis, results, outfile=None, **kwargs): minz = kwargs.pop('vmin', None) maxz = kwargs.pop('vmax', None) logz = kwargs.pop('logz', False) cmap = kwargs.pop('cmap', mpl.colormaps.get_cmap()) cmap = kwargs.pop('cmap', _DEFAILT norm = kwargs.pop('normalize', None) tbin1 = kwargs.pop('tbin1', 0) tbin2 = kwargs.pop('tbin2', None) Loading Loading @@ -204,7 +208,7 @@ def plot_coverage(axes, *data, **kwargs): center = kwargs.pop('center', False) # plot coverage for the center of the detector full = kwargs.pop('full', False) # plot coverage for the entire detector errors = kwargs.pop('errors', True) # plot "errors" cmap = kwargs.pop('cmap' , mpl.colormaps.get_cmap()) cmap = kwargs.pop('cmap' , _DEFAULT_CMAP) log = logging.getLogger() Loading Loading @@ -279,7 +283,7 @@ def plot_diffrun(axis, filenames, **kwargs): title = 'Diffraction Run Plot' out = None cmap = mpl.colormaps.get_cmap('hsv') cmap = _DEFAULT_CMAP default_ylabel = {'proton_charge' : 'Count Rate [counts/pcharge]', 'pcharge' : 'Count Rate [counts/pcharge]', 'accelerator_power' : 'Count Rate [counts/s] at %.1f MW' % power, 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__ = "1.3" __release__ = ".0" __date__ = "June 23, 2023" __release__ = ".1" __date__ = "July 6 2023" def version(full=False): "get pysen version number" Loading Loading
README.rst +37 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,42 @@ pysen ------ The pysen package is a collection of Python modules and scripts that aid experiment planning, data collection, reduction, and analysis at the Neutron Spin Echo instrument (SNS-NSE) located at Beam Line 15 of the First Target Station at the Spallation Neutron Source. It may be also useful for any other neutron spin echo experimenter. PySEN is a Python package that aids experiment planning, data collection, reduction, and analysis at the Neutron Spin Echo instrument (SNS-NSE) located at Beam Line 15 of the First Target Station at the Spallation Neutron Source. The PySEN software package is written in Python . It grew out of scripts that were written to aid instrument staff in planning, executing, and evaluating experiments performed at SNS-NSE spectrometer, Oak Ridge National Laboratory, but hopefully will be useful for all NSE users. The source code is available at the ORNL git repository https://code.ornl.gov/zp1/pysen. Installation ------------- PySEN requires Python 3.7 or newer. Table below shows Python packages that are required to run PySEN. One of the simplest methods to install Python is to download Anaconda Python (anaconda.com). |Package | Minimal version | |------------|-----------------| |numpy | 1.16 | |scipy | 1.2 | |matplotlib | 3.0 | |PyQt | 5.0 | |pip | 19.0 | 1. Download PySEN from https://code.ornl.gov/zp1/pysen 2. Open a terminal and navigate to the directory, where PySEN sources reside. 3. Type the following command: `pip install .` or for a “per-user” installation `pip install –user `
pysen/plot/nseplot.py +10 −6 Original line number Diff line number Diff line Loading @@ -110,12 +110,12 @@ taus_11A = [50,70,100,120] # coverage data, a list of coverage statements data = [ # 8A coverage coverage(8.0, qmin=0.050, pos=’p2’, taus=taus_8A ), coverage(8.0, qmin=0.070, pos=’p2’, taus=taus_8A ), coverage(8.0, qmin=0.095, pos=’p2’, taus=taus_8A ), coverage(8.0, qmin=0.050, pos='p2', taus=taus_8A ), coverage(8.0, qmin=0.070, pos='p2', taus=taus_8A ), coverage(8.0, qmin=0.095, pos='p2', taus=taus_8A ), # 11A coverage coverage(11.0, qmin=0.050, pos=’p2’, taus=taus_11A), coverage(11.0, qmin=0.065, pos=’p2’, taus=taus_11A), coverage(11.0, qmin=0.050, pos='p2', taus=taus_11A), coverage(11.0, qmin=0.065, pos='p2', taus=taus_11A), ] """ savefig = kwargs.pop('savefig', None) Loading Loading @@ -158,9 +158,13 @@ data = [ if not data: data = [ coverage(lmax, qmin, pos=pos, mode=mode, tbins=tbins, taus=taus) ] try: cmap = mpl.colormaps.get_cmap(cmap) except AttributeError: pass _ , axes = plt.subplots(figsize=(8,6)) _ , qlim = plot_coverage(axes, *data, center=center, errors=errors, cmap=mpl.colormaps.get_cmap(cmap), full=full) cmap=cmap, full=full) axes.set_ylim(0.9*qlim[0], 1.1*qlim[1]) axes.set_xlabel(r'$\tau$ [ns]') axes.set_ylabel(r'Q [$\AA^{-1}$]') Loading
pysen/plot/qplot.py +7 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ from ..constants import ANGSTROM from ..config import pcharge_per_second, wavelength_bandwitdh from ..inout import read_datfile, read_diffrun, read_transmission, read_datreat try: _DEFAULT_CMAP = mpl.colormaps.get_cmap() except AttributeError: _DEFAULT_CMAP = 'hsv' COLOR_MAP = { 0: None, 1: 'k', Loading @@ -40,7 +44,7 @@ def plot_detector_image(axis, results, outfile=None, **kwargs): minz = kwargs.pop('vmin', None) maxz = kwargs.pop('vmax', None) logz = kwargs.pop('logz', False) cmap = kwargs.pop('cmap', mpl.colormaps.get_cmap()) cmap = kwargs.pop('cmap', _DEFAILT norm = kwargs.pop('normalize', None) tbin1 = kwargs.pop('tbin1', 0) tbin2 = kwargs.pop('tbin2', None) Loading Loading @@ -204,7 +208,7 @@ def plot_coverage(axes, *data, **kwargs): center = kwargs.pop('center', False) # plot coverage for the center of the detector full = kwargs.pop('full', False) # plot coverage for the entire detector errors = kwargs.pop('errors', True) # plot "errors" cmap = kwargs.pop('cmap' , mpl.colormaps.get_cmap()) cmap = kwargs.pop('cmap' , _DEFAULT_CMAP) log = logging.getLogger() Loading Loading @@ -279,7 +283,7 @@ def plot_diffrun(axis, filenames, **kwargs): title = 'Diffraction Run Plot' out = None cmap = mpl.colormaps.get_cmap('hsv') cmap = _DEFAULT_CMAP default_ylabel = {'proton_charge' : 'Count Rate [counts/pcharge]', 'pcharge' : 'Count Rate [counts/pcharge]', 'accelerator_power' : 'Count Rate [counts/s] at %.1f MW' % power, 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__ = "1.3" __release__ = ".0" __date__ = "June 23, 2023" __release__ = ".1" __date__ = "July 6 2023" def version(full=False): "get pysen version number" Loading