-
Notifications
You must be signed in to change notification settings - Fork 1
Ecdc 3331 nxoff geometry #1040
base: main
Are you sure you want to change the base?
Ecdc 3331 nxoff geometry #1040
Conversation
elif shape_type == GEOMETRY_NX_CLASS: | ||
for child in self.shape_info[CommonKeys.CHILDREN][0][CommonKeys.CHILDREN]: | ||
if ( | ||
child[NodeType.CONFIG][CommonKeys.NAME] == SHAPE_GROUP_NAME | ||
and child[NodeType.CONFIG][CommonKeys.VALUES] == NX_BOX | ||
): | ||
self._add_box_shape_to_component() |
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.
I understand that this will break the loading of most existing instrument templates, because they tend to use NXgeometry in some places.
Do we need to drop support for NXgeometry? Or should we just move away from it in newly created files but still load old files correctly?
assert len(shape.faces[0]) == 4 | ||
assert len(shape.faces) == 6 |
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.
Shall we assert the dimensions of the shape like length/width/height?
self.nx_class = OFF_GEOMETRY_NX_CLASS | ||
self._create_datasets_and_add_to_shape_group() |
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.
The method _create_datasets_and_add_to_shape_group(self)
makes use of SHAPE_NX_CLASS. Is that still adequate when using NXoff_geometry
?
If not, then this file may need a bigger change to translate all NXshape geometries to use NXoff_geometry
on hold for now |
Issue
https://jira.esss.lu.se/browse/ECDC-3331
We do not want to process geometries other than OFF geometries now. A release has been made as a final version supporting other types. This is in line with the NeXus standard and notes on OFF geometries can be found at https://confluence.esss.lu.se/display/ECDC/NeXus+Constructor
The Constructor almost exclusively uses OFF geometries anyway, but this makes it explicit that it will not be further supported.
Description of work
Three lines have been added to ensure that the code returns gracefully if JSON children are not present in shape processing. Otherwise, code has mostly been removed. In this removal, a tidy-up has been performed to make better use of Python typing methods.
Acceptance Criteria
Fully compatible with JSON that uses OFF geometries with no failures in the geometry section.
UI tests
No tests required except to visually determine the correct processing of a box geometry (which has been included as a unit test)
Nominate for Group Code Review