[Nexus] Release of NeXpy v0.10.10 and nexusformat v0.4.17
V. Armando Solé
sole at esrf.fr
Tue Jan 30 16:12:08 GMT 2018
Hi Ray,
On 30/01/2018 16:55, Osborn, Raymond wrote:
> Hi Armando,
> I hope I didn’t give the impression that I thought your file was
> anomalous.
My 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.
I applied the trick you gave me:
if sys.version.startswith("2"):
string_dtype = h5py.special_dtype(vlen=unicode)
else:
string_dtype = h5py.special_dtype(vlen=str)
group.attrs["auxiliary_signals"] = numpy.array(auxiliary_signals,
dtype=string_dtype)
and I think we get an array of strings back in both cases.
If you want to test it, I have generated a new couple of files following
your recommendations (lines above) under python 2 and python 3:
Python 2:
https://cloud.esrf.fr/index.php/s/HQT8ZJlHmduSbec
Python 3:
https://cloud.esrf.fr/index.php/s/vwg9P7ZW0IBYgPT
Best regards,
Armando
More information about the NeXus
mailing list