Skip to content

Commit

Permalink
set attributes on group, not parent; indicate NIAC2014 attributes in
Browse files Browse the repository at this point in the history
docstrings
  • Loading branch information
prjemian committed Feb 11, 2016
1 parent a12970f commit ae193c0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/spec2nexus/eznx.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
::
In [1]: from spec2nexus import eznx
In [2]: root = eznx.makeFile('test.h5', creator='eznx')
In [2]: root = eznx.makeFile('test.h5', creator='eznx', default='entry')
In [3]: nxentry = eznx.makeGroup(root, 'entry', 'NXentry')
In [4]: eznx.write_dataset(nxentry, 'title', 'simple test data')
In [4]: eznx.write_dataset(nxentry, 'title', 'simple test data', default='data')
Out[4]: <HDF5 dataset "title": shape (), type "|O8">
In [5]: nxdata = eznx.makeGroup(nxentry, 'data', 'NXdata')
In [5]: nxdata = eznx.makeGroup(nxentry, 'data', 'NXdata', signal='counts', axes='tth', tth_indices=[0,])
In [6]: eznx.write_dataset(nxdata, 'tth', [10.0, 10.1, 10.2, 10.3], units='degrees')
Out[6]: <HDF5 dataset "tth": shape (4,), type "<f8">
In [7]: eznx.write_dataset(nxdata, 'counts', [1, 50, 1000, 5], signal=1, axes='tth', units='counts')
In [7]: eznx.write_dataset(nxdata, 'counts', [1, 50, 1000, 5], units='counts')
Out[7]: <HDF5 dataset "counts": shape (4,), type "<i8">
In [8]: root.close()
Expand All @@ -52,14 +52,18 @@
test.h5:NeXus data file
@creator = eznx
@default = 'entry'
entry:NXentry
@NX_class = NXentry
@default = 'data'
title:NX_data = simple test data
data:NXdata
@NX_class = NXdata
@signal = 'counts'
@axes = 'tth'
@axes_indices = [0,]
counts:NX_INT64[4] = [1, 50, 1000, 5]
@units = counts
@signal = 1
@axes = tth
tth:NX_FLOAT64[4] = [10.0, 10.1, 10.199999999999999, 10.300000000000001]
@units = degrees
Expand Down Expand Up @@ -122,7 +126,7 @@ def openGroup(parent, name, nx_class, **attr):
'''
try:
group = parent[name]
addAttributes(parent, **attr)
addAttributes(group, **attr)
except KeyError:
group = makeGroup(parent, name, nx_class, **attr)
return group
Expand Down

0 comments on commit ae193c0

Please sign in to comment.