scippnexus.NXobject#
- class scippnexus.NXobject(attrs, children)[source]#
- __init__(attrs, children)[source]#
Subclasses should call this in their __init__ method, or ensure that they initialize the fields in children with the correct sizes and dtypes.
Methods
__init__
(attrs, children)Subclasses should call this in their __init__ method, or ensure that they initialize the fields in children with the correct sizes and dtypes.
assemble
(dg)When a Group is indexed, this method is called to assemble the read children into the result object.
convert_label_index_to_positional
(sel)index_child
(child, sel)When a Group is indexed, this method is called to index each child.
read_children
(sel)When a Group is indexed, this method is called to read all children.
Attributes
sizes
unit
- assemble(dg)[source]#
When a Group is indexed, this method is called to assemble the read children into the result object.
The default implementation simply returns the DataGroup.
Subclasses of NXobject, in particular NXdata, override this method to return an object with more semantics such as a DataArray or Dataset.
- index_child(child, sel)[source]#
When a Group is indexed, this method is called to index each child.
The main purpose of this is to translate the Group index to the child index. Since the group dimensions (usually given by the signal) may be a superset of the child dimensions, we need to translate the group index to a child index.
The default implementation assumes that the child shape is identical to the group shape, for all child dims. Subclasses of NXobject, in particular NXdata, override this method to handle bin edges.
- read_children(sel)[source]#
When a Group is indexed, this method is called to read all children.
The default implementation simply calls index_child on each child and returns the result as a DataGroup.
Subclasses of NXobject, in particular NXevent_data, override this method to to implement special logic for reading children with interdependencies, i.e., where reading each child in isolation is not possible.
- Return type: