Skip to content

Parsing scan sizes of EMPAD data#520

Open
matao1984 wants to merge 2 commits into
hyperspy:mainfrom
matao1984:EMPAD_scan_size
Open

Parsing scan sizes of EMPAD data#520
matao1984 wants to merge 2 commits into
hyperspy:mainfrom
matao1984:EMPAD_scan_size

Conversation

@matao1984

Copy link
Copy Markdown
Contributor

For issue #513

Description of the change

Modified the parsing logic for the scan sizes. Now the reader looks for the raw file name with a pattern of "scan_xaaa_ybbb.raw", in which the "aaa" and "bbb" are the scan sizes for x and y, respectively. All tests passed.

The reason for this change:

The EMPAD metadata (xml) saves two sets of scan parameters tagged "search" and "acquire" with the exactly same keys. When _parse_xml reads these keys it does not distinguish the different tags so the "search" keys are overwritten by the "acquire" keys. The original logic reads the scan sizes from these keys. Therefore, the parsed scan sizes are always from the "acquire" parameters. This may work most of the time because users usually use "acquire" to take the datasets. However, it will fail if the actual dataset has been taken with the "search" parameters (which the current EMPAD GUI does not forbid you to). On the other hand, at least up to the current version of EMPAD GUI v1.2.2 the raw file name is always in the pattern of "scan_xaaa_ybbb.raw". So this should be a safer way to parse the scan sizes.

Progress of the PR

  • Change implemented (can be split into several points),
  • update docstring (if appropriate),
  • update user guide (if appropriate),
  • add a changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting of the changelog entry (and eventual user guide changes) in the docs/readthedocs.org:rosettasciio build of this PR (link in github checks)
  • add tests,
  • ready for review.

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.86%. Comparing base (a2696d2) to head (1ec3a9b).
⚠️ Report is 66 commits behind head on main.

Files with missing lines Patch % Lines
rsciio/empad/_api.py 60.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #520      +/-   ##
==========================================
+ Coverage   88.37%   88.86%   +0.49%     
==========================================
  Files         108      113       +5     
  Lines       12265    13053     +788     
  Branches     2276     2415     +139     
==========================================
+ Hits        10839    11600     +761     
- Misses        898      912      +14     
- Partials      528      541      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ericpre ericpre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good - I will double check with some old files but it seems that this is already covered in the test suite.

The tests are checking the shape of the array but the shape of the navigation and signal and I think that it would be good to check these too! Can you please update the tests accordingly?

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.

2 participants