summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcom-sixs <com-sixs@synchrotron-soleil.fr>2017-05-04 10:41:29 +0200
committercom-sixs <com-sixs@synchrotron-soleil.fr>2017-05-04 10:41:29 +0200
commit55913fcbdfe22a8303890c5675eca5403d7bbf07 (patch)
tree0008768f4de0d70bb80ed8150d1c9bf0da3bf6b2
parent44333527d3e184b0f06eace7bcd5ddd42d4036e6 (diff)
deal with the new string encodage in the hdf5 files from SOLEIL.
-rw-r--r--binoculars/backends/sixs.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/binoculars/backends/sixs.py b/binoculars/backends/sixs.py
index d3b08d1..2de8738 100644
--- a/binoculars/backends/sixs.py
+++ b/binoculars/backends/sixs.py
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
- Copyright (C) 2015 Synchrotron SOLEIL
+ Copyright (C) 2015-2017 Synchrotron SOLEIL
L'Orme des Merisiers Saint-Aubin
BP 48 91192 GIF-sur-YVETTE CEDEX
@@ -165,6 +165,14 @@ def get_nxclass(hfile, nxclass, path="/"):
pass
return None
+
+def as_string(node):
+ if node.shape == ():
+ return str(node.read())
+ else:
+ return node[0][:-1]
+
+
Diffractometer = namedtuple('Diffractometer',
['name', # name of the hkl diffractometer
'ub', # the UB matrix
@@ -175,7 +183,7 @@ def get_diffractometer(hfile):
""" Construct a Diffractometer from a NeXus file """
node = get_nxclass(hfile, 'NXdiffractometer')
- name = node.type[0][:-1]
+ name = as_string(node.type)
ub = node.UB[:]
factory = Hkl.factories()[name]