Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan from tamash #304

Open
wants to merge 2 commits into
base: fairmat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 95 additions & 87 deletions applications/NXscan.nxdl.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="nxdlformat.xsl" ?>
<?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-2022 NeXus International Advisory Committee (NIAC)
#
#
# Copyright (C) 2014-2024 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
Expand All @@ -21,90 +21,98 @@
#
# For further information, see http://www.nexusformat.org
-->
<definition name="NXscan" 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"
>
<definition xmlns="http://definition.nexusformat.org/nxdl/3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" category="application" type="group" name="NXscan" extends="NXobject" xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd">
<symbols>
<doc>
The symbol(s) listed here will be used below to coordinate datasets with the same shape.
</doc>
<symbol name="nP">
<doc>Number of points</doc>
</symbol>
<symbol name="xDim">
<doc>xDim description</doc>
</symbol>
<symbol name="yDim">
<doc>yDim description</doc>
</symbol>
<doc>
The symbol(s) listed here will be used below to coordinate datasets
with the same shape.
</doc>
<symbol name="nP">
<doc>
Number of points
</doc>
</symbol>
<symbol name="xDim">
<doc>
xDim description
</doc>
</symbol>
<symbol name="yDim">
<doc>
yDim description
</doc>
</symbol>
</symbols>
<doc>
Application definition for a generic scan instrument.

This definition is more an
example then a stringent definition as the content of a given NeXus scan file needs to
differ for different types of scans. This example definition shows a scan like done
on a rotation camera: the sample is rotated and a detector image, the rotation angle
and a monitor value is stored at each step in the scan. In the following, the symbol
``NP`` is used to represent the number of scan points. These are the rules for
storing scan data in NeXus files which are implemented in this example:

* Each value varied throughout a scan is stored as an array of
length ``NP`` at its respective location within the NeXus hierarchy.
* For area detectors, ``NP`` is the first dimension,
example for a detector of 256x256: ``data[NP,256,256]``
* The NXdata group contains links to all variables varied in the scan and the data.
This to give an equivalent to the more familiar classical tabular representation of scans.

These rules exist for a reason: HDF allows the first dimension of a data set to be
unlimited. This means the data can be appended too. Thus a NeXus file built according
to the rules given above can be used in the following way:

* At the start of a scan, write all the static information.
* At each scan point, append new data from varied variables
and the detector to the file.
</doc>
<group type="NXentry">
<field name="title"/>
<field name="start_time" type="NX_DATE_TIME"/>
<field name="end_time" type="NX_DATE_TIME"/>
<field name="definition" type="NX_CHAR">
<doc> Official NeXus NXDL schema to which this file conforms </doc>
<enumeration>
<item value="NXscan"/>
</enumeration>
</field>
<group type="NXinstrument">
<group type="NXdetector">
<field name="data" type="NX_INT" signal="1">
<dimensions rank="3">
<dim index="1" value="nP" />
<dim index="2" value="xDim" />
<dim index="3" value="yDim" />
</dimensions>
<doc>
Application definition for a generic scan instrument.

Repetitive measurements when varying a control parameter in a given range are called
scans. This application definition is designed as an envelop to describe such measurements
allowing for a generic definition of the scanned control parameter and the recorded data.

This definition is more an example then a stringent definition as the content of a given
NeXus scan file needs to differ for different types of scans. This example definition
shows a scan like done on a rotation camera: the sample is rotated and a detector image,
the rotation angle and a monitor value is stored at each step in the scan. In the following,
the symbol ``NP`` is used to represent the number of scan points. These are the rules for
storing scan data in NeXus files which are implemented in this example:

* Each value varied throughout a scan is stored as an array of
length ``NP`` at its respective location within the NeXus hierarchy.
* For area detectors, ``NP`` is the first dimension,
example for a detector of 256x256: ``data[NP,256,256]``
* The NXdata group contains links to all variables varied in the scan and the data.
This to give an equivalent to the more familiar classical tabular representation of scans.

These rules exist for a reason: HDF allows the first dimension of a data set to be
unlimited. This means the data can be appended to. Thus a NeXus file built according
to the rules given above can be used in the following way:

* At the start of a scan, write all the static information.
* At each scan point, append new data from varied variables and the detector to the file.
</doc>
<group type="NXentry">
<field name="title"/>
<field name="start_time" type="NX_DATE_TIME"/>
<field name="end_time" type="NX_DATE_TIME"/>
<field name="definition" type="NX_CHAR">
<doc>
Official NeXus NXDL schema to which this file conforms
</doc>
<enumeration>
<item value="NXscan"/>
</enumeration>
</field>
</group>
</group>
<group type="NXsample">
<field name="rotation_angle" type="NX_FLOAT" axis="1">
<dimensions rank="1">
<dim index="1" value="nP" />
</dimensions>
</field>
</group>
<group type="NXmonitor">
<field name="data" type="NX_INT">
<dimensions rank="1">
<dim index="1" value="nP"/>
</dimensions>
</field>
</group>
<group type="NXdata">
<link name="data" target="/NXentry/NXinstrument/NXdetector/data"></link>
<link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"></link>
<group type="NXinstrument">
<group type="NXdetector">
<!--here we consider the raw data on the detector, which is always integer
obtained by the A/D converter-->
<field name="data" type="NX_INT" signal="1">
<dimensions rank="3">
<dim index="1" value="nP"/>
<dim index="2" value="xDim"/>
<dim index="3" value="yDim"/>
</dimensions>
</field>
</group>
</group>
<group type="NXsample">
<field name="rotation_angle" type="NX_FLOAT" axis="1">
<dimensions rank="1">
<dim index="1" value="nP"/>
</dimensions>
</field>
</group>
<group type="NXmonitor">
<field name="data" type="NX_INT">
<dimensions rank="1">
<dim index="1" value="nP"/>
</dimensions>
</field>
</group>
<group type="NXdata">
<link name="data" target="/NXentry/NXinstrument/NXdetector/data"/>
<link name="rotation_angle" target="/NXentry/NXsample/rotation_angle"/>
</group>
</group>
</group>
</definition>
23 changes: 14 additions & 9 deletions applications/nyaml/NXscan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ category: application
doc: |
Application definition for a generic scan instrument.

This definition is more an
example then a stringent definition as the content of a given NeXus scan file needs to
differ for different types of scans. This example definition shows a scan like done
on a rotation camera: the sample is rotated and a detector image, the rotation angle
and a monitor value is stored at each step in the scan. In the following, the symbol
``NP`` is used to represent the number of scan points. These are the rules for
Repetitive measurements when varying a control parameter in a given range are called
scans. This application definition is designed as an envelop to describe such measurements
allowing for a generic definition of the scanned control parameter and the recorded data.

This definition is more an example then a stringent definition as the content of a given
NeXus scan file needs to differ for different types of scans. This example definition
shows a scan like done on a rotation camera: the sample is rotated and a detector image,
the rotation angle and a monitor value is stored at each step in the scan. In the following,
the symbol ``NP`` is used to represent the number of scan points. These are the rules for
storing scan data in NeXus files which are implemented in this example:

* Each value varied throughout a scan is stored as an array of
Expand All @@ -18,12 +21,12 @@ doc: |
This to give an equivalent to the more familiar classical tabular representation of scans.

These rules exist for a reason: HDF allows the first dimension of a data set to be
unlimited. This means the data can be appended too. Thus a NeXus file built according
unlimited. This means the data can be appended to. Thus a NeXus file built according
to the rules given above can be used in the following way:

* At the start of a scan, write all the static information.
* At each scan point, append new data from varied variables
and the detector to the file.
* At each scan point, append new data from varied variables and the detector to the file.

symbols:
doc: |
The symbol(s) listed here will be used below to coordinate datasets with the same shape.
Expand All @@ -45,6 +48,8 @@ NXscan(NXobject):
enumeration: [NXscan]
(NXinstrument):
(NXdetector):
# here we consider the raw data on the detector, which is always integer
# obtained by the A/D converter
data(NX_INT):
signal: 1
dimensions:
Expand Down
Loading