Skip to content

Commit

Permalink
fixes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Feb 4, 2016
1 parent a69caa1 commit a67fa60
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Change History
Production
**********

:2016.0204.0: handle case when no data points in scan (`issue #45 <https://github.com/prjemian/spec2nexus/issues/45>`_),
spec.getScan() ensures argument is used as ``str`` (`issue #46 <https://github.com/prjemian/spec2nexus/issues/46>`_)
:2016.0201.0: added spec.getScanNumbersChronological(), spec.getFirstScanNumber(), and spec.getLastScanNumber()
:2016.0131.0: support new NeXus method for default/signal/axes/_indices,
`issue #43 <https://github.com/prjemian/spec2nexus/issues/43>`_
Expand Down
24 changes: 24 additions & 0 deletions src/spec2nexus/dev_nexus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''developer test for nexus'''

#-----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: prjemian@gmail.com
# :copyright: (c) 2014-2016, 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.
#-----------------------------------------------------------------------------


import sys
import nexus

args = 'data/02_03_setup.dat -f --verbose -s 46'
for _ in args.split():
sys.argv.append(_)

nexus.main()
20 changes: 20 additions & 0 deletions src/spec2nexus/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ def save(self, hdf_file, scan_list=[]):
if pick_first_entry:
pick_first_entry = False
eznx.addAttributes(root, default='S'+str(key))
if 'data' not in nxentry:
# resolve issue #45 here
# NXentry MUST have a NXdata group with data for default plot
nxdata = eznx.makeGroup(nxentry,
'data',
'NXdata',
signal='no_y_data',
axes='no_x_data',
no_x_data_indices=[0,],
)
eznx.makeDataset(nxdata,
"no_x_data",
(0, 1),
units='none',
long_name='no data points in this scan')
eznx.makeDataset(nxdata,
"no_y_data",
(0, 1),
units='none',
long_name='no data points in this scan')
root.close() # be CERTAIN to close the file

def root_attributes(self):
Expand Down

0 comments on commit a67fa60

Please sign in to comment.