Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fairmat-2024-mpes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Nov 27, 2024
2 parents ac1bf2b + 5b6daa0 commit 87ded74
Show file tree
Hide file tree
Showing 9 changed files with 462 additions and 149 deletions.
52 changes: 1 addition & 51 deletions base_classes/NXdetector.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<symbol name="nP"><doc>number of scan points (only present in scanning measurements)</doc></symbol>
<symbol name="i"><doc>number of detector pixels in the first (slowest) direction</doc></symbol>
<symbol name="j"><doc>number of detector pixels in the second (faster) direction</doc></symbol>
<symbol name="k"><doc>number of detector pixels in the third (if necessary, fastest) direction</doc></symbol>
<symbol name="k"><doc>number of detector pixels in the third (if necessary, fastest) direction</doc></symbol>
<symbol name="tof"><doc>number of bins in the time-of-flight histogram</doc></symbol>
</symbols>

Expand Down Expand Up @@ -933,57 +933,7 @@
</doc>
</group>
</choice>
<field name="amplifier_type" type="NX_CHAR">
<doc>
Type of electron amplifier, MCP, channeltron, etc.
</doc>
</field>
<field name="detector_type" type="NX_CHAR">
<doc>
Description of the detector type, DLD, Phosphor+CCD, CMOS.
</doc>
</field>
<field name="detector_voltage" type="NX_FLOAT" units="NX_VOLTAGE">
<doc>
Voltage applied to detector.
</doc>
</field>
<field name="amplifier_voltage" type="NX_FLOAT" units="NX_VOLTAGE">
<doc>
Voltage applied to the amplifier.
</doc>
</field>
<field name="amplifier_bias" type="NX_FLOAT" units="NX_VOLTAGE">
<doc>
The low voltage of the amplifier migh not be the ground.
</doc>
</field>
<field name="sensor_size" type="NX_FLOAT" units="NX_LENGTH">
<doc>
Size of each imaging sensor chip on the detector.
</doc>
</field>
<field name="sensor_count" type="NX_INT" units="NX_UNITLESS">
<doc>
Number of imaging sensor chips on the detector.
</doc>
</field>
<field name="sensor_pixel_size" type="NX_FLOAT" units="NX_LENGTH">
<doc>
Physical size of the pixels of the imaging chip on the detector.
</doc>
</field>
<field name="sensor_pixels" type="NX_INT" units="NX_UNITLESS">
<doc>
Number of raw active elements in each dimension. Important for swept scans.
</doc>
</field>
<group type="NXfabrication"/>
<group type="NXdata">
<doc>
raw data output from the detector
</doc>
</group>
<attribute name="default">
<doc>
.. index:: plotting
Expand Down
60 changes: 60 additions & 0 deletions base_classes/NXelectron_detector.nxdl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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-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 category="base" extends="NXdetector" name="NXelectron_detector"
type="group"
xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd"
xmlns="http://definition.nexusformat.org/nxdl/3.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://definition.nexusformat.org/nxdl/@NXDL_RELEASE@"
>
<doc>
A subclass of NXdetector for detectors that detect electrons.
</doc>
<field name="amplifier_type" type="NX_CHAR">
<doc>
Type of electron amplifier, MCP, channeltron, etc.
</doc>
</field>
<field name="detector_type" type="NX_CHAR">
<doc>
Description of the electron detector type, DLD, Phosphor+CCD, CMOS.
</doc>
</field>
<field name="detector_voltage" type="NX_FLOAT" units="NX_VOLTAGE">
<doc>
Voltage applied to the electron detector.
</doc>
</field>
<field name="amplifier_voltage" type="NX_FLOAT" units="NX_VOLTAGE">
<doc>
Voltage applied to the amplifier.
</doc>
</field>
<field name="amplifier_bias" type="NX_FLOAT" units="NX_VOLTAGE">
<doc>
The low voltage of the amplifier might not be the ground.
</doc>
</field>
</definition>
6 changes: 3 additions & 3 deletions base_classes/NXmonochromator.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
<field name="energy_errors" type="NX_FLOAT" units="NX_ENERGY">
<doc>energy standard deviation</doc>
</field>
<field name="energy_dispersion" type="NX_FLOAT" units="NX_ANY">
<field name="energy_dispersion" type="NX_FLOAT" units="eV/mm">
<doc>
Energy dispersion at the exit slit, typically given as eV/mm.
Energy dispersion at the exit slit.
</doc>
</field>
<field name="wavelength_dispersion" type="NX_FLOAT" units="NX_ANY">
<field name="wavelength_dispersion" type="NX_FLOAT" units="nm/mm">
<doc>
Wavelength dispersion at the exit slit.
</doc>
Expand Down
31 changes: 26 additions & 5 deletions base_classes/NXroot.nxdl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,35 @@
<attribute name="file_update_time" type="NX_DATE_TIME">
<doc>Date and time of last file change at close</doc>
</attribute>
<attribute name="NeXus_version">
<attribute name="NeXus_version" deprecated="NAPI is frozen.">
<doc>
Version of NeXus API used in writing the file.

Only used when the NAPI has written the file.
Note that this is different from the version of the
base class or application definition version number.
base class or application definition version number.
</doc>
</attribute>
<attribute name="NeXus_repository">
<doc>
A repository containing the application definitions
used for creating this file.
If the ``NeXus_release`` attribute contains a commit distance and hash,
this should refer to this repository.
</doc>
</attribute>
<attribute name="NeXus_release">
<doc>
The version of NeXus definitions used in writing the file. This can either be a date-based
NeXus release (e.g., YYYY.MM), see https://github.com/nexusformat/definitions/releases or
a version tag that includes additional development information, such as a commit distance and
a Git hash. This is typically formatted as `vYYYY.MM.post1.dev&lt;commit-distance&gt;-g&lt;git-hash&gt;`,
where `YYYY.MM` refers to the base version of the NeXus definitions. `post1.dev&lt;commit-distance&gt;`
indicates that the definitions are based on a commit after the base version (post1), with
`&lt;commit-distance&gt;` being the number of commits since that version. `g&lt;git-hash&gt;` is the
abbreviated Git hash that identifies the specific commit of the definitions being used.

If the version includes both a commit distance and a Git hash, the ``NeXus_repository``
attribute must be included, specifying the URL of the repository containing that version.
</doc>
</attribute>
<attribute name="HDF_version">
Expand Down Expand Up @@ -101,5 +123,4 @@
for a summary of the discussion.
</doc>
</attribute>
</definition>

</definition>
4 changes: 4 additions & 0 deletions dev_tools/docs/anchor_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ def write(self):
return
contents = dict(
_metadata=dict(
# datetime=datetime.datetime.now(datetime.UTC).isoformat(),
# the next line is the py3.9 supported way of getting the datetime
# this will become deprecated however in py3.12 for which the
# line above-mentioned is a fix, which however does not work in py3.9
datetime=datetime.datetime.utcnow().isoformat(),
title="NeXus NXDL vocabulary.",
subtitle="Anchors for all NeXus fields, groups, "
Expand Down
9 changes: 6 additions & 3 deletions dev_tools/docs/nxdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,21 +312,24 @@ def _get_doc_blocks(ns, node):
return out_blocks

def _handle_multiline_docstring(self, blocks):
link_pattern = re.compile(r"\.\. _([^:]+):(.*)")

links = []
docstring = ""
expanded_blocks = []

for block in blocks:
expanded_blocks += block.split("\n")

for block in expanded_blocks:
if not block:
continue

link_match = re.search(r"\.\. _([^:]+):(.*)", block)
link_match = link_pattern.search(block)
if link_match is not None:
links.append((link_match.group(1), link_match.group(2).strip()))
else:
docstring += " " + re.sub(r"\n", " ", block.strip())
docstring += " " + block.strip().replace("\n", " ")

for name, target in links:
docstring = docstring.replace(f"`{name}`_", f"`{name} <{target}>`_")
Expand All @@ -339,7 +342,7 @@ def _get_doc_line(self, ns, node):
return ""
if len(blocks) > 1:
return self._handle_multiline_docstring(blocks)
return re.sub(r"\n", " ", blocks[0])
return blocks[0].replace("\n", " ")

def _get_minOccurs(self, node):
"""
Expand Down
Loading

0 comments on commit 87ded74

Please sign in to comment.