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

Pete Jemian jemian at anl.gov
Tue Jan 30 16:22:08 GMT 2018


We should document this trick in the NeXus manual in the h5py section. 
Ray, can you open an issue?

On 1/30/2018 10:12 AM, V. Armando Solé wrote:
> 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
> 
> 
> _______________________________________________
> NeXus mailing list
> NeXus at nexusformat.org
> http://lists.nexusformat.org/mailman/listinfo/nexus
> 

-- 
----------------------------------------------------------
Pete R. Jemian, Ph.D.                <jemian at anl.gov>
Beam line Controls and Data Acquisition, Group Leader
Advanced Photon Source,   Argonne National Laboratory
Argonne, IL  60439                   630 - 252 - 3189
-----------------------------------------------------------
    Education is the one thing for which people
       are willing to pay yet not receive.
-----------------------------------------------------------




More information about the NeXus mailing list