Any NXobject can now be loaded as scipp.DataGroup.
If an implementation of NXobject fails to load (e.g., as a DataArray), the implementation will fall back to a generic load of all datasets in subgroups as a DataGroup. Previously, this was handled in a variety of cases by simply skipping the offending dataset or group.
Note that this depends on scipp 23.01.0, and I will need to run pip-compile-multi after that is released. For now the builds will fail.
While 2.) is generally an improvement, there are cases where it hurts usability. For example, for a WISH file we previously got:
/home/simon/code/scipp/scippnexus/src/scippnexus/nxdata.py:243: UserWarning: Skipped load of axis /raw_data_1/instrument/detector_1/event_frame_number due to:
Expected dimension to be in [spectrum_index:97280, ], got dim_0.
warn(f"Skipped load of axis {field.name} due to:\n{e}")
/home/simon/code/scipp/scippnexus/src/scippnexus/nxdata.py:243: UserWarning: Skipped load of axis /raw_data_1/instrument/detector_1/event_time_bins due to:
Expected dimension to be in [spectrum_index:97280, ], got dim_0.
warn(f"Skipped load of axis {field.name} due to:\n{e}")
/home/simon/code/scipp/scippnexus/src/scippnexus/nxdata.py:243: UserWarning: Skipped load of axis /raw_data_1/instrument/detector_1/time_of_flight due to:
Expected dimension to be in [spectrum_index:97280, ], got dim_0.
warn(f"Skipped load of axis {field.name} due to:\n{e}")
/home/simon/code/scipp/scippnexus/src/scippnexus/nxobject.py:295: UserWarning: Unrecognized unit 'pulses' for value dataset in '/raw_data_1/instrument/detector_1/time_of_flight_raw'; setting unit as 'dimensionless'
warnings.warn(f"Unrecognized unit '{unit}' for value dataset "
/home/simon/code/scipp/scippnexus/src/scippnexus/nxdata.py:243: UserWarning: Skipped load of axis /raw_data_1/instrument/detector_1/time_of_flight_raw due to:
Expected dimension to be in [spectrum_index:97280, ], got dim_0.
warn(f"Skipped load of axis {field.name} due to:\n{e}")
with a (partially) successful load as data binned into pixels:
Now we get this instead:
This is more complete, but less useful for the average user.
Fixes #85. Fixes #73.
There are two major changes here:
scipp.DataGroup
.DataArray
), the implementation will fall back to a generic load of all datasets in subgroups as aDataGroup
. Previously, this was handled in a variety of cases by simply skipping the offending dataset or group.Note that this depends on scipp 23.01.0, and I will need to run
pip-compile-multi
after that is released. For now the builds will fail.While 2.) is generally an improvement, there are cases where it hurts usability. For example, for a WISH file we previously got:
with a (partially) successful load as data binned into pixels:
Now we get this instead:
This is more complete, but less useful for the average user.