<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?>
<!--
# NeXus - Neutron and X-ray Common Data Format
# 
# Copyright (C) 2008-2020 NeXus International Advisory Committee (NIAC)
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# For further information, see http://www.nexusformat.org
-->
<definition name="NXsas" extends="NXobject" type="group"
  category="application"
  xmlns="http://definition.nexusformat.org/nxdl/3.1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd"
  >
  <doc>
    raw, monochromatic 2-D SAS data with an area detector

    This is an application definition for raw data (not processed or reduced data) 
    from a 2-D small angle scattering instrument collected with a monochromatic 
    beam and an area detector. It is meant to be suitable both for neutron SANS 
    and X-ray SAXS data. 
    
    It covers all raw data from any monochromatic SAS techniques that
    use an area detector: SAS, WSAS, grazing incidence, GISAS

    It covers all raw data from any SAS techniques
    that use an area detector
    and a monochromatic beam.
  </doc>
  <group type="NXentry">
    <attribute name="entry">
      <doc>
		NeXus convention is to use ``entry1``, ``entry2``, ... 
		for analysis software to locate each entry
      </doc>
    </attribute>
    <field name="title"/>
    <field name="start_time" type="NX_DATE_TIME"/>
    <field name="end_time" type="NX_DATE_TIME"/>
    <field name="definition">
      <doc> Official NeXus NXDL schema to which this file conforms </doc>
      <enumeration>
        <item value="NXsas"/>
      </enumeration>
    </field>
    <group type="NXinstrument" name="instrument">
      <group type="NXsource" name="source">
        <field name="type">
          <doc>type of radiation source</doc>
        </field>
        <field name="name">
          <doc>Name of the radiation source</doc>
        </field>
        <field name="probe">
          <enumeration>
            <item value="neutron"/>
            <item value="x-ray"/>
          </enumeration>
        </field>
      </group>
      <group type="NXmonochromator" name="monochromator">
        <field name="wavelength" units="NX_WAVELENGTH" type="NX_FLOAT">
          <doc>The wavelength of the radiation</doc>
        </field>
        <field name="wavelength_spread" type="NX_FLOAT">
          <doc>
	          delta_lambda/lambda (:math:`\Delta\lambda/\lambda`):
	          Important for resolution calculations
          </doc>
        </field>
      </group>
      <group type="NXcollimator" name="collimator">
        <group type="NXgeometry" name="geometry">
          <group type="NXshape" name="shape">
            <field name="shape" type="NX_CHAR">
              <enumeration>
                <item value="nxcylinder"/>
                <item value="nxbox"/>
              </enumeration>
            </field>
            <field name="size" type="NX_FLOAT" units="NX_LENGTH">
              <doc>The collimation length</doc>
            </field>
          </group>
        </group>
      </group>
      <group type="NXdetector" name="detector">
        <field name="data" type="NX_NUMBER" signal="1">
          <doc>
            This is area detector data, of number of x-pixel versus
            number of y-pixels. Since the beam center is to be
            determined as a step of data reduction, it is not necessary
            to document or assume the position of the beam center in
            acquired data.
          </doc>
          <dimensions rank="2">
            <dim index="1" value="nXPixel" />
            <dim index="2" value="nYPixel" />
          </dimensions>
        </field>
        <field name="distance" type="NX_FLOAT" units="NX_LENGTH">
          <doc>The distance between detector and sample</doc>
        </field>
        <field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH">
          <doc>Physical size of a pixel in x-direction</doc>
        </field>
        <field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH">
          <doc>Size of a pixel in y direction</doc>
        </field>
        <field name="polar_angle" type="NX_FLOAT" units="NX_ANGLE"></field>
        <field name="azimuthal_angle" type="NX_FLOAT"
          units="NX_ANGLE">
        </field>
        <field name="rotation_angle" type="NX_FLOAT" units="NX_ANGLE"></field>
        <field name="aequatorial_angle" type="NX_FLOAT"
          units="NX_ANGLE">
        </field>
		<field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH">
			<doc>
				This is the x position where the direct beam would hit the detector. This is a
				length, not a pixel position, and can be outside of the actual detector.
			</doc>
		</field>
        <field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH">
			<doc>
				This is the y position where the direct beam would hit the detector. This is a
				length, not a pixel position, and can be outside of the actual detector.
			</doc>
		</field>
      </group>
      <field name="name" type="NX_CHAR">
        <doc>Name of the instrument actually used to perform the experiment</doc>
      </field>
    </group>
    <group type="NXsample" name="sample">
      <field name="name">
        <doc>Descriptive name of sample</doc>
      </field>
      <field name="aequatorial_angle" type="NX_FLOAT"
        units="NX_ANGLE">
      </field>
    </group>
    <group type="NXmonitor" name="control">
      <field name="mode">
        <doc>
			Count to a preset value based on either clock time 
			(timer) or received monitor counts (monitor). 
        </doc>
        <enumeration>
          <item value="monitor"/>
          <item value="timer"/>
        </enumeration>
      </field>
      <field name="preset" type="NX_FLOAT">
        <doc>preset value for time or monitor</doc>
      </field>
      <field name="integral" type="NX_FLOAT" units="NX_ANY">
        <doc>Total integral monitor counts</doc>
      </field>
    </group>
    <group type="NXdata" name="data">
      <link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link>
    </group>
  </group>
</definition>
