Example C-code to read nexus

The NeXus, HDF5 and CIF scientific data formats overlap in some areas (e.g. in the capture and management of X-ray diffraction images), and there is considerable benefit to be gained by harmonising their content and working towards maximum interoperability. This forum invites discussion on this topic.

Moderators: Brian McMahon, jcbollinger

Post Reply
tgruene
Posts: 1
Joined: Thu Mar 14, 2013 9:51 am

Example C-code to read nexus

Post by tgruene » Thu Mar 14, 2013 9:57 am

Hello,

Zoe Fisher from LANL provided me neutron data from chymotrypsin which are HDF4 format (filename e.g. R7788.nx.hdf). Is there some example code how to read out data from hdf if you don't have the format description? Or is HDF meant to be self-explaining? If so, I would appreciate some tutorial. The library documentation for HDF seems too overwhelming to successfully read out data from such a file without knowing how it was written, and Zoe forwarded my request for help to somebody else who did the same and the last person would not reply.
Cheers,
Tim

yayahjb
Posts: 18
Joined: Sun Sep 11, 2011 9:54 pm

Re: Example C-code to read nexus

Post by yayahjb » Thu Jul 18, 2013 1:37 am

You may find the code in CBFlib_0.9.2.12 (http://downloads.sf.net/cbflib/CBFlib_0.9.2.12.tar.gz) helpful.
Take a look at cbf_hdf5.c. You should also find the examples at http://download.nexusformat.org/doc/html/fileformat.html
helpful. Finally, for a summary of the state of the merger, see https://www.sites.google.com/site/nexuscbf/home/presentation-foils. My apologies for not responding sooner, but I had a setting wrong on my post notifications from this forum.

yayahjb
Posts: 18
Joined: Sun Sep 11, 2011 9:54 pm

Re: Example C-code to read nexus

Post by yayahjb » Thu Jul 18, 2013 1:41 am

P.S. All the current documentation and code is for hdf5, but the philosophy of reading from either hdf4 or hdf5 has a lot in common.
I would, however, suggest moving to hdf5 when you can.

Post Reply