NXDL Manager : nxdl_manager#
source code documentation#
Python representation of an NeXus NXDL class specification.
The nxdl_manager calls schema_manager
It gets a specific file_set from cache_manager
It is called from validate
A file_set refers to a directory containing a complete set of the NXDL files and XML Schema files that comprise a version of the NeXus definitions standard. It is identified by a name (release name, tag name, short commit hash, or branch name).
- class punx.nxdl_manager.NXDL_Manager(file_set=None)[source]#
Python access to the NXDL classes found in
nxdl_dir.Attributes
- classes dict :
Dictionary of the NXDL classes found in
nxdl_dirwhere the key is the NeXus class name and the value is an instance of theNXDL__definition()class (defined below) which describes the NXDL structure.- nxdl_file_set str :
Absolute path to a directory which contains a complete set of the NeXus definitions. This directory will have this content: * file
nxdl.xsd: The XML Schema defining the NeXus NXDL language * filenxdlTypes.xsd: data and engineering units types used bynxdl.xsd* file__github_info__.json: description of the git repository for this file set * directoryapplications: contains NXDL files of NeXus application definitions * directorybase_classes: contains NXDL files of NeXus base classes * directorycontributed_definitions: contains NXDL files of NeXus contributed definitions- nxdl_defaults obj :
Instance of
punx.nxdl_schema.NXDL_Summary()orNone. If notNone, default values for all NXDL as defined by thenxdl.xsd.
- class punx.nxdl_manager.NXDL__attribute(nxdl_definition, nxdl_defaults=None, *args, **kwargs)[source]#
Contents of a attribute structure (XML element) in a NXDL XML file.
~parse_nxdl_xml
- class punx.nxdl_manager.NXDL__base(nxdl_definition, *args, **kwargs)[source]#
Base class for each NXDL structure.
- ensure_unique_name(obj)[source]#
Check
obj.name, replace to make unique if needed.EXAMPLE:
First name of
itemwill stayitem.Second name of
itemwill becomeitem1.Third name of
itemwill becomeitem2.
PARAMETERS
- obj obj:
Instance of nxdl_manager.NXDL__base subclass.
- parse_attributes(xml_node)[source]#
Parse NXDL
<attribute>elements inxml_node.PARAMETERS
- xml_node obj:
Instance of XML element in NXDL file with
<attribute>nodes.Element is one of the NXDL elements: field, group, attribute, link, …
- parse_fields(xml_node)[source]#
Parse NXDL
<field>elements inxml_node.PARAMETERS
- xml_node obj:
Instance of XML element in NXDL file with
<field>nodes.
- parse_groups(xml_node)[source]#
Parse NXDL
<group>elements inxml_node.PARAMETERS
- xml_node obj:
Instance of XML element in NXDL file with
<group>nodes.
- parse_links(xml_node)[source]#
Parse NXDL
<link>elements inxml_node.PARAMETERS
- xml_node obj:
Instance of XML element in NXDL file with
<link>nodes.
- class punx.nxdl_manager.NXDL__definition(nxdl_manager=None, *args, **kwargs)[source]#
Contents of a definition element in a NXDL XML file.
- nxdl_manager obj :
Instance of
NXDL_Manager().
- class punx.nxdl_manager.NXDL__dim(nxdl_definition, nxdl_defaults=None, *args, **kwargs)[source]#
Contents of a dim structure (XML element) in a NXDL XML file.
- class punx.nxdl_manager.NXDL__dimensions(nxdl_definition, nxdl_defaults=None, *args, **kwargs)[source]#
Contents of a dimensions structure (XML element) in a NXDL XML file.
- class punx.nxdl_manager.NXDL__field(nxdl_definition, nxdl_defaults=None, *args, **kwargs)[source]#
Contents of a field structure (XML element) in a NXDL XML file.
- class punx.nxdl_manager.NXDL__group(nxdl_definition, nxdl_defaults=None, *args, **kwargs)[source]#
Contents of a group structure (XML element) in a NXDL XML file.
- class punx.nxdl_manager.NXDL__link(nxdl_definition, nxdl_defaults=None, *args, **kwargs)[source]#
Contents of a link structure (XML element) in a NXDL XML file.
example from NXmonopd:
<link name="polar_angle" target="/NXentry/NXinstrument/NXdetector/polar_angle"> <doc>Link to polar angle in /NXentry/NXinstrument/NXdetector</doc> </link> <link name="data" target="/NXentry/NXinstrument/NXdetector/data"> <doc>Link to data in /NXentry/NXinstrument/NXdetector</doc> </link>
- class punx.nxdl_manager.NXDL__symbols(nxdl_definition, nxdl_defaults=None, *args, **kwargs)[source]#
Contents of a symbols structure (XML element) in a NXDL XML file.
example from NXcrystal:
<symbols> <doc>These symbols will be used below to coordinate dimensions with the same lengths.</doc> <symbol name="n_comp"><doc>number of different unit cells to be described</doc></symbol> <symbol name="i"><doc>number of wavelengths</doc></symbol> </symbols>
- punx.nxdl_manager.get_NXDL_file_list(nxdl_dir)[source]#
Return a list of all NXDL files in the
nxdl_dir.The list is sorted by NXDL category (base_classes, applications, contributed_definitions) and then alphabetically within each category.
PARAMETERS
- nxdl_dir str:
Absolute path to the directory of a
file_set(defined above).