[Nexus] Reading generic h5 files.

Akeroyd, FA (Freddie) F.A.Akeroyd at rl.ac.uk
Wed Feb 21 12:19:12 GMT 2007


Brian,

"NX_class" is an attribute and is attached to each group to indicate its
NeXus class (NXentry, NXinstrument etc.). If you remove the lines that
try to read this attribute and instead just have something like

strcpy(nxclass, "NXunknown")

Does that help?

matlab bindings for NeXus would be another way around this problem ... 
I have that on my list of things to do in the next month.  

Regards,

Freddie

-----Original Message-----
From: nexus-bounces at nexusformat.org
[mailto:nexus-bounces at nexusformat.org] On Behalf Of tieman
Sent: 20 February 2007 21:18
To: nexus at nexusformat.org
Subject: [Nexus] Reading generic h5 files.

Hi all,

Can Nexus (3.0.0) read "generic" h5 files that were not written with the

Nexus API.  Experimentation tells me the answer is "no" but I am holding

out hope that I am doing something wrong...

I need to exchange data between a process I've written that uses Nexus 
to read/write HDF5 files and Matlab.  Matlab can read the files I 
generate just fine, however, I can not read the files Matlab generates.

We took an h5 file I wrote with nexus and read it into Matlab without a 
problem.  We then rewrote the file from within Matlab, but my Nexus 
program can not read it.

I think I've managed to trace part of the problem to NX5GetNextEntry and

the following lines:

           attr1 = H5Aopen_name(grp, "NX_class");
           type=H5T_C_S1;
           atype=H5Tcopy(type);
           H5Tset_size(atype,128); 
           iRet = H5Aread(attr1, atype, data);
           strcpy(nxclass,data);

I don't understand h5 very well yet but it looks to me like this section

of code is looking for a "group type" of "NX_class" which Matlab is 
unlikely to have written and so the later call to H5Aread fails.  I see 
NX5MakeGroup seems to attach the "NX_class" type when the file is
created.

Is there a way around this?  I have a strong need to inter-operate with 
Matlab and potentially additional sources of h5 data but I already have 
a large codebase built around NAPI that I'd love to leverage as well.  
Any thoughts?

Thanks!

Brian Tieman
Advanced Photon Source
Argonne National Laboratory


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



More information about the NeXus mailing list