Skip to content
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

Add "JSON" generator to facilitate testing of live workflows in downstream packages #115

Merged
merged 5 commits into from
Oct 8, 2024

Conversation

SimonHeybrock
Copy link
Member

@SimonHeybrock SimonHeybrock commented Oct 4, 2024

For now this only supports NXevent_data. More might be added in the future.

SimonHeybrock added a commit to scipp/esssans that referenced this pull request Oct 4, 2024
generator = event_data_generator(monitor)
for i in range(len(monitor)):
group = json_nexus_group(next(generator))
assert_identical(group[()], monitor[i : i + 1])
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test that the generator has finished after the loop? I.e., that next(generator) raises StopIteration. Asking because the loop uses monitor and not generator.

Parameters
----------
data:
A data array with event data, equivalent to what ScippNexus would load from an
Copy link
Member

Choose a reason for hiding this comment

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

It's a dict, not a data array.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, do you mean the return value? This docstring line is about the input.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I meant the return value. My bad.
Can you add an explanation of it? In particular, there is no explanation of how data is encoded.

@SimonHeybrock SimonHeybrock merged commit 071be8e into main Oct 8, 2024
5 checks passed
@SimonHeybrock SimonHeybrock deleted the json-generator branch October 8, 2024 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants