Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: with_spectral_axis_and_flux_units #1184

Merged
merged 1 commit into from
Oct 14, 2024
Merged

Conversation

pllim
Copy link
Member

@pllim pllim commented Oct 11, 2024

Follow-up of #1181 . I think it would really benefit Cubeviz parser if we can do both spectral axis and unit conversions at the same time, to avoid copying an object twice unnecessarily.

I also couldn't help myself by cleaning up some existing test code after noticing unnecessary usage of Numpy random number generator.

🐱

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.89%. Comparing base (2329d11) to head (7097d8a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1184      +/-   ##
==========================================
+ Coverage   86.87%   86.89%   +0.01%     
==========================================
  Files          63       63              
  Lines        4556     4562       +6     
==========================================
+ Hits         3958     3964       +6     
  Misses        598      598              

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

@pllim pllim marked this pull request as ready for review October 12, 2024 21:31
@pllim
Copy link
Member Author

pllim commented Oct 12, 2024

devdeps failure is unrelated: http.client.RemoteDisconnected: Remote end closed connection without response

@keflavich
Copy link
Contributor

This makes some sense to me - with single 1D spectra, copying the spectral axis (which is needed for changing the spectral unit) is just as expensive as copying the data (changing the flux unit). In spectral-cube, we have considered copies of the spectral axis 'cheap' under the assumption that the 1D axis is always << the 3D data. So I'm onboard with this - but I had to think through it to see why there's value.

Copy link
Contributor

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the test cleanups.

@rosteen rosteen merged commit a859dd6 into astropy:main Oct 14, 2024
11 of 12 checks passed
@pllim pllim deleted the moar-unit-conv branch October 14, 2024 15:02
@pllim
Copy link
Member Author

pllim commented Oct 14, 2024

@keflavich , there is also cost in memory.

Thanks for the reviews, everyone!

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