Skip to content

Ray's suggestions added to FIRmat-NFDI nexus_definitions PR #402 (how FAIRmat sees it)#403

Merged
mkuehbach merged 3 commits into
fairmatfrom
bring_back_rays_comments_em
Jul 30, 2025
Merged

Ray's suggestions added to FIRmat-NFDI nexus_definitions PR #402 (how FAIRmat sees it)#403
mkuehbach merged 3 commits into
fairmatfrom
bring_back_rays_comments_em

Conversation

@mkuehbach

@mkuehbach mkuehbach commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator

This implements the changes requested by Ray on NXem and NXapm renaming of classes that is discussed in #402 (which is the view for the reviewers for NXem) to the fairmat branch so we can use it from the next pynxtools release onwards.

Summary by Sourcery

Integrate Ray’s comments by renaming instrument and event data groups in NXem and NXapm, broadening NXcorrector_cs and NXaberration for classical optics, adding NXoptical_lens support, and refining documentation and attributes for consistency.

New Features:

  • Add NXoptical_lens group to NXcorrector_cs to support optical lens definitions
  • Introduce long_name attribute for intensity fields in NXem payloads

Enhancements:

  • Rename NXinstrument_em/NXevent_data_em to NXem_instrument/NXem_event_data across NXem definitions
  • Rename NXinstrument_apm/NXevent_data_apm to NXapm_instrument/NXapm_event_data across NXapm definitions
  • Broaden NXcorrector_cs and NXaberration documentation to cover classical optics use
  • Update docstrings and symbols in various definitions for improved clarity and consistency

@sourcery-ai

sourcery-ai Bot commented Jul 29, 2025

Copy link
Copy Markdown

Reviewer's Guide

This PR integrates Ray’s feedback by standardizing naming for event and instrument group classes in both EM and APM definitions, extending NXcorrector_cs to include optical components and broader context, and refining documentation with new usage notes and attribute enhancements.

Class diagram for standardized event and instrument group renaming (EM and APM)

classDiagram
    class NXem_event_data {
        +start_time: NX_DATE_TIME
        +end_time: NX_DATE_TIME
        +identifier_sample: NX_CHAR
        +instrument: NXem_instrument
        +user: NXuser
        +image: NXimage
        +spectrum: NXspectrum
    }
    class NXem_instrument {
        +name: NX_CHAR
        +location: NX_CHAR
        +type: NX_CHAR
        +ebeam_column: NXebeam_column
        +tilt1: NX_NUMBER
        +tilt2: NX_NUMBER
        +rotation: NX_NUMBER
        +position: NX_NUMBER[3]
    }
    class NXapm_event_data {
        +start_time: NX_DATE_TIME
        +end_time: NX_DATE_TIME
        +instrument: NXapm_instrument
    }
    class NXapm_instrument {
        +type: NX_CHAR
        +location: NX_CHAR
        +flight_path: NX_FLOAT
        +pulsing_device: NXcomponent
    }
    NXem_event_data --> NXem_instrument
    NXapm_event_data --> NXapm_instrument
    NXem_event_data --> NXuser
    NXem_event_data --> NXimage
    NXem_event_data --> NXspectrum
Loading

Class diagram for extended NXcorrector_cs and NXaberration usage

classDiagram
    class NXcorrector_cs {
        +applied: NX_BOOLEAN
        +description: NX_CHAR
        +alignment: NXprocess
        +c_3: NXaberration
        +c_5: NXaberration
        +c_7: NXaberration
        +c_9: NXaberration
        +c_5_1: NXaberration
        +c_5_2: NXaberration
        +c_5_3: NXaberration
        +c_5_4: NXaberration
        +c_5_5: NXaberration
        +c_5_6_a: NXaberration
        +c_5_6_b: NXaberration
        +electromagnetic_lens: NXelectromagnetic_lens
        +optical_lens: NXoptical_lens
        +aperture: NXaperture
        +deflector: NXdeflector
    }
    class NXaberration {
        +magnitude: NX_NUMBER
        +order: NX_INT
        +name: NX_CHAR
        +alias: NX_CHAR
    }
    NXcorrector_cs --> NXaberration
    NXcorrector_cs --> NXelectromagnetic_lens
    NXcorrector_cs --> NXoptical_lens
    NXcorrector_cs --> NXaperture
    NXcorrector_cs --> NXdeflector
Loading

Class diagram for updated measurement groups referencing new instrument/event types

classDiagram
    class NXem_measurement {
        +instrument: NXem_instrument
        +eventID: NXem_event_data [*]
    }
    class NXapm_measurement {
        +instrument: NXapm_instrument
        +eventID: NXapm_event_data [*]
    }
    NXem_measurement --> NXem_instrument
    NXem_measurement --> NXem_event_data
    NXapm_measurement --> NXapm_instrument
    NXapm_measurement --> NXapm_event_data
Loading

File-Level Changes

Change Details Files
Standardize EM instrument and event group names
  • Renamed NXinstrument_em to NXem_instrument across YAML and NXDL files
  • Renamed NXevent_data_em to NXem_event_data and updated all references
  • Updated NXem application definition and measurement groups to use the new names
base_classes/nyaml/NXinstrument_em.yaml
base_classes/NXinstrument_em.nxdl.xml
base_classes/nyaml/NXevent_data_em.yaml
base_classes/NXevent_data_em.nxdl.xml
applications/nyaml/NXem.yaml
applications/NXem.nxdl.xml
base_classes/nyaml/NXem_measurement.yaml
base_classes/NXem_measurement.nxdl.xml
Standardize APM instrument and event group names
  • Renamed NXinstrument_apm to NXapm_instrument across YAML and NXDL files
  • Renamed NXevent_data_apm to NXapm_event_data and updated references
  • Updated NXapm application definition and measurement groups to use the new names
base_classes/nyaml/NXinstrument_apm.yaml
base_classes/NXinstrument_apm.nxdl.xml
base_classes/nyaml/NXevent_data_apm.yaml
base_classes/NXevent_data_apm.nxdl.xml
applications/nyaml/NXapm.yaml
applications/NXapm.nxdl.xml
base_classes/nyaml/NXapm_measurement.yaml
base_classes/NXapm_measurement.nxdl.xml
Extend NXcorrector_cs for optical use
  • Added NXoptical_lens group to the corrector schema
  • Expanded documentation to highlight use in classical optics and optical setups
base_classes/nyaml/NXcorrector_cs.yaml
base_classes/NXcorrector_cs.nxdl.xml
Enhance documentation and metadata attributes
  • Added usage notes for classical optics in NXaberration and NXcorrector_cs
  • Introduced long_name attribute for intensity fields in detector groups
  • Standardized US spelling (modeled)
  • Clarified reftags in NXebeam_column documentation
base_classes/nyaml/NXaberration.yaml
base_classes/NXaberration.nxdl.xml
base_classes/nyaml/NXebeam_column.yaml
applications/nyaml/NXem.yaml
applications/NXem.nxdl.xml

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:

  • The renaming of core group types (e.g. NXinstrument_em → NXem_instrument, NXevent_data_em → NXem_event_data) will break backward compatibility—please provide an aliasing or migration strategy so existing files continue to validate.
  • There’s a typo in the NXcorrector_cs docs around the :ref:NXoptical_lens reference (missing backtick)—please correct the markup to ensure proper linking.
  • You’ve added a long_name attribute to the intensity field in NXem, but it’s not applied consistently across all definitions—please unify the inclusion of long_name on intensity in both NYAML and NXDL versions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The renaming of core group types (e.g. NXinstrument_em → NXem_instrument, NXevent_data_em → NXem_event_data) will break backward compatibility—please provide an aliasing or migration strategy so existing files continue to validate.
- There’s a typo in the NXcorrector_cs docs around the :ref:`NXoptical_lens` reference (missing backtick)—please correct the markup to ensure proper linking.
- You’ve added a long_name attribute to the intensity field in NXem, but it’s not applied consistently across all definitions—please unify the inclusion of long_name on intensity in both NYAML and NXDL versions.

## Individual Comments

### Comment 1
<location> `base_classes/nyaml/NXaberration.yaml:12` </location>
<code_context>
         Table 7-2 of Ibid. publication (page 305ff) documents how to convert from the Nion to the CEOS definitions.
         Conversion tables are also summarized by `Y. Liao &lt;https://www.globalsino.com/EM/page3740.html&gt;`_ an introduction.
+        
+        The use of the base class is not restricted to electron microscopy but can also be useful for classical optics. 
     </doc>
     <field name="magnitude" type="NX_NUMBER" units="NX_ANY">
</code_context>

<issue_to_address>
Broader applicability is now mentioned, but the sentence could be more precise.

Please clarify the specific use cases for this class in classical optics to make the documentation more helpful.
</issue_to_address>

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 base_classes/nyaml/NXaberration.yaml
@mkuehbach mkuehbach requested a review from lukaspie July 29, 2025 17:43

@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, but I haven't checked that all occurrences have been changed

@rayosborn

Copy link
Copy Markdown

@mkuehbach, thanks for such a quick response, and sorry to raise issues at the last minute. I have added my vote to approve nexusformat#1423.

@mkuehbach mkuehbach changed the title Integrate Rays comments FAIRmat-NFDI nexus_definitions PR #402 Ray's suggestions added to FIRmat-NFDI nexus_definitions PR #402 (how FAIRmat sees it) Jul 30, 2025
@mkuehbach mkuehbach merged commit c0f643a into fairmat Jul 30, 2025
6 checks passed
@mkuehbach mkuehbach deleted the bring_back_rays_comments_em branch July 30, 2025 07:04
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.

4 participants