DMSC Integration Testing

Last updated: February 03, 2026 08:25:49

Test: nexusfiles-scipp|odin|odin_read_detector_geometry|orca

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00017191.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00017044.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00016904.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00016764.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00016624.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00016484.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00016337.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00016197.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00016057.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00015917.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00015784.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00015644.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00015504.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

System Out:

--------------------------------- Captured Log ---------------------------------

--------------------------------- Captured Out ---------------------------------



System Err:

--------------------------------- Captured Err ---------------------------------

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

System Out:

--------------------------------- Captured Log ---------------------------------

--------------------------------- Captured Out ---------------------------------



System Err:

--------------------------------- Captured Err ---------------------------------

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

System Out:

--------------------------------- Captured Log ---------------------------------

item =

def pytest_runtest_call(item) -> None:
coda_file = getattr(item, "_coda_file", None)
if coda_file is not None:
> item.record_property("coda_file", coda_file)
^^^^^^^^^^^^^^^^^^^^
E AttributeError: 'Function' object has no attribute 'record_property'

tests/conftest.py:17: AttributeError

System Out:

--------------------------------- Captured Log ---------------------------------

request = >
_session_coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')

@pytest.fixture
def coda_nexus_file_path(request, _session_coda_nexus_file_path: Path) -> Path:
> request.node.record_property(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"coda_file",
str(_session_coda_nexus_file_path),
)
E AttributeError: 'Function' object has no attribute 'record_property'

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dmsc_nightly/testing/nexusfiles/setup_fixtures.py:46: AttributeError

System Out:

--------------------------------- Captured Log ---------------------------------

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

System Out:

--------------------------------- Captured Log ---------------------------------
INFO root:setup_fixtures.py:46 Using CODA file /ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf
--------------------------------- Captured Out ---------------------------------



System Err:

--------------------------------- Captured Err ---------------------------------

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:390:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdetector.py:98: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:417: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:374: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:456: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:392: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:409: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014865.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014816.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014774.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014774.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014774.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014767.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014536.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014395.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014255.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00014115.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00013968.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00013877.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00013828.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning

self = , sel = ()

def __getitem__(self, sel):
"""
Get a child group or child dataset, a selection of child groups, or load and
return the current group.

Three cases are supported:

- String name: The child group or child dataset of that name is returned.
- Class such as ``NXdata`` or ``NXlog``: A dict containing all direct children
with a matching ``NX_class`` attribute are returned. Also accepts a tuple of
classes. ``Field`` selects all child fields, i.e., all datasets but not
groups.
- Scipp-style index: Load the specified slice of the current group, returning
a :class:`scipp.DataArray` or :class:`scipp.DataGroup`.

Parameters
----------
sel:
Child name, class, or index.

Returns
-------
:
Field, group, dict of fields, or loaded data.
"""
if isinstance(sel, str):
# We cannot get the child directly from the HDF5 group, since we need to
# create the parent group, to ensure that fields get the correct properties
# such as sizes and dtype.
if '/' in sel:
sel_path = PurePosixPath(sel)
if sel_path.is_absolute():
return self.file[sel_path.relative_to('/').as_posix()]
# If the path is a single name, we can directly access the child
elif len(sel_path.parts) == 1:
return self[sel_path.as_posix()]
else:
grp = sel_path.parts[0]
return self[grp][sel_path.relative_to(grp).as_posix()]
elif sel == '..':
return self.parent
child = self._children[sel]
if isinstance(child, Field):
self._populate_fields()
return child

def isclass(x):
return inspect.isclass(x) and issubclass(x, Field | NXobject)

if isclass(sel) or (
isinstance(sel, list) and len(sel) and all(isclass(x) for x in sel)
):
return self._get_children_by_nx_class(sel)

dg = self._nexus.read_children(sel)
if not dg:
# Bail out early to avoid fallback warnings. Everything is optional in
# NeXus so we cannot assume that the group is invalid (in contrast to
# likely partially incomplete groups that will fail to assemble below).
return dg
try:
> dg = self._nexus.assemble(dg)
^^^^^^^^^^^^^^^^^^^^^^^^

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:685: in assemble
out = self._assemble_as_physical_component(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:409: in _assemble_as_physical_component
assembled_nxdata = self._assemble_as_data(data_items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:366: in _assemble_as_data
da = self._add_coords(da, coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
da =
Dimensions: Sizes[dim_1:2048, dim_2:2048, ]
Data:
int32 (dim_1, dim_2) [0, 0, ..., 0, 0]


coords = DataGroup(sizes={'x_pixel_offset': 2048, 'y_pixel_offset': 2048}, keys=[
x_pixel_offset: Variable({'x_pixel_offset': 2048}),
y_pixel_offset: Variable({'y_pixel_offset': 2048}),
])

def _add_coords(self, da: sc.DataArray, coords: sc.DataGroup) -> sc.DataArray:
"""Add coords to a data array.

Sets alignment in the same way as slicing scipp.DataArray would.
"""
for name, coord in coords.items():
if not isinstance(coord, sc.Variable):
da.coords[name] = sc.scalar(coord)
else:
if coord.shape == (1,) and not set(coord.dims).issubset(da.dims):
da.coords[name] = coord[0]
else:
> da.coords[name] = coord
^^^^^^^^^^^^^^^
E scipp._scipp.core.DimensionError: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/nxdata.py:448: DimensionError

During handling of the above exception, another exception occurred:

workflow =
coda_nexus_file_path = PosixPath('/ess/data/coda/999999/raw/coda_odin_999999_00013753.hdf')
check_detector_positions =

def test_odin_read_detector_geometry__orca(
workflow: sciline.Pipeline,
coda_nexus_file_path: Path,
check_detector_positions: Callable,
) -> None:
workflow[Filename[SampleRun]] = coda_nexus_file_path
workflow[NeXusDetectorName] = "histogram_mode_detectors/orca"

> result = workflow.compute(EmptyDetector[SampleRun])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/nexusfiles-scipp/odin/odin_load_nexus_test.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/pipeline.py:191: in compute
return self.get(tp, **kwargs).compute(reporter=reporter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/task_graph.py:122: in compute
return self._scheduler.get(self._graph, [targets], reporter=reporter)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/sciline/scheduler.py:119: in get
return self._dask_get(dsk, list(map(_to_dask_key, keys)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/threaded.py:91: in get
results = get_async(
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:549: in get_async
raise_exception(exc, tb)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:353: in reraise
raise exc
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/local.py:258: in execute_task
result = task(data)
^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/_task_spec.py:759: in __call__
return self.func(*new_argspec)
^^^^^^^^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/dask/utils.py:80: in apply
return func(*args)
^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/workflow.py:228: in load_nexus_component
nexus.load_component(location, nx_class=nx_class, definitions=definitions)
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/ess/reduce/nexus/_nexus_loader.py:103: in load_component
loaded = cast(sc.DataGroup, group[selection])
^^^^^^^^^^^^^^^^
.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:387: in __getitem__
self._warn_fallback(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
e = DimensionError('Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset.')

def _warn_fallback(self, e: Exception) -> None:
msg = (
f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} "
"Falling back to loading HDF5 group children as scipp.DataGroup."
)
> warnings.warn(msg, stacklevel=2)
E UserWarning: Failed to load /entry/instrument/histogram_mode_detectors/orca as _StrippedDetector: Expected dimension to be in [dim_1:2048, dim_2:2048, ], got x_pixel_offset. Falling back to loading HDF5 group children as scipp.DataGroup.

.tox/nexusfiles-scipp-odin/lib/python3.12/site-packages/scippnexus/base.py:404: UserWarning