Skip to content

🔧 Refactor Prodigy XY loader: add support for 1D XPS data#160

Merged
arafune merged 18 commits into
arafune:mainfrom
mkopciuszynski:fix-prodigy-xy-for-xps
Mar 24, 2026
Merged

🔧 Refactor Prodigy XY loader: add support for 1D XPS data#160
arafune merged 18 commits into
arafune:mainfrom
mkopciuszynski:fix-prodigy-xy-for-xps

Conversation

@mkopciuszynski

Copy link
Copy Markdown

This PR adds support for 1D Prodigy .xy files, used e.g. in XPS/AES where the detector’s non‑energy channels are integrated, and therefore there is no "NonEnergyOrdinate" in the file.

Supporting XPS data required reworking how dimensions are detected and reshaped, so a large part of the plugin was rewritten.

During this cleanup I also removed the old ProdigyXY class, which was essentially unused, the module now exposes only the functional API with load_xy() as the main public entry point, as it was before.

The new structure is simpler and better prepared for future extensions (e.g. higher‑dimensional scans).

@mkopciuszynski mkopciuszynski changed the title Fix Prodigy xy plugin for 1D XPS data 🔧 Refactor Prodigy XY loader: add support for 1D XPS data Mar 20, 2026
@codecov

codecov Bot commented Mar 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.24390% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.22%. Comparing base (72ca734) to head (c1d9ee7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/arpes/endstations/prodigy_xy.py 89.88% 3 Missing and 6 partials ⚠️
src/arpes/endstations/plugin/DSNP_UMCS.py 40.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #160      +/-   ##
==========================================
- Coverage   72.23%   72.22%   -0.02%     
==========================================
  Files         228      228              
  Lines       14668    14662       -6     
  Branches     1218     1223       +5     
==========================================
- Hits        10596    10589       -7     
  Misses       3843     3843              
- Partials      229      230       +1     
Flag Coverage Δ
unittests 72.22% <90.24%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@mkopciuszynski

Copy link
Copy Markdown
Author

I am getting Ruff errors from the files that where not modified...
Maybe Ruff was updated...

@mkopciuszynski mkopciuszynski force-pushed the fix-prodigy-xy-for-xps branch from 803204b to aec54ae Compare March 23, 2026 11:16
@mkopciuszynski mkopciuszynski marked this pull request as ready for review March 23, 2026 11:35
@arafune

arafune commented Mar 24, 2026

Copy link
Copy Markdown
Owner

Could you also add a changelog entry to docs/source/CHANGELOG.rst ?

…port 1D/2D/3D

- refactor _parse_xy_dims to return only real dimensions (no empty placeholders)
- remove artificial third dimension ("thirddim") and rely on header-defined parameters
- introduce unified axes model (energy + optional dimensions)
- generalize data reshaping to support arbitrary number of dimensions
- fix handling of 1D data (no NonEnergyOrdinate)
- simplify to_data_array by dynamically building coords and dims from axes
- add validation of data size against expected axis dimensions

DSNP_UMCS plugin update:
- avoid assuming presence of "nonenergy" coordinate

This refactor removes hardcoded dimensional assumptions and prepares the loader
for future extensions (e.g. additional scan parameters / higher dimensions).
- remove unused axis_info and MAP_DIMENSION
- simplify load_xy by forwarding kwargs
- add helper function _reshape_intensity
- use dict.get for safer param access
- add comments for non-obvious logic
- rename some variables for clarity
- Fixed a bud in regex used to catch dim names and values
- Use named regex groups instead of positional
- Fixed n_other calculation - it was returning a float value for an empty xy_dims.
- Use np.allclose in float value comparison.
- The axis_info property was removed and now a datastructure axes is used instead
- Added test_axes_match_data_shape
- add named regex groups for key-value parsing
- introduce HEADER_VALUES_TYPES for explicit type casting
- remove implicit float casting in favor of controlled schema
The plugin is primarily used for parsing and loading data from Prodigy .xy files.

This change removes the Prodigy class and consolidates its functionality into the load_xy function, supported by helper functions.
@mkopciuszynski mkopciuszynski force-pushed the fix-prodigy-xy-for-xps branch from 1089406 to c74ce28 Compare March 24, 2026 10:51
Updated version number from 5.1.0 to 5.0.3 and removed old entry.
@mkopciuszynski

Copy link
Copy Markdown
Author

I've rebased this branch to include the latest changes from main and added a changelog entry on top.

@arafune arafune merged commit 4976939 into arafune:main Mar 24, 2026
13 of 31 checks passed
@mkopciuszynski mkopciuszynski deleted the fix-prodigy-xy-for-xps branch March 25, 2026 08:27
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