Skip to content

Commit

Permalink
Merge pull request #33 from prjemian/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
prjemian committed Jan 27, 2015
2 parents 08df563 + 3bbd438 commit a5e9252
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 58 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Change History
Production
**********

:2015.0127.0: ignore bad data lines
:2015.0125.0: change handling of #L & #X, refactor detection of scanNum and scanCmd
:2015.0113.0: dropped requirement of *lxml* package
:2014.1228.1: build mne:name cross-references for counters and positioners
Expand Down
104 changes: 52 additions & 52 deletions src/spec2nexus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# -*- coding: iso-8859-1 -*-

'''command-line tool to convert SPEC data files to NeXus HDF5'''

#-----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: prjemian@gmail.com
# :copyright: (c) 2014-2015, Pete R. Jemian
#
# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------

__version__ = '2015.0125.0'
__release__ = __version__
__author__ = 'Pete R. Jemian'
__email__ = 'prjemian@gmail.com'
__copyright__ = '2015, Pete R. Jemian'

__package_name__ = 'spec2nexus'
__license_url__ = 'http://creativecommons.org/licenses/by/4.0/deed.en_US'
__license__ = 'Creative Commons Attribution 4.0 International Public License (see LICENSE file)'
__description__ = 'Converts SPEC data files and scans into NeXus HDF5 files'
__author_name__ = __author__
__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']

__install_requires__ = ('h5py','numpy', )
__classifiers__ = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: Freely Distributable',
'License :: Public Domain',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development',
'Topic :: Utilities',
]
# -*- coding: iso-8859-1 -*-

'''command-line tool to convert SPEC data files to NeXus HDF5'''

#-----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: prjemian@gmail.com
# :copyright: (c) 2014-2015, Pete R. Jemian
#
# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------

__version__ = '2015.0127.0'
__release__ = __version__
__author__ = 'Pete R. Jemian'
__email__ = 'prjemian@gmail.com'
__copyright__ = '2014-2015, Pete R. Jemian'

__package_name__ = 'spec2nexus'
__license_url__ = 'http://creativecommons.org/licenses/by/4.0/deed.en_US'
__license__ = 'Creative Commons Attribution 4.0 International Public License (see LICENSE file)'
__description__ = 'Converts SPEC data files and scans into NeXus HDF5 files'
__author_name__ = __author__
__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']

__install_requires__ = ('h5py','numpy', )
__classifiers__ = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: Freely Distributable',
'License :: Public Domain',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development',
'Topic :: Utilities',
]
15 changes: 9 additions & 6 deletions src/spec2nexus/plugins/spec_common_spec2nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def process(self, text, scan, *args, **kws):

def writer(self, h5parent, writer, scan, *args, **kws):
'''Describe how to store this data in an HDF5 NeXus file'''
write_dataset(h5parent, "comments", '\n'.join(scan.comments))
write_dataset(h5parent, "comments", '\n'.join(map(str, scan.comments)))

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Expand Down Expand Up @@ -1005,11 +1005,14 @@ def data_lines_postprocessing(scan):
mca_spectrum = map(float, values[2:].split())
scan.data['_mca_'].append(mca_spectrum)
else:
buf = scan._interpret_data_row(values)
if len(buf) == num_columns:
# only keep complete rows
for label, val in buf.items():
scan.data[label].append(val)
try:
buf = scan._interpret_data_row(values)
if len(buf) == num_columns:
# only keep complete rows
for label, val in buf.items():
scan.data[label].append(val)
except ValueError, exc:
pass # ignore bad data lines (could save it as such ...)
scan.addH5writer('scan data', data_lines_writer)


Expand Down

0 comments on commit a5e9252

Please sign in to comment.