-
Notifications
You must be signed in to change notification settings - Fork 153
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
Fix bug when chunking large arrays with a subset defined #2302
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2302 +/- ##
==========================================
- Coverage 88.13% 88.13% -0.01%
==========================================
Files 247 247
Lines 23365 23370 +5
==========================================
+ Hits 20592 20596 +4
- Misses 2773 2774 +1
Continue to review full report at Codecov.
|
Woohoo... looking green! |
|
Definitely not the fault of this PR, I ran into that once when trying to pin Codecov uploader version. Likely on their end. |
p.s. I thought this was the astropy conda-forge PR. Sorry for the noise wrt CI status. 😆 |
What works for |
Well, a little further down in the code there's an if case for |
I was more concerned about the memory footprint if chunking is bypassed for huge arrays, but at the location of the broadcast error you pointed to the chunking seems already to be taken care of in the |
Yes, that would have already worked in the |
I'd like to understand a bit better why this is not working currently - in principe it is possible one would use a RangeSubsetState with a huge array. The reason we special case @dhomeier - would you have time to investigate if we can fix this without special-casing |
I'm pretty sure that one of |
Sure. Not sure how long it will take; I am not that familiar with that code yet – just with regard to the bugfix release. |
Is it too controversial to merge this as-is to get the bug fix release out and then investigate a better fix as a follow-up PR? A working but horrible performance solution is better than completely broken? |
Yes, from the exception
It's not just performance per se, since the function potentially doubles-triples the memory footprint. If that is manageable in your Jdaviz application, maybe a better workaround for now would be to set |
The only call of |
Fix codestyle
bd90cb9
to
9538119
Compare
@dhomeier @astrofrog I did some more investigating and implemented a fix to actually generate the correct result shape rather than skipping the chunking altogether for |
Try a subset with 2 separated spectral regions. This might be an unrelated bug. |
@orifox Yes, that's exactly the case my recent PR fixed/improved - again, are you up to date with |
I just installed the dev branch an hour ago. |
2.6.1.dev79+gcf22f84d |
Got it, good to know - probably a real bug then. |
Does fixing failing test also magically fixes Ori's use case? |
Hmm....I'd rate that as "doubtful, but possible". Worth checking. |
It does fix the extended |
Co-authored-by: Derek Homeier <dhomeie@gwdg.de>
@dhomeier I added both of your tests here, and they both pass locally. Maybe you had some additional differences in your local environment? I added them here to check that they pass on CI and they look ok - there are some failures but they seem to be unrelated to this PR (and I see some failures on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turned out I messed up my own tests; apart from the minor suggestions this looks great, thanks! The PySide2 crashes are known issues and unrelated.
Co-authored-by: Derek Homeier <dhomeie@gwdg.de>
Ha, it happens! Thanks for the review, I committed your remaining suggestions. |
Thanks again for the fix @rosteen! |
Yay! @orifox should try again with the latest dev version of glue-core 🤞 |
@dhomeier , is it possible to do a release with this patch soon? 🙏 |
@astrofrog what do you think? I'll merge #2235 today; could make a 1.5.0 then. |
Sounds good, thanks! |
v1.5.0 is on PyPI now; thanks all again for their contributions! |
Description
We were running into a bug for large cubes in Jdaviz, where we couldn't retrieve the collapsed spectrum if the cube was above a certain size (above
n_chunk_max
incompute_statistic
as it turned out). I'm not sure if this is the best fix, but it works to avoid the broadcast error we were encountering on line 1689 where there was an array size mismatch with aRangeSubsetState
defined and number of array elements >n_chunk_max
.