Skip to content

Commit

Permalink
Add nexus definitions/files for beam path description (#183)
Browse files Browse the repository at this point in the history
* Add nexus definitions/files for beam path description

* Update base_classes/nyaml/NXopt_assembly.yaml

Co-authored-by: Lukas Pielsticker <[email protected]>

* Update base_classes/nyaml/NXopt_assembly.yaml

Co-authored-by: Lukas Pielsticker <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lukas Pielsticker <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lukas Pielsticker <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lukas Pielsticker <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lukas Pielsticker <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lukas Pielsticker <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lukas Pielsticker <[email protected]>

* Apply suggestions from code review

Co-authored-by: Lukas Pielsticker <[email protected]>

* add_NX_defs_for_beam_path

* modifying_yaml_files

* fixing_nyaml_make_file

* Adjusted files with Sandor together according to
earlier hardcoded .nxs file

* Added the missing nxdl.xml files via nyaml2nxdl
Version=0.0.8 was used for nyaml.

* moved created nxdl.xml files to correct directory

* Suggestions to fix ci/cd by in NXtransfer_matrix_table.yaml

Co-authored-by: Florian Dobener <[email protected]>

* renaming transfer_matrix_table to beam_transfermatrix_table and opt_element to beam_device; also merging NXopt_beam to NXbeam

* remove old nxdl files

---------

Co-authored-by: Ron Hildebrandt <[email protected]>
Co-authored-by: Lukas Pielsticker <[email protected]>
Co-authored-by: Florian Dobener <[email protected]>
  • Loading branch information
4 people authored Mar 6, 2024
1 parent 09a962f commit ffc7196
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 8 deletions.
23 changes: 17 additions & 6 deletions base_classes/NXbeam.nxdl.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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-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 Down Expand Up @@ -454,7 +454,7 @@
<attribute name="depends_on" type="NX_CHAR">
<doc>
Points to the path to a field defining the location on which this
depends or the string &quot;.&quot; for origin.
depends or the string "." for origin.
</doc>
</attribute>
</field>
Expand Down Expand Up @@ -482,9 +482,20 @@
<attribute name="depends_on" type="NX_CHAR">
<doc>
Points to the path to a field defining the location on which this
depends or the string &quot;.&quot; for origin.
depends or the string "." for origin.
</doc>
</attribute>
</field>
</group>
<field name="previous_device">
<doc>
Indicates the beam device from which this beam originates.
This defines, whether the beam in an "input" or "output" beam.
</doc>
</field>
<field name="next_device">
<doc>

</doc>
</field>
</definition>
8 changes: 7 additions & 1 deletion base_classes/nyaml/NXbeam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,13 @@ NXbeam(NXobject):
doc: |
Points to the path to a field defining the location on which this
depends or the string "." for origin.
previous_device:
doc: |
Indicates the beam device from which this beam originates.
This defines, whether the beam in an "input" or "output" beam.
next_device:
doc: |
Gives the beam device which this beam will interact with next.
# ++++++++++++++++++++++++++++++++++ SHA HASH ++++++++++++++++++++++++++++++++++
# dbe7fba854b6a29c068ef96a3c8fbe28c8217579d5d8a990ffa730ecd269bf21
# <?xml version="1.0" encoding="UTF-8"?>
Expand Down
67 changes: 67 additions & 0 deletions contributed_definitions/NXbeam_device.nxdl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?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-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
# 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" category="base" name="NXbeam_device" extends="NXobject" type="group" xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd">
<doc>
Properties of generic beam device in an experimental setup.

Any beam related devices like source, detector, filter, mirror,
beamsplitter, ... which may modifies a beam in an experimental setup
can be described here with its experimental position and relationship
to the other beam devices in the setup.
</doc>
<field name="previous_devices">
<doc>
Single device or list of devices pointing to the devices from which an
beam originated to reach this device.
This is used to describe a logical order of devices and for the whole setup.
In this way, a "beam path" can be described (i.e., with starting point (light source)
and end point (photo detector)).

Example: /entry/instrument/detector.
</doc>
</field>
<field name="purpose" type="NX_CHAR">
<doc>
Description of the intended purpose of this device for
the experimental setup.
</doc>
</field>
<field name="group" type="NX_CHAR">
<doc>
Name of the group with which this device can be associated.
For example, if a group of devices is used for second harmonic generation,
all these devices have the group name "second harmonic generation".
Is used for simplified setup vizualization (or description?).
</doc>
</field>
<group type="NXtransformations">
<doc>
Location and orientation of the device. Note that even a
simple distance can be given as a translation.

You can use the @depends_on to describe from which device
the transformation needs to be applied.
</doc>
</group>
</definition>
120 changes: 120 additions & 0 deletions contributed_definitions/NXbeam_transfer_matrix_table.nxdl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?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-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
# 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" category="base" name="NXbeam_transfer_matrix_table" extends="NXobject" type="group" xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd">
<symbols>
<doc>
Variables used throughout the document, e.g. dimensions or parameters.
</doc>
<symbol name="N_variables">
<doc>
Length of the array associated to the data type.
</doc>
</symbol>
</symbols>
<doc>
Contains datastructures of an experimental optical setup (i.e., multiple
transfermatrix tables). These datastructures are used to relate physical
properties of two beams (NXbeam) which have one common optical element
(NXopt_element) (one specific transfermatrix).
One of these beams in an input beam and the other one is an output beam.

The data describes the change of beam properties, e.g. the intensity of a
beam is reduced because the transmission coefficient of the beam device is
lower than 1.
</doc>
<field name="datatype_N">
<doc>
Select which type of data was recorded, for example aperture and
focal length.
It is possible to have multiple selections. This selection defines
how many columns (N_variables) are stored in the data array.
N in the name, is the index number in which order the given
property is listed.
</doc>
<enumeration>
<item value="aperture"/>
<item value="focallength"/>
<item value="orientation"/>
<item value="jones matrix"/>
</enumeration>
</field>
<field name="matrix_elements">
<doc>
Please list in this array the column and row names used in your actual data.
That is in the case of aperture ['diameter'] or focal length ['focal_length_value']
and for orientation matrix ['OM1', 'OM2', 'OM3'] or for jones matrix
['JM1','JM2']
</doc>
<dimensions rank="1">
<dim index="1" value="N_variables"/>
</dimensions>
</field>
<field name="TRANSFER_MATRIX" type="NX_NUMBER">
<doc>
Contains the datastructure which relates beam properties of an
input and output beam as result of the input beam interaction
with the beam device.

Transfermatrix relationship between N input beams and M output beams.
It contains a table with the relevant matricis to be used for different
transmissitted properties (such as polarization, intensity, phase).

Data structure for all transfermatrices of an beam device in a setup.
For each combination of N input and M output beams and for L physical
concept (i.e. beam intensity), one matrix can be defined.

In this way, the transfermatrix table has the dimension NxM.

For each entry, in this transfermatrix, there are L formalisms.
Each formalism has the dimension math:`dim(L_i)xdim(L_i)`,
whereby math:`L_i` is the specific physical concept (Intensity, polarization, direction).

A beamsplitter with two input laser beams can have a total of
four transfermatrices (2 Input x 2 Output).

The dimension of the transfermatrix depends on the parameters.
Examples are:
1x1 for intensity/power
2x2 for jones formalism
3x3 for direction
</doc>
<attribute name="input">
<doc>
Specific name of input beam which the transfermatrix table is related to.
</doc>
</attribute>
<attribute name="output">
<doc>
Specific name of output beam which the transfermatrix table is related to.
</doc>
</attribute>
<dimensions rank="2">
<doc>
Square matrix with dimension N_variables x N_variables
</doc>
<dim index="1" value="N_variables"/>
<dim index="2" value="N_variables"/>
</dimensions>
</field>
</definition>
41 changes: 41 additions & 0 deletions contributed_definitions/nyaml/NXbeam_device.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
category: base
doc: |
Properties of generic beam device in an experimental setup.
Any beam related devices like source, detector, filter, mirror,
beamsplitter, ... which may modifies a beam in an experimental setup
can be described here with its experimental position and relationship
to the other beam devices in the setup.
NXbeam_device(NXobject):

previous_devices:
doc: |
Single device or list of devices pointing to the devices from which an
beam originated to reach this device.
This is used to describe a logical order of devices and for the whole setup.
In this way, a "beam path" can be described (i.e., with starting point (light source)
and end point (photo detector)).
Example: /entry/instrument/detector.
purpose(NX_CHAR):
doc: |
Description of the intended purpose of this device for
the experimental setup.
group(NX_CHAR):
doc: |
Name of the group with which this device can be associated.
For example, if a group of devices is used for second harmonic generation,
all these devices have the group name "second harmonic generation".
Is used for simplified setup vizualization (or description?).
(NXtransformations):
doc: |
Location and orientation of the device. Note that even a
simple distance can be given as a translation.
You can use the @depends_on to describe from which device
the transformation needs to be applied.
85 changes: 85 additions & 0 deletions contributed_definitions/nyaml/NXbeam_transfer_matrix_table.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
category: base
doc: |
Contains datastructures of an experimental optical setup (i.e., multiple
transfermatrix tables). These datastructures are used to relate physical
properties of two beams (NXbeam) which have one common optical element
(NXopt_element) (one specific transfermatrix).
One of these beams in an input beam and the other one is an output beam.
The data describes the change of beam properties, e.g. the intensity of a
beam is reduced because the transmission coefficient of the beam device is
lower than 1.
symbols:
doc: |
Variables used throughout the document, e.g. dimensions or parameters.
N_variables: |
Length of the array associated to the data type.
NXbeam_transfer_matrix_table(NXobject):
datatype_N:
doc: |
Select which type of data was recorded, for example aperture and
focal length.
It is possible to have multiple selections. This selection defines
how many columns (N_variables) are stored in the data array.
N in the name, is the index number in which order the given
property is listed.
enumeration:
[
aperture,
focallength,
orientation,
jones matrix,
]
matrix_elements:
doc: |
Please list in this array the column and row names used in your actual data.
That is in the case of aperture ['diameter'] or focal length ['focal_length_value']
and for orientation matrix ['OM1', 'OM2', 'OM3'] or for jones matrix
['JM1','JM2']
dimensions:
rank: 1
dim: [[1, N_variables]]

TRANSFER_MATRIX(NX_NUMBER):
doc: |
Contains the datastructure which relates beam properties of an
input and output beam as result of the input beam interaction
with the beam device.
Transfermatrix relationship between N input beams and M output beams.
It contains a table with the relevant matricis to be used for different
transmissitted properties (such as polarization, intensity, phase).
Data structure for all transfermatrices of an beam device in a setup.
For each combination of N input and M output beams and for L physical
concept (i.e. beam intensity), one matrix can be defined.
In this way, the transfermatrix table has the dimension NxM.
For each entry, in this transfermatrix, there are L formalisms.
Each formalism has the dimension math:`dim(L_i)xdim(L_i)`,
whereby math:`L_i` is the specific physical concept (Intensity, polarization, direction).
A beamsplitter with two input laser beams can have a total of
four transfermatrices (2 Input x 2 Output).
The dimension of the transfermatrix depends on the parameters.
Examples are:
1x1 for intensity/power
2x2 for jones formalism
3x3 for direction
\@input:
doc: |
Specific name of input beam which the transfermatrix table is related to.
\@output:
doc: |
Specific name of output beam which the transfermatrix table is related to.
dimensions:
doc: |
Square matrix with dimension N_variables x N_variables
rank: 2
dim:
[
[1, N_variables],
[2, N_variables],
]
2 changes: 1 addition & 1 deletion nyaml.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ $(APPDEF_DIR)/$(NYAML_SUBDIR)/%.yaml : $(APPDEF_DIR)/%.nxdl.xml

nyaml: $(NXDL_BC_TARGETS) $(NXDL_APPDEF_TARGETS) $(NXDL_CONTRIB_TARGETS)

all: nyaml
all: nyaml

0 comments on commit ffc7196

Please sign in to comment.