Loading README.rst→README.md +6 −7 Original line number Diff line number Diff line pysen ------ ------- 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 Loading @@ -11,23 +11,22 @@ to aid instrument staff in planning, executing, and evaluating experiments perfo 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 ------------- ## 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 | |h5py | 2.9 | |pandas | 0.24 | |PyQt | 5.9 | |pip | 19.0 | ### Steps 1. Download PySEN from https://code.ornl.gov/zp1/pysen Loading pysen/plot/__init__.py +1 −1 Original line number Diff line number Diff line """ plotting subpackage """ from .plotutil import get_nsubplots # NOQA from .plotutil import get_nsubplots, get_colormap # NOQA from .qplot import ( plot_coverage, plot_curscan, # NOQA plot_diffrun , plot_transmission, # NOQA plot_datreat) # NOQA Loading pysen/plot/nseplot.py +14 −18 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ import logging import h5py import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from pysen import version, setup_logger, DEFAULT_LOG_LEVEL Loading @@ -22,7 +21,8 @@ from pysen.echo import get_symmetry_phase, make_phase_table from pysen.plot import ( plot_echo, plot_atari, plot_map, plot_xyz, plot_magnetic_fields, plot_coverage, plot_diffrun, plot_transmission, plot_datreat) plot_diffrun, plot_transmission, plot_datreat, get_colormap) def action_default(filenames, **kwargs): "default action for echo, atari, etc" Loading Loading @@ -143,7 +143,6 @@ data = [ if max_limits: print('this is not yet implemented') return else: try: lcls = locals() lcls['np'] = np Loading @@ -158,10 +157,7 @@ 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 cmap = get_colormap(cmap) _ , axes = plt.subplots(figsize=(8,6)) _ , qlim = plot_coverage(axes, *data, center=center, errors=errors, cmap=cmap, full=full) Loading pysen/plot/nseplotlib.py +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ def plot_magnetic_fields(hdfile, iecho=None, **kwargs): 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(reversed(bfield)): bfield_list = list(bfield) for iplt, bsensor in enumerate(reversed(bfield_list)): bmag = bfield[bsensor] label = bsensor.split('.')[-1] ax = axes[iplt//nxplot,iplt%nxplot] Loading pysen/plot/plotutil.py +27 −8 Original line number Diff line number Diff line Loading @@ -4,14 +4,33 @@ plot utilities import math import numpy as np # def get_color(color): # "Get consistent colors for plotting" # import colorsys # while True: # for hue in range(color): # hue = 1. * hue / float(color) # col = [int(x) for x in colorsys.hsv_to_rgb(hue, 0.667, 230)] # yield "#{0:02x}{1:02x}{2:02x}".format(*col) import matplotlib as mpl from matplotlib import cm try: _colormaps = mpl.colormaps def get_colormap(cmap='hsv'): "get color map (new matplotlib 3.7+)" return _colormaps.get_cmap(cmap) except AttributeError: def get_colormap(cmap=None): "get color map (old matplotlib)" cmap = cmap or 'hsv' # this is a hack return cm.__dict__[cmap] DEFAULT_CMAP = get_colormap() CURSCAN_CMAP = { 0: None, 1: 'k', 2: 'r', 3: 'g', 4: 'b', 5: 'c', 6: 'm' } ALPHA_TRANSPARENT=0.1 # for coverage ALPHA_OPAQUE=0.9 def get_nsubplots(nplots): Loading Loading
README.rst→README.md +6 −7 Original line number Diff line number Diff line pysen ------ ------- 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 Loading @@ -11,23 +11,22 @@ to aid instrument staff in planning, executing, and evaluating experiments perfo 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 ------------- ## 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 | |h5py | 2.9 | |pandas | 0.24 | |PyQt | 5.9 | |pip | 19.0 | ### Steps 1. Download PySEN from https://code.ornl.gov/zp1/pysen Loading
pysen/plot/__init__.py +1 −1 Original line number Diff line number Diff line """ plotting subpackage """ from .plotutil import get_nsubplots # NOQA from .plotutil import get_nsubplots, get_colormap # NOQA from .qplot import ( plot_coverage, plot_curscan, # NOQA plot_diffrun , plot_transmission, # NOQA plot_datreat) # NOQA Loading
pysen/plot/nseplot.py +14 −18 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ import logging import h5py import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from pysen import version, setup_logger, DEFAULT_LOG_LEVEL Loading @@ -22,7 +21,8 @@ from pysen.echo import get_symmetry_phase, make_phase_table from pysen.plot import ( plot_echo, plot_atari, plot_map, plot_xyz, plot_magnetic_fields, plot_coverage, plot_diffrun, plot_transmission, plot_datreat) plot_diffrun, plot_transmission, plot_datreat, get_colormap) def action_default(filenames, **kwargs): "default action for echo, atari, etc" Loading Loading @@ -143,7 +143,6 @@ data = [ if max_limits: print('this is not yet implemented') return else: try: lcls = locals() lcls['np'] = np Loading @@ -158,10 +157,7 @@ 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 cmap = get_colormap(cmap) _ , axes = plt.subplots(figsize=(8,6)) _ , qlim = plot_coverage(axes, *data, center=center, errors=errors, cmap=cmap, full=full) Loading
pysen/plot/nseplotlib.py +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ def plot_magnetic_fields(hdfile, iecho=None, **kwargs): 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(reversed(bfield)): bfield_list = list(bfield) for iplt, bsensor in enumerate(reversed(bfield_list)): bmag = bfield[bsensor] label = bsensor.split('.')[-1] ax = axes[iplt//nxplot,iplt%nxplot] Loading
pysen/plot/plotutil.py +27 −8 Original line number Diff line number Diff line Loading @@ -4,14 +4,33 @@ plot utilities import math import numpy as np # def get_color(color): # "Get consistent colors for plotting" # import colorsys # while True: # for hue in range(color): # hue = 1. * hue / float(color) # col = [int(x) for x in colorsys.hsv_to_rgb(hue, 0.667, 230)] # yield "#{0:02x}{1:02x}{2:02x}".format(*col) import matplotlib as mpl from matplotlib import cm try: _colormaps = mpl.colormaps def get_colormap(cmap='hsv'): "get color map (new matplotlib 3.7+)" return _colormaps.get_cmap(cmap) except AttributeError: def get_colormap(cmap=None): "get color map (old matplotlib)" cmap = cmap or 'hsv' # this is a hack return cm.__dict__[cmap] DEFAULT_CMAP = get_colormap() CURSCAN_CMAP = { 0: None, 1: 'k', 2: 'r', 3: 'g', 4: 'b', 5: 'c', 6: 'm' } ALPHA_TRANSPARENT=0.1 # for coverage ALPHA_OPAQUE=0.9 def get_nsubplots(nplots): Loading