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

Update for next scipp #169

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/scippnexus/nxcylindrical_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ def _parse(
face1_center = cylinders['vertex_index', 0]
face1_edge = cylinders['vertex_index', 1]
face2_center = cylinders['vertex_index', 2]
ds = sc.Dataset()
ds['face1_center'] = vertices[face1_center.values]
ds['face1_edge'] = vertices[face1_edge.values]
ds['face2_center'] = vertices[face2_center.values]
ds = sc.Dataset(
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 also fix this in v1? It's showing up when using load_nexus.
I know it's deprecated but I still have to use it until we handle the transformation chains.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Unfortunately, there are no tests for v1. So I don't know for sure that it works.

{
'face1_center': vertices[face1_center.values],
'face1_edge': vertices[face1_edge.values],
'face2_center': vertices[face2_center.values],
}
)
ds = ds.rename(**{vertices.dim: 'cylinder'})
if detector_number is None:
# All cylinders belong to the same shape
Expand Down
2 changes: 1 addition & 1 deletion tests/nxdata_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_auxiliary_signal_causes_load_as_dataset(h5root):
snx.create_field(data, 'signal', da.data)
snx.create_field(data, 'xx', da.coords['xx'])
data = snx.Group(data, definitions=snx.base_definitions())
assert_identical(data[...], sc.Dataset({'signal': da.data, 'xx': da.coords['xx']}))
assert_identical(data[...], sc.DataGroup(signal=da.data, xx=da.coords['xx']))
Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly not sure what happened here. But in my local build, data[...] returns a datagroup. But not in CI.

Copy link
Member

Choose a reason for hiding this comment

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

I do not know if NeXus guarantees that aux signals have the same number of dims, so maybe we have to consider moving to DataGroup anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems like this happens anyway which is why I had to fix the test. But I don't know what triggers it. I didn't change the implementation of Group

Copy link
Member

Choose a reason for hiding this comment

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

It probably means that there is an exception somewhere, so it falls back to loading as a datagroup. This likely indicates your broke something elsewhere. Do not change this test!

Copy link
Member Author

Choose a reason for hiding this comment

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

It needs to change because signal and xx have different shapes

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the standard, I see now that the aux-signals are suppose to have the same shape as the original. That is, the existing test was a bit bad. Therefore:

  • Change the shape of the aux signal stored in this test.
  • Keep checking for Dataset.



def test_NXlog_data_is_loaded_as_time_dependent_data_array(nxroot):
Expand Down