Closed SimonHeybrock closed 1 year ago
Apart from addressing your comments, I pushed another small change the switches out the cached_property
for manual lazy init for the Group._children
and Group._nexus
properties. This should make it easier to see through the logic. I kept cached_property
for the other methods/properties that "just" return something simple that is computed.
I honestly don't see the benefit. Was the logic unclear before?
I honestly don't see the benefit. Was the logic unclear before?
In particular the _children
felt odd: We write to the return value, but it is not simply returning an actual field of the class instance. Rather, it is returning something that it constructed in the property. We basically relied on cached_property
to do this exactly once, and this may be unexpected to the reader.
Should be ready for another review @jl-wynen.
Tracking next steps in #120.
@jl-wynen I fixed another small issue, and pushed some extra horrible code to deal with event-data fields embedded in NXdetector
, to somewhat restore the ability to load SNS files. I am not planning further changes in this PR, so this is ready for a "final" look.
This adds, as
scippnexus.v2
, the future version of ScippNexus. The trigger for this rewrite were significant performance issues with small files that contain thousands of groups and datasets. However, it also attempts to resolve some complicated logic of the old implementation, which did lead, e.g., to hard to understand stack traces in exceptions.To use this, just try
import scippnexus.v2 as snx
. The basic API is the same as before.Apart from internal design and significant performance improvements (not affecting large datasets), there are a number of changes:
DataGroup
is not better at preserving "partial" information, if assembly fails.NX*geometry
classes are loaded asDataGroup
without processing. We will provide post-processing functions for grouping this bydetector_number
, etc.NXevent_data
is not automatically grouped bydetector_number
. There is a post-processing function for this, but we will need to add some that operate recursively.For review:
base.py
.class File
and its helper functions are mostly (but not completely) unchanged.nxdata.py
.nxtransformations.py
, which I plan to refactor in a follow-up into a couple of user-facing functions for resolving and executingdepends_on
-chains.Bugfixes:
shape=(0,)
are now correctly loaded as datetime if they should. Previously this always returned a time (offset).shape=(0,)
are now correctly loaded as transformation if they should. Previously this always returned the plain value of the transformation.