Skip to content

Support for PRZ files with arbitrary dispersion direction - #488

Open
gguzzina wants to merge 2 commits into
hyperspy:mainfrom
gguzzina:main
Open

Support for PRZ files with arbitrary dispersion direction#488
gguzzina wants to merge 2 commits into
hyperspy:mainfrom
gguzzina:main

Conversation

@gguzzina

@gguzzina gguzzina commented Mar 6, 2026

Copy link
Copy Markdown

Historically Panta Rhei used to store EELS data with an "energy type" dispersion, similar to what is usually done in XPS. Since Panta Rhei 0.23 this behavior is toggleable, and the overwhelming majority of users have switched to "energy loss type" behaviour, coherently with what is normally done in the EELS community.

This is not just a cosmetic change, the energy channels are actually in a different order in the stored files, and this requires a change in the loader.

Progress of the PR

  • Change implemented (can be split into several points),
  • 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
  • add tests,
  • ready for review.

gguzzina added 2 commits March 6, 2026 11:22
The Panta Rhei format supports multiple calibrations per each axis.

This patch automatically selects them with the same priority used
internally by Panta Rhei when exporting.
Panta Rhei supports user selectable dispersion orientation, either
according to energy (like usual XPS data) or according to energy loss
(the usual convention in EELS).

Allow loading correctly both variants
@codecov

codecov Bot commented Mar 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.25%. Comparing base (3ad9b03) to head (f0e9b77).
⚠️ Report is 50 commits behind head on main.

Files with missing lines Patch % Lines
rsciio/pantarhei/_api.py 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #488      +/-   ##
==========================================
+ Coverage   88.24%   88.25%   +0.01%     
==========================================
  Files         108      108              
  Lines       12207    12212       +5     
  Branches     2256     2258       +2     
==========================================
+ Hits        10772    10778       +6     
  Misses        904      904              
+ Partials      531      530       -1     

☔ 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.

Thank you @gguzzina, after adding comments to the code, tests and a changelog entry, this will be all good to merge!

Comment thread rsciio/pantarhei/_api.py
# axis ordered by increasing energy means loss direction to the left
if meta_data.get("filter.mode") == "EELS" and not meta_data.get(
"source.flip_geometry"
):

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.

Can you add a comment explaining what you said in the description of the PR?

Comment thread rsciio/pantarhei/_api.py
content_type = meta_data.get("content.types")
calibrations = []
for axis in range(data_dimensions):
calib_key = "device.calib"

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.

Can you add a comment explaining when these keys are used in relation to file version and/or features?

@ericpre ericpre added this to the v0.13 milestone Mar 11, 2026
@ericpre ericpre modified the milestones: v0.13, v0.14 Apr 8, 2026
@ericpre ericpre modified the milestones: v0.14, v0.15.0 May 26, 2026
@ericpre ericpre modified the milestones: v0.15.0, v0.16.0 Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants