scippnexus.Field#

class scippnexus.Field(dataset, parent, sizes=None, dtype=None, errors=None)[source]#

NeXus field. In HDF5 fields are represented as dataset.

__init__(dataset, parent, sizes=None, dtype=None, errors=None)#

Methods

__init__(dataset, parent[, sizes, dtype, errors])

Attributes

attrs

The attributes of the dataset.

dims

dtype

errors

file

name

ndim

Total number of dimensions in the dataset.

shape

sizes

unit

dataset

parent

__getitem__(select)[source]#

Load the field as a scipp.Variable or Python object.

If the shape is empty and no unit is given this returns a Python object, such as a string or integer. Otherwise a scipp.Variable is returned.

Parameters:

select (EllipsisType | int | tuple | slice | tuple[str, int | slice] | dict[str, int | slice]) – Scipp-style index: Load the specified slice of the current group.

Returns:

Union[Any, Variable] – Loaded data.

attrs#

The attributes of the dataset. Cannot be used for writing attributes, since they are cached for performance.

property ndim: int#

Total number of dimensions in the dataset. See the shape property for potential differences to the value returned by the underlying h5py.Dataset.ndim.