Skip to content

Accept FITS big-endian byte order - #98

Merged
ahuang314 merged 3 commits into
lenstronomy:mainfrom
bryce-wedig:bugfix/big-endian-byte-order
Jun 20, 2026
Merged

Accept FITS big-endian byte order#98
ahuang314 merged 3 commits into
lenstronomy:mainfrom
bryce-wedig:bugfix/big-endian-byte-order

Conversation

@bryce-wedig

Copy link
Copy Markdown
Contributor

This PR allows JAXtronomy to handle raw FITS data which uses big-endian byte order.

While modeling JWST strong lenses with dolphin, I got the following error:

TypeError: Dtype >f8 is not a valid JAX array type. Only arrays of numeric types are supported by JAX.

The fix, dtype=float, is a no-op for regular little-endian arrays but will byte-swap big-endian arrays so JAX can handle them.

@bryce-wedig

Copy link
Copy Markdown
Contributor Author

The failing CI is due to Astropy v8.0.0 which was released just yesterday. Pinning astropy<8.0.0 should work for now, but obviously that's a temporary fix and lenstronomy will need to be patched to be compatible. Please let me know how you want to deal with this.

@ahuang314

Copy link
Copy Markdown
Collaborator

@bryce-wedig Thanks for this PR, setting astropy<8.0.0 is fine for now, we can address that later

@sibirrer

Copy link
Copy Markdown
Contributor

@bryce-wedig @ahuang314 I am making a PR in lenstronomy aimed at fixing this: lenstronomy/lenstronomy#868

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.98%. Comparing base (676b9f3) to head (73b730b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #98   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files          80       80           
  Lines        7330     7331    +1     
=======================================
+ Hits         7329     7330    +1     
  Misses          1        1           
Files with missing lines Coverage Δ
jaxtronomy/Data/image_noise.py 100.00% <100.00%> (ø)
jaxtronomy/Data/imaging_data.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ahuang314
ahuang314 requested review from ahuang314 and sibirrer and removed request for sibirrer June 18, 2026 04:35

@ahuang314 ahuang314 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.

looks good to me

@ahuang314
ahuang314 merged commit 516a4c3 into lenstronomy:main Jun 20, 2026
6 of 9 checks passed
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