Various questions from a NeXus beginner

Ray Osborn ROsborn at anl.gov
Tue Dec 9 17:30:13 GMT 1997


Thanks for your interest in using NeXus.  We certainly welcome hearing
about your experiences in trying out the software.  My first recommendation
is that you subscribe to the NeXus mailing list, to which such queries are
best sent.  Then, all the NeXus developers should be in a position to help
out.  It will also give us an idea of what things are not clearly explained
in our online documentation at <http://www.neutron.anl.gov/NeXus/>.  To
subscribe, please follow the instructions at
<http://www.neutron.anl.gov/NeXus/NeXus_mail.html>.

I will try and answer some of your points in turn.

>
>I'm rewriting the acquisition programs of our institute (
>the LLB : Laboratoire Leon Brillouin ) which has about 25 spectrometers.
>
>The installation of a new acquisition program is the good moment to change
>the data format and I'm very interested in the hierarchical data format
>philosophy.
>
>
>I read the Nexus www server and I have now the following questions:
>
>1)  Nexus defines various Groups to store datas like  NXsample  for instance
>
>I understood that NXSample is a NX_Group (not a NexusDataSet) but it seems
>to have a lot of attributes (name, chemical formula, electrical fiels ,
>and so on).
>
>I also understood that Nexus API provides functions to add attributes to
>data set only (and not to groups even if HDF allows to add Vgroup
>attributes ).
>
>So my question is how should I add this kind of attributes to groups like
>NX_sample ?

You are correct that the NeXus group, with class name NXsample, does not
have attributes in the same way as the NeXus data items.  "name",
"temperature","electric_field" etc. refer to actual data items, not
attributes, which are stored within the group.  In the underlying HDF file,
they are stored as SDS's and will have their own attributes.  For example,
"temperature" should be stored with the "units" attribute set to e.g. "K".
The code to do this one operation, assuming that an NXentry group is
already open, would be

/* Open NXsample group within NXentry group */
    NXmakegroup (file_id, "Sample", "NXsample");
    NXopengroup (file_id, "Sample", "NXsample");
/* Output temperature */
    NXmakedata (file_id, "temperature", NX_FLOAT32, 1, 1);
    NXopendata (file_id, "temperature")
    NXputdata (file_id, temperature);
    NXputattr (file_id, "units", "K", 1, NX_CHAR);
/* Close NXsample group and close file */
    NXclosegroup (file_id);

>
>
>2)  a related question is : may somebody send me a real code example which
>fills more groups
>than the small example given in the API document. (even if I cannot
>directly compile  this example , what I want is to see how people
>effectivly use the Nexus API).
>

Since I am old enough to have my own legacy code in Fortran, you may prefer
to get a real life example from someone using the C code directly.  We will
probably discuss providing more sample code at the NOBUGS workshop being
held here this week.

>
>3)  And a question related to HDF and not Nexus but maybe someone in this
>list may have solved the problem: for PC platforms , HDF gives  statically
>linked librairies for the MS compiler. Unfortunatly I use the Borland
>compiler which cannot link with thes
>
>

I can't help here.  Anyone else know?

Regards,
Ray Osborn

------------------------------------------------------
Dr Ray Osborn                  Tel: +1 (630) 252-9011
Materials Science Division     Fax: +1 (630) 252-7777
Argonne National Laboratory    E-mail: ROsborn at anl.gov
Argonne, IL 60439-4845





More information about the NeXus mailing list