[Nexus] Fwd: Re: [NeXus-tech] XML and new attribute

Pete Jemian jemian at anl.gov
Thu Feb 12 16:29:16 GMT 2015


forwarding to NeXus Discussion forum


-------- Forwarded Message --------
Subject: Re: [NeXus-tech] XML and new attribute
Date: Thu, 12 Feb 2015 10:27:37 -0600
From: Pete Jemian <jemian at anl.gov>
To: Eugen Wintersberger <eugen.wintersberger at desy.de>

Eugen:

> <field name="phi" type="NX_FLOAT" depends_on="chi"
> transformation_type="rotation" vector="0,1,0" offset="0,0,0">
>
> </field>

Here, the attributes are used as part of the NXDL language and describe
the content of an NXDL document.  Not what you want.  The content of
this example that reveals why you should not use this example is the
presence of specific data values.


> <field name="phi" type="NX_FLOAT">
> 	<attribute name="depends_on" type="NX_CHAR">chi</attribute>
> 	<attribute name="transformation_type" type="NX_CHAR">rotation</attribute>
> 	<attribute name="vector" type="NX_FLOAT"> 0 1 0 </attribute>
> 	<attribute name="offset" type="NX_FLOAT"> 0 0 0 </attribute>
> </field>

Here, the NXDL attribute elements describe how to store content in a
NeXus HDF5 data file.  The NXDL does not describe just one HDF5 file but
rather any NeXus HDF5 file that uses this NXDL.  This example might be
what you want.  But, why do you want to store *any* data values in an
NXDL file?

By providing data values, you are mandating that these values and that
no other values are permitted.  There is a way in NXDL to mandate
values; the "enumeration" element.  For example, the "probe" field
common of NXsource is restricted to any of eight possible values
(neutron, x-ray, muon, ...).  Here's how (from the NXsource.nxdl.xml file):
	<field name="probe">
		<doc>type of radiation probe
			(pick one from the enumerated
			list and spell exactly)
		</doc>
		<enumeration>
			<item value="neutron" />
			<item value="x-ray" />
			<item value="muon" />
			<item value="electron" />
			<item value="ultraviolet" />
			<item value="visible light" />
			<item value="positron" />
			<item value="proton" />
		</enumeration>
	</field>


>
> In the latter case we should also ask if we would have to use a
> "dimensions" tag to denote that this is a vector instead of a scalar.

This is not necessary.  The HDF5 file stores the size of each dataset.


These are your underlying questions:
"How are these new attributes represented in an HDF5 file?  Can you show
an example?"

The data file fragment you describe has this structure:

   phi: NX_FLOAT
     @depends = chi
     @transformation = rotation
     @vector:NX_FLOAT = [0 1 0]
     @offset:NX_FLOAT = [0 0 0]

In the nxdl.xsd (rules for NXDL files), these four attributes should be
optional for any field.  (Not sure that has been implemented yet.)

Hope this helps.

Pete



-- 
----------------------------------------------------------
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