[Nexus] Release of NeXpy v0.10.10 and nexusformat v0.4.17

Osborn, Raymond rosborn at anl.gov
Tue Jan 30 15:55:44 GMT 2018


Hi Armando,
I hope I didn’t give the impression that I thought your file was anomalous. It is perfectly acceptable to store the attributes as an array of fixed-length strings, as you did. The only request is that the strings are UTF-8, but fixed-length string arrays are always (I think) returned as an array of byte strings by h5py, whatever their encoding. The problem was not with your file, but with my implementation of a fix. In fact, it has stimulated me to provide a more robust way of handling different but valid storage options, so it’s been very useful.

With best regards,
Ray

On Jan 30, 2018, at 9:23 AM, V. Armando Solé <sole at esrf.fr<mailto:sole at esrf.fr>> wrote:

On 30/01/2018 16:14, Osborn, Raymond wrote:

The ‘nxvalue’ property is what is returned when accessing the
attribute dictionary, but the ‘nxdata’ property can be accessed using
the ‘get’ method of the attribute dictionary. In the file recently
posted by Armando Solé:

 xanes['202.1/plotselect'].attrs.get('auxiliary_signals').nxdata
array([b'xmap_nika00', b'xmap_nika01', b'xmap_nika02', b'xmap_nika03',
       b'xmap_nika04', b'xmap_nika07'],
      dtype='|S11')

xanes['202.1/plotselect'].attrs['auxiliary_signals']
['xmap_nika00',
 'xmap_nika01',
 'xmap_nika02',
 'xmap_nika03',
 'xmap_nika04',
 'xmap_nika07']


Following your indications (Thanks Ray!) we have corrected that at our
side to make sure we respect the NX_CHAR type:

NX_CHAR: any string representation
                   All strings are to be encoded in UTF-8.
                   Includes fixed-length strings, variable-length
strings, and string arrays.
                   Some file writers write strings as a string array of
rank 1 and length 1. Clients should be prepared to handle such strings.

Unfortunately the error is so common that readers quite often need to
handle both.

Armando

_______________________________________________
NeXus mailing list
NeXus at nexusformat.org<mailto:NeXus at nexusformat.org>
http://lists.nexusformat.org/mailman/listinfo/nexus



--
Ray Osborn, Senior Scientist
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: ROsborn at anl.gov<mailto:ROsborn at anl.gov>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nexusformat.org/pipermail/nexus/attachments/20180130/e07b0a6f/attachment-0001.html>


More information about the NeXus mailing list