-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: nxlog use time field as signal if missing #244
Conversation
tests/nxlog_test.py
Outdated
@@ -52,16 +52,14 @@ def test_nxobject_log(h5root): | |||
assert sc.identical(log[...], da) | |||
|
|||
|
|||
@pytest.mark.filterwarnings("ignore:Failed to load /entry/log:UserWarning") | |||
def test_nxlog_with_missing_value_triggers_fallback(nxroot): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test name needs update
src/scippnexus/nxdata.py
Outdated
fallback_signal_name='value', | ||
) | ||
|
||
def _init_signal(self, *args, children, **kwargs): | ||
super()._init_signal(*args, children=children, **kwargs) | ||
if self._signal is None: | ||
if 'time' in children: | ||
self._signal_name = 'time' | ||
self._signal = children['time'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this simply use
fallback_signal_name='value' if 'value' in children else 'time'`
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's better 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, there's no argument to _init_signal
called fallback_signal_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point was to change __init__
and remove _init_signal
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha I see
2951e32
to
0e64b44
Compare
Fixes #230