Skip to content

fix: nxlog use time field as signal if missing - #244

Merged
jokasimr merged 1 commit into
mainfrom
remove-warn-tdc
Oct 15, 2024
Merged

jokasimr merged 1 commit into
mainfrom
remove-warn-tdc

Conversation

@jokasimr

Copy link
Copy Markdown
Contributor

Fixes #230

Comment thread tests/nxlog_test.py Outdated


@pytest.mark.filterwarnings("ignore:Failed to load /entry/log:UserWarning")
def test_nxlog_with_missing_value_triggers_fallback(nxroot):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name needs update

Comment thread src/scippnexus/nxdata.py Outdated
Comment on lines +489 to +497
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']

Copy link
Copy Markdown
Member

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'`

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better 👍

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha I see

@jokasimr
jokasimr merged commit 23656d1 into main Oct 15, 2024
@jokasimr
jokasimr deleted the remove-warn-tdc branch October 15, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support NXlog without value dataset

2 participants