Skip to content

Connect more intricate concepts from NXmicrostructure#406

Merged
mkuehbach merged 4 commits into
fairmatfrom
use_odf_and_microstructure_in_em
Aug 7, 2025
Merged

Connect more intricate concepts from NXmicrostructure#406
mkuehbach merged 4 commits into
fairmatfrom
use_odf_and_microstructure_in_em

Conversation

@mkuehbach

@mkuehbach mkuehbach commented Aug 4, 2025

Copy link
Copy Markdown
Collaborator

exemplified for EBSD:

  • Microstructure
  • ODF
  • IPF

Summary by Sourcery

Extend the NXem schema to fully integrate microstructure, ODF, and pole figure data for EBSD workflows by adding repeating groups for microstructureID, odfID, and pfID, while refining related definitions and documentation.

New Features:

  • Introduce repeating microstructureID group under NXem indexing to capture detailed microstructure configuration, geometry, and feature information
  • Enable multiple ODF entries (odfID) in NXem with full parameter configuration, texture index characteristics, and phi-two plot data
  • Allow multiple pole figure entries (pfID) in NXem for extended IPF support

Enhancements:

  • Remove redundant nameType attributes on AXISNAME_indices and align attribute definitions across maps and legends
  • Adjust NXmicrostructure and NXmicrostructure_odf definitions to include a characteristics group for texture index and refine geometry entity documentation
  • Change NXmicrostructure_mtex_config group to extend NXparameters instead of NXobject

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2025

Copy link
Copy Markdown

Reviewer's Guide

This PR enriches the NXem schema by embedding detailed NXmicrostructure, NXmicrostructure_odf, and NXmicrostructure_pf groups (with full configuration, parameter, geometry and feature subgroups), removes redundant nameType constraints on AXISNAME_indices, and updates related contributed definitions (adding texture characteristics, refining documentation and base types).

ER diagram for new and updated microstructure-related entities

erDiagram
    NXem ||--o{ NXmicrostructure : contains
    NXem ||--o{ NXmicrostructure_odf : contains
    NXem ||--o{ NXmicrostructure_pf : contains
    NXmicrostructure ||--|| NXprocess : configuration
    NXmicrostructure ||--o| NXcg_grid : grid
    NXmicrostructure ||--o| NXcg_point : points
    NXmicrostructure ||--o| NXcg_polyline : polylines
    NXmicrostructure ||--o| NXcg_triangle : triangles
    NXmicrostructure ||--o| NXcg_polygon : polygons
    NXmicrostructure ||--o| NXcg_polyhedron : polyhedra
    NXmicrostructure ||--o| NXmicrostructure_feature : crystals
    NXmicrostructure ||--o| NXmicrostructure_feature : interfaces
    NXmicrostructure ||--o| NXmicrostructure_feature : triple_junctions
    NXmicrostructure ||--o| NXmicrostructure_feature : quadruple_junctions
    NXmicrostructure_odf ||--|| NXparameters : configuration
    NXmicrostructure_odf ||--o| NXprocess : characteristics
    NXmicrostructure_odf ||--o| NXdata : phi_two_plot
    NXprocess ||--o| NXnote : source
    NXprocess ||--o| NXdata : roi
    NXprocess ||--o| NXprogram : programID
    NXprogram ||--o| NXmicrostructure_mtex_config : mtex
    NXmicrostructure_mtex_config ||--|| NXparameters : extends
Loading

Class diagram for enriched NXem schema with detailed microstructure concepts

classDiagram
    class NXem {
        +indexing: NXprocess
        +odfID: NXmicrostructure_odf [0..*]
        +pfID: NXmicrostructure_pf [0..*]
        +microstructureID: NXmicrostructure [0..*]
    }
    class NXprocess {
        +number_of_scan_points: NX_UINT
        +indexing_rate: NX_NUMBER
        +source: NXnote
        +roi: NXdata
    }
    class NXmicrostructure {
        +configuration: NXprocess
        +grid: NXcg_grid
        +points: NXcg_point
        +polylines: NXcg_polyline
        +triangles: NXcg_triangle
        +polygons: NXcg_polygon
        +polyhedra: NXcg_polyhedron
        +crystals: NXmicrostructure_feature
        +interfaces: NXmicrostructure_feature
        +triple_junctions: NXmicrostructure_feature
        +quadruple_junctions: NXmicrostructure_feature
    }
    class NXmicrostructure_feature {
        +representation: NX_CHAR
        +number_of_crystals/number_of_interfaces/number_of_junctions: NX_UINT
        +index_offset: NX_INT
    }
    class NXmicrostructure_odf {
        +configuration: NXparameters
        +characteristics: NXprocess
        +phi_two_plot: NXdata
    }
    class NXparameters {
        +crystal_symmetry_point_group: NX_CHAR
        +specimen_symmetry_point_group: NX_CHAR
        +kernel_halfwidth: NX_NUMBER
        +kernel_name: NX_CHAR
        +resolution: NX_NUMBER
    }
    class NXprocess_odf {
        +texture_index: NX_FLOAT
    }
    class NXmicrostructure_mtex_config {
        <<extends NXparameters>>
        +conventions: NXcollection
    }
    NXem --> NXprocess : indexing
    NXem --> NXmicrostructure_odf : odfID
    NXem --> NXmicrostructure_pf : pfID
    NXem --> NXmicrostructure : microstructureID
    NXmicrostructure_odf --> NXparameters : configuration
    NXmicrostructure_odf --> NXprocess_odf : characteristics
    NXmicrostructure_odf --> NXdata : phi_two_plot
    NXmicrostructure --> NXprocess : configuration
    NXmicrostructure --> NXcg_grid : grid
    NXmicrostructure --> NXcg_point : points
    NXmicrostructure --> NXcg_polyline : polylines
    NXmicrostructure --> NXcg_triangle : triangles
    NXmicrostructure --> NXcg_polygon : polygons
    NXmicrostructure --> NXcg_polyhedron : polyhedra
    NXmicrostructure --> NXmicrostructure_feature : crystals
    NXmicrostructure --> NXmicrostructure_feature : interfaces
    NXmicrostructure --> NXmicrostructure_feature : triple_junctions
    NXmicrostructure --> NXmicrostructure_feature : quadruple_junctions
    NXprocess --> NXnote : source
    NXprocess --> NXdata : roi
    NXmicrostructure_mtex_config --|> NXparameters
Loading

Class diagram for NXmicrostructure_mtex_config base type change

classDiagram
    class NXmicrostructure_mtex_config {
        <<extends NXparameters>>
        +conventions: NXcollection
        +other attributes...
    }
    NXmicrostructure_mtex_config --|> NXparameters
Loading

Class diagram for new characteristics in NXmicrostructure_odf

classDiagram
    class NXmicrostructure_odf {
        +characteristics: NXprocess
    }
    class NXprocess {
        +texture_index: NX_FLOAT
    }
    NXmicrostructure_odf --> NXprocess : characteristics
Loading

File-Level Changes

Change Details Files
Extend NXem schema with detailed microstructureID group
  • Added microstructureID group under indexing with NXmicrostructure subgroups
  • Defined configuration (process parameters, programID with version and mtex config)
  • Introduced geometry collections (grid, points, polylines, triangles, polygons, polyhedra)
  • Added feature groups (crystals, interfaces, triple/quadruple junctions) with counts and offsets
applications/nyaml/NXem.yaml
applications/NXem.nxdl.xml
Add odfID and pfID definitions in NXem
  • Changed exists of odfID/pfID to unbounded occurrence
  • Added configuration (NXparameters) and optional characteristics (NXprocess) under odfID
  • Embedded phi_two_plot NXdata with axes, intensity and Euler angle fields
  • Mirrored pfID group as unbounded placeholder
applications/nyaml/NXem.yaml
applications/NXem.nxdl.xml
Clean up nameType attributes and update hashes
  • Removed nameType: partial on AXISNAME_indices attributes
  • Updated SHA hash lines in NXem.yaml and related definitions
applications/nyaml/NXem.yaml
applications/NYem.nxdl.xml
Refine contributed definitions for microstructure and ODF
  • Added characteristics group with texture_index to NXmicrostructure_odf (YAML and XML)
  • Updated mesh entity docs in NXmicrostructure to include triangles and unify representations
  • Changed NXmicrostructure_mtex_config base type from NXobject to NXparameters
  • Bumped SHA hashes in contributed definition files
contributed_definitions/nyaml/NXmicrostructure_odf.yaml
contributed_definitions/NXmicrostructure_odf.nxdl.xml
contributed_definitions/nyaml/NXmicrostructure.yaml
contributed_definitions/nyaml/NXmicrostructure_mtex_config.yaml
contributed_definitions/NXmicrostructure_mtex_config.nxdl.xml

Possibly linked issues

  • #0: The PR adds and refines NXmicrostructure, ODF, and PF definitions, directly contributing to the NXmicrostructure base class/appdef.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey @mkuehbach - I've reviewed your changes - here's some feedback:

  • Consider splitting this large schema update into smaller, feature-focused PRs (e.g. microstructure, ODF, PF) to make review and testing more manageable.
  • Ensure consistency across the new groups and attributes—especially around nameType and exists/minOccurs/maxOccurs definitions—so they align with existing Nexus conventions.
  • Verify that switching NXmicrostructure_mtex_config from extending NXobject to NXparameters won’t break downstream compatibility and document any breaking changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider splitting this large schema update into smaller, feature-focused PRs (e.g. microstructure, ODF, PF) to make review and testing more manageable.
- Ensure consistency across the new groups and attributes—especially around nameType and exists/minOccurs/maxOccurs definitions—so they align with existing Nexus conventions.
- Verify that switching NXmicrostructure_mtex_config from extending NXobject to NXparameters won’t break downstream compatibility and document any breaking changes.

## Individual Comments

### Comment 1
<location> `contributed_definitions/nyaml/NXmicrostructure.yaml:228` </location>
<code_context>
             <doc>
                 Reference to an instance of:

-                * :ref:`NXcg_polyline` for a one-dimensional representation as only a projection is available (like in linear intercept analysis)
-                * :ref:`NXcg_polygon` for a two-dimensional representation as only a projection is available (like in most experiments)
-                * :ref:`NXcg_polyhedron` or :ref:`NXcg_grid` for regularly pixelated (in 1D, 2D) or voxelated representations (in 3D)
+                * :ref:`NXcg_polyline` for a one- or two-dimensional representation as only a projection is available (like in linear intercept analysis)
+                * :ref:`NXcg_polygon`, :ref:`NXcg_triangle`, or :ref:`NXcg_polyhedron` for a two- or three-dimensional representation as only a projection is available (like in most experiments)
+                * :ref:`NXcg_grid` for regularly pixelated (in 1D, 2D) or voxelated representations (in 3D)
</code_context>

<issue_to_address>
The updated description for NXcg_polyline may cause confusion regarding its dimensionality.

Please clarify whether 'one- or two-dimensional' refers to the geometry of the polyline or its embedding space, as this could be misinterpreted by users.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        * :ref:`NXcg_polyline` for a one- or two-dimensional representation as only a projection is available (like in linear intercept analysis)
=======
        * :ref:`NXcg_polyline` for a representation of a polyline embedded in one- or two-dimensional space, as only a projection is available (like in linear intercept analysis)
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread contributed_definitions/nyaml/NXmicrostructure.yaml
@mkuehbach mkuehbach requested a review from lukaspie August 4, 2025 19:20
@lukaspie

lukaspie commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

I am not sure where we are going with this. Is this supposed to be an addition to the contributed definitions? Then NXem cannot depend on these contributed NXmicrostructure* classes.

Or is the NXem standard to be updated? If so, the base classes must be submitted to NIAC for standardization.

@mkuehbach

mkuehbach commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator Author

Different levels of standardization possible. An update of an appdef that includes concepts not yet standardized can still be used such that it obeys the voted upon standard. Relevant is the combination of instance data populated in the tree and evaluated against the tree, like a lower bound constrain on a functionality. Its the clarity in the communication which matters the wording must be we combined a standardized reporting for data collected with the microscope (covered by the parts of the concept tree in NXem) with additional supplementary concept tree branches that are not yet standardized but meant as an example how to achieve such domain-level standardization with NeXus.

This PR summarizes the changes and idea that we withhold from the NIAC standardization and here add on top of the standardized NXem. nexusformat#1423 had NXmicrostructure, CG, IPF, ODF intentionally not included. As asked by Aaron, "what will be the first thing that you'll change once 1423 is accepted?" The answer on our side was: "the aforementioned (microstructure, cg) will be added". Standardized of the concept tree in NXem is right now what is covered by 1423, eventually at some point #402. In addition, NXem provides FAIRmat-specific extensions for aforementioned microstructure, ipf, and odf. The CG concepts here used are standardized (nexusformat#1421).

What means and is standardized? So far the discussion was only what is exactly reported as demanded by the voted upon NXem likewise for other the appdef used. Reporting of the EM database examples follows the standard, will though contain additional (meta)data instances. Also these instance data are passed to the validation instead of just dropping these into a loose NXcollection.

No further additions functionality-wise are planned.

@mkuehbach

mkuehbach commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator Author

Submitting the NXmicrostructure to the NIAC with aiming for more than updating the existent and quite outdated definitions in contributed as of now is a clear "no" from my side.

I would like to mention that here hooked in semantic additions bridge physics-with-engineering going beyond what was reported in other NFDI consortia and applying the same quality assurance when it comes to validation of instance data. This is mainly to lead by example to invalidate the point that "this is not possible with NeXus" --- it is but the set also explores the current limits of NeXus as likewise the entirety of the FAIRmat contributions.

@lukaspie

lukaspie commented Aug 6, 2025

Copy link
Copy Markdown
Collaborator

An update of an appdef that includes concepts not yet standardized can still be used such that it obeys the voted upon standard

My understanding from NIAC was always that application definitions that are part of the standard (i.e., voted on and moved to applications) can only make use of those base classes that are also standardized (i.e., voted on and moved to base_classes, not in contributed_definitions). So I would think that the proposal as it stands here is not valid - either you need to submit the NXmicrostructure* classes for standardization (which I gather you do not want to do) or they cannot be added to NXem. I might be wrong though.

@lukaspie lukaspie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

As discussed, this introduces a difference to the accepted NXem in the NIAC standard. We should work towards a resolution. Options:

  1. We propose all microstructure classes to be standardized (not desired)
  2. We add all microstructure classes to the NIAC as contributed, but do not propose the changes to NXem to NIAC. We then have to decide what we want to do about NXem in the fairmat. We either keep these optional changes or we make changes to the validation/NOMAD parsing such that if we don't find a given concept in the appdef or in its inheritance tree, we also check all other base classes. I would vote for the latter option.

@mkuehbach mkuehbach merged commit b4acce9 into fairmat Aug 7, 2025
6 checks passed
@mkuehbach mkuehbach deleted the use_odf_and_microstructure_in_em branch August 7, 2025 13:11
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.

3 participants