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

NXcxi_ptycho contributed definition #628

Merged
merged 11 commits into from
Oct 27, 2018
7 changes: 7 additions & 0 deletions base_classes/NXbeam.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
<dim index="2" value="j"/>
</dimensions>
</field>
<field name="extent" type="NX_FLOAT" units="NX_LENGTH">
<doc>Size of the beam entering this component</doc>
<dimensions rank="2"><!-- [2,:] -->
<dim index="1" value="2"/>
<dim index="2" value="j"/>
</dimensions>
</field>
<field name="final_wavelength" type="NX_FLOAT" units="NX_WAVELENGTH">
<doc>Wavelength on leaving beamline component</doc>
<dimensions rank="1">
Expand Down
230 changes: 230 additions & 0 deletions contributed_definitions/NXcxi_ptycho.nxdl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
<?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) 2014-2015 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 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"
name="NXcxi_ptycho"
category="contributed"
type="group"
extends="NXobject"
>
<symbols>
<doc>
These symbols will be used below to coordinate the shapes of the datasets.
</doc>

<symbol name="npts_x">
<doc>
The number of points in the x direction
</doc>
</symbol>

<symbol name="npts_y">
<doc>
Number of points in the y direction.
</doc>
</symbol>
<symbol name="frame_size_x">
<doc>
Number of detector pixels in x
</doc>
</symbol>

<symbol name="frame_size_y">
<doc>
Number of detector pixels in y
</doc>
</symbol>
</symbols>

<doc>
Application definition for a ptychography experiment. This is compatible with CXI from version 1.6 (discussed with Filippe Maia) if this application definition
is put at the top "entry" level. Above this a "cxi_version" field should be defined. The CXI format is name based, rather than class based, and so it is important
to pay attention to the naming convention to be CXI compatible. There are duplications due to the format merger. These should be achieved by SoftLinks,
with hdf5 Virtual Dataset being used to restructure any data that needs to be remapped.

An example here is that CXI expects the data to always to have shape (npts_x*npts_y, frame_size_x, frame_size_y). For nexus this is only true for arbitrary scan paths
with raster format scans taking shape (npts_x, npts_y, frame_size_x, frame_size_y).
</doc>

<group type="NXentry" name="entry_1">
<field name="title" minOccurs="1" maxOccurs="1"/>
<field name="start_time" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"/>
<field name="end_time" type="NX_DATE_TIME" minOccurs="0" maxOccurs="1"/>
<field name="definition" type="NX_CHAR" minOccurs="1" maxOccurs="1">
<doc>
Official NeXus NXDL schema to which this file conforms
</doc>

<enumeration>
<item value="NXptycho"/>
</enumeration>
</field>
<group type="NXinstrument" name="instrument_1" minOccurs="1" maxOccurs="1">
<group type="NXsource" minOccurs="1" maxOccurs="1" name="source_1">
<field name="name" type="NX_CHAR" minOccurs="1" maxOccurs="1"/>
<field name="energy" type="NX_FLOAT" minOccurs="1" maxOccurs="1">
<doc>
This is the energy of the machine, not the beamline.
</doc>
</field>
<field name="probe" type="NX_FLOAT" minOccurs="1" maxOccurs="1"/>
<field name="type" type="NX_FLOAT" minOccurs="1" maxOccurs="1"/>
</group>
<group type="NXbeam" name="beam_1" minOccurs="1" maxOccurs="1">
<field name="energy" type="NX_FLOAT" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="extent" type="NX_FLOAT" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="incident_beam_divergence" type="NX_FLOAT" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="incident_beam_energy" type="NX_FLOAT" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="incident_energy_spread" type="NX_FLOAT" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
</group>
<group type="NXdetector" name="detector_1" minOccurs="1" maxOccurs="1">
<attribute name="axes" type="NX_CHAR">
<doc>
should have value "[, data]"
</doc>
</attribute>
<attribute name="signal" type="NX_CHAR">
<doc>
should have value "data"
</doc>
</attribute>
<group type="NXtransformations" name="transformations">
<field name="vector" type="NX_NUMBER" minOccurs="1" maxOccurs="1"/>
</group>
<field name="translation" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1" maxOccurs="1">
<doc>
This is an array of shape (npts_x*npts_y, 3) and can be a Virtual Dataset of x and y
</doc>
<attribute name="units" type="NX_CHAR" optional="false"/>
<attribute name="axes" optional="false" type="NX_CHAR">
<doc>
this should take the value "translation:$slowaxisname:$fastaxisname"
</doc>
</attribute>
<attribute name="interpretation" optional="false" type="NX_CHAR">
<doc>
This should be "image"
</doc>
</attribute>
</field>
<field name="data" type="NX_INT" signal="1" minOccurs="1" maxOccurs="1">
<dimensions rank="3 for arbitrary scan, 4 for raster">
<dim index="1" value="npts_x"/>
<dim index="2" value="npts_y"/>
<dim index="3" value="frame_size_x"/>
<dim index="4" value="frame_size_y"/>
</dimensions>
</field>
<link name="data_1" target="/NXentry/NXinstrument/NXdetector/data">
<doc>
This data must always have shape (npts_x*npts_y, frame_size_x, frame_size_y) regardless
of the scan pattern. Use hdf5 virtual dataset to achieve this.
</doc>
</link>
<field name="x_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="y_pixel_size" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="distance" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1" maxOccurs="1">
<doc>
The distance between the detector and the sample
</doc>
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="beam_center_x" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
<field name="beam_center_y" type="NX_FLOAT" units="NX_LENGTH" minOccurs="1" maxOccurs="1">
<attribute name="units" type="NX_CHAR" optional="false"/>
</field>
</group>
<group type="NXmonitor" minOccurs="1" maxOccurs="1">
<field name="data" type="NX_FLOAT">
<dimensions rank="1 for arbitrary scan, 2 for raster">
<dim index="1" value="npts_x"/>
<dim index="2" value="npts_y"/>
</dimensions>
</field>
</group>
</group>
</group>
<group type="NXdata" minOccurs="1" maxOccurs="1">
<attribute name="axes" type="NX_CHAR" optional="false">
<doc>
This should be "[x,.]" for arbitrary scanning patterns, and "[x,.,.]" for raster
</doc>
</attribute>
<attribute name="signal" type="NX_CHAR" optional="false">
<doc>
This should be "data"
</doc>
</attribute>
<link name="data" target="/NXentry/NXinstrument/NXdetector/data"/>
<link name="x" target="/NXentry/NXsample/NXtransformations/x"/>
<link name="y" target="/NXentry/NXsample/NXtransformations/y"/>
<field name="x_indices" type="NX_CHAR"/>
<field name="y_indices" type="NX_CHAR"/>
</group>
<group type="NXcollection" name="data_1" minOccurs="1" maxOccurs="1">
<doc>
To ensure CXI compatibility the data in this group must always have shape that is
(npts_x*npts_y, frame_size_x, frame_size_y). For nexus-style raster scans it is proposed that
hdf5 virtual dataset is used.
</doc>
<link name="data" target="/NXentry/NXinstrument/NXdetector/data"/>
<link name="translation" target="/NXentry/NXinstrument/NXdetector/translation"/>
</group>

<group type="NXsample" name="sample_1" minOccurs="1" maxOccurs="1">
<field name="name" type="NX_CHAR" minOccurs="0" maxOccurs="1"/>
<field name="transformations" type="NXtransformations">
<doc>
This must contain two fields with the x and y motors that are linked via the
dependency tree according to the real-life motor layout dependency.
For raster scans x and y will have shape (npts_x, npts_y)
For arbitrary scans x and y will be (npts_x*npts_y,)
An attribute with the units for each motor is required.
</doc>
<attribute name="vector" optional="false" type="NX_NUMBER"/>
</field>
<group type="NXcollection" name="geometry_1" minOccurs="1" maxOccurs="1">
<link name="translation" target="/NXentry/NXinstrument/NXdetector/translation"/>
</group>
</group>
</definition>