-
Notifications
You must be signed in to change notification settings - Fork 74
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
Debug Cubeviz batch photometry #3163
Debug Cubeviz batch photometry #3163
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3163 +/- ##
==========================================
- Coverage 88.82% 88.44% -0.39%
==========================================
Files 112 122 +10
Lines 17626 18276 +650
==========================================
+ Hits 15657 16164 +507
- Misses 1969 2112 +143 ☔ View full report in Codecov by Sentry. |
if isinstance(data, list): | ||
data = data[0] |
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.
don't love this, but this whole method will probably go away with #3156, and I can't think of a better way to do it with the current setup.
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.
cc @cshanahan1
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.
this will go away at some point (im trying to consolidate everything that listens to unit changes to one method in that PR), but it also seems like its necessary here for now
self.is_cube = True | ||
break | ||
else: | ||
self.is_cube = False |
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.
This can be set outside of for
? (For False
)
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.
I personally prefer this to setting it to False first and then overriding after 🤷♂️
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.
In that case, self.is_cube = False
runs every iteration (until loop ends or set to True
) whether that assignment is need or not. But given all the other performance bottlenecks we have, this is probably nothing, so okay for me if you prefer this.
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.
I have no preference, it could be set first since it's break
ing once set to True
.
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.
oh I misunderstood, yes, the else
could/should be indented out one level to be inline with the for
uc_plugin = cubeviz_helper.plugins['Unit Conversion'] | ||
|
||
fv = cubeviz_helper.app.get_viewer('flux-viewer') | ||
fv.apply_roi(CircularROI(xc=5, yc=5, radius=2)) |
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.
Why not use the load region API?
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.
I'm running into test failures after switching to load_regions
, trying to figure out if they're real or I'm calling something incorrectly.
|
||
phot_plugin.calculate_batch_photometry() | ||
|
||
assert len(phot_plugin.table) == 2 |
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.
Should we also at least check that the sums make sense?
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.
I was lazily assuming that the existing tests already covered that, and we just needed to make sure that the existing code ran multiple times here. I could add more checks though.
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.
Lines are probably covered but I am unsure about how many use cases we're actually covering here and there. My take is that more tests do not hurt but it is up to you whether you want to add more checks or not.
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.
tested this and it works well, im able to use batch mode and the results are repeatable through unit conversions
|
||
phot_plugin.calculate_batch_photometry() | ||
|
||
assert len(phot_plugin.table) == 2 |
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.
maybe you could follow some of the other tests here and compare the output tables between unit conversions, to make sure the results are the same?
if isinstance(data, list): | ||
data = data[0] |
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.
this will go away at some point (im trying to consolidate everything that listens to unit changes to one method in that PR), but it also seems like its necessary here for now
@cshanahan1 @pllim I think I addressed all of your comments that needed changes. |
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.
LGTM except maybe a rogue raise
leftover from debugging.
jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py
Outdated
Show resolved
Hide resolved
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.
Changes in this file are mainly changing things that @cshanahan1 added earlier, so I would prefer she review as well.
Co-authored-by: P. L. Lim <[email protected]>
Isn't unit conversion stuff new in v4? Can/should this really be backported? |
Hm, there was nothing incompatible with 3.10.x until I had to add the |
This comment was marked as resolved.
This comment was marked as resolved.
* Debugging Cubeviz batch photometry * Fix changing units when in batch mode * Working on adding cubeviz batch photometry test * Add simple test * Codestyle * Add comment about future changes * Move changelog to 3.10.4 * Don't convert if display unit hasn't been initialized * Update test * Codestyle * Update jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]> (cherry picked from commit 19a8f56)
Backport failed and abandoned. I updated the milestone here. Can you please open follow-up PR to move the change log? Thanks! |
* Debugging Cubeviz batch photometry * Fix changing units when in batch mode * Working on adding cubeviz batch photometry test * Add simple test * Codestyle * Add comment about future changes * Move changelog to 3.10.4 * Don't convert if display unit hasn't been initialized * Update test * Codestyle * Update jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]>
* Debugging Cubeviz batch photometry * Fix changing units when in batch mode * Working on adding cubeviz batch photometry test * Add simple test * Codestyle * Add comment about future changes * Move changelog to 3.10.4 * Don't convert if display unit hasn't been initialized * Update test * Codestyle * Update jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]> (cherry picked from commit 19a8f56)
Fixes a couple bugs with batch photometry in Cubeviz, one pre-existing and one to do with unit conversion. Opening as draft since I need to add a test or two still.