Skip to content

Commit

Permalink
Merge pull request #58 from prjemian/specplot_56
Browse files Browse the repository at this point in the history
add specplot support as used by the USAXS instrument
  • Loading branch information
prjemian committed Jun 14, 2016
2 parents a5666b8 + e995a79 commit acc7c4e
Show file tree
Hide file tree
Showing 12 changed files with 802 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ nosetests.xml
# Mr Developer
.mr.developer.cfg
/.settings
/src/spec2nexus/__plots__
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Converts SPEC data files and scans into NeXus HDF5 files

:author: Pete R. Jemian
:email: prjemian@gmail.com
:copyright: 2014-2015, Pete R. Jemian
:copyright: 2014-2016, Pete R. Jemian
:license: Creative Commons Attribution 4.0 International Public License (see *LICENSE.txt*)
:URL: http://spec2nexus.readthedocs.io
:git: https://github.com/prjemian/spec2nexus
Expand All @@ -21,6 +21,8 @@ Provides
* **pySpec** : library: python binding to read SPEC [#]_ data files
* **prjPySpec** : library: legacy version of **pySpec**, frozen at version 2014.0623.0
* **eznx** : library: (Easy NeXus) supports writing NeXus [#]_ HDF5 [#]_ files using h5py [#]_
* **specplot** : command-line tool: plot a SPEC scan to an image file
* **specplot_gallery** : command-line tool: call **specplot** for all scans in a list of files, makes a web gallery

.. [#] http://certif.com
.. [#] http://nexusformat.org
Expand Down
9 changes: 8 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,12 @@ def __getattr__(cls, name):
else:
return Mock()

for mod_name in spec2nexus.__install_requires__:
mocks = list(spec2nexus.__install_requires__)
mocks.append('matplotlib')
mocks.append('matplotlib.backends')
mocks.append('matplotlib.backends.backend_agg')
mocks.append('numpy')
mocks.append('numpy.ma')

for mod_name in mocks:
sys.modules[mod_name] = Mock()
2 changes: 2 additions & 0 deletions docs/source/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Contents
h5toText
extractSpecScan
spec
specplot
specplot_gallery
eznx
plugin
utils
Expand Down
13 changes: 13 additions & 0 deletions docs/source/specplot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _specplot:

:mod:`spec2nexus.specplot`
##########################

Read a SPEC data file and plot a thumbnail image.

source code documentation
=========================

.. automodule:: spec2nexus.specplot
:members:
:synopsis: read a SPEC data file and plot a thumbnail image
19 changes: 19 additions & 0 deletions docs/source/specplot_gallery.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. _specplot_gallery:

:mod:`spec2nexus.specplot_gallery`
###################################

Read a list of SPEC data file and plot images of all scans

Suggest running this from a cron task every 5 minutes:

.. literalinclude:: ../../src/spec2nexus/specplot_shell_script.sh
:language: bash
:linenos:

source code documentation
=========================

.. automodule:: spec2nexus.specplot_gallery
:members:
:synopsis: Calls :mod:`spec2nexus.specplot` on a list of files. Makes a web gallery.
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
'spec2nexus=spec2nexus.nexus:main',
'h5toText=spec2nexus.h5toText:main',
'extractSpecScan=spec2nexus.extractSpecScan:main',
'specplot=spec2nexus.specplot:main',
'specplot_files=spec2nexus.specplot_files:main',
],
#'gui_scripts': [],
},
Expand Down
4 changes: 2 additions & 2 deletions src/spec2nexus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
__author_email__ = __email__
__url__ = u'http://spec2nexus.readthedocs.org'
#__download_url__ = u'https://github.com/prjemian/spec2nexus/tarball/' + __version__
__keywords__ = ['SPEC', 'diffraction', 'data acquisition', 'NeXus', 'HDF5']
__keywords__ = ['SPEC', 'diffraction', 'data acquisition', 'NeXus', 'HDF5', 'MatPlotLib']

__install_requires__ = ('h5py','numpy', )
__install_requires__ = ('h5py','numpy', 'MatPlotLib', )
__classifiers__ = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
Expand Down
7 changes: 6 additions & 1 deletion src/spec2nexus/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,12 @@ def __getattribute__(self, attr):
if self.__lazy_interpret__:
self.interpret()
return object.__getattribute__(self, attr)


def get_macro_name(self):
'''
name of the SPEC macro used for this scan
'''
return self.scanCmd.split()[0]

def interpret(self):
"""interpret the supplied buffer with the spec scan data"""
Expand Down

0 comments on commit acc7c4e

Please sign in to comment.