-
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
Imviz simple aperture photometry plugin (no photutils) #938
Imviz simple aperture photometry plugin (no photutils) #938
Conversation
Codecov Report
@@ Coverage Diff @@
## main #938 +/- ##
==========================================
+ Coverage 69.09% 70.06% +0.96%
==========================================
Files 69 71 +2
Lines 4935 5121 +186
==========================================
+ Hits 3410 3588 +178
- Misses 1525 1533 +8
Continue to review full report at Codecov.
|
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.
Nice! One request--Please add the option to display the results in counts. MJy/sr is also not the correct unit. Need to multiply by the pixel area in sr to get the result in Jy.
jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py
Outdated
Show resolved
Hide resolved
|
||
# TODO: Use photutils when it supports astropy regions. | ||
aper_mask = reg.to_mask(mode='exact') | ||
img = aper_mask.get_values(comp_no_bg, mask=None) |
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.
Probably out of scope, but in principle one could define a mask (e.g., from a DQ array perhaps).
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.
Yes, that is out of scope for now. We have hard enough time getting stuff out of various headers, let alone getting even more arrays from different extensions.
This comment has been minimized.
This comment has been minimized.
@pllim We discussed this and agreed there should be an input field for counts-to-flux conversion factor. |
@larrybradley , just so I understand, you expect user to calculate this by hand? (Ops, I pinged the wrong person, sorry! Cami explained it during tag-up on 2021-10-19.) |
This might be a can of worms. The image is not always MJy/sr. What I can do is to display the result unit with an additional |
@pllim @larrybradley How about a pixel scale input field (in arcsec)? This could be converted to sr/pix, so that flux = MJy/sr * (sr/pix). |
I think I need input from @larrybradley here as
Also, if we create yet another user input field for pixel scale, is it always applicable for any number of image units, telescope, detector, etc? If someone does not know or care and just want the aperture sum, how should this plugin behave? |
eed5f49
to
1acbed1
Compare
@pllim Default conversion factor could be for 1x1 sq arcsec pixel. |
@PatrickOgle , the value is from image header.
|
|
||
.. _imviz-link-control: | ||
|
||
Link Control |
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.
@javerbukh , I added some stuff here but I don't remember if you wanted me to start this as another PR or not...
This is now feature-complete and ready for review. @larrybradley @PatrickOgle et al., please double check the math. Thanks! |
If I only load one image (acs_47tuc_1), with a different regions, I get (1991.309814453125 pix, 1037.7984619140625 pix) compared to (x=1991.309814453125, y=1037.7984619140625) from get_interactive_regions, so they match. The mouseover x values are still way off.
Imviz, DS9 The header for this ACS image has BUNIT="ELECTRONS" |
If I leave the Flux scaling box empty, I get the following error when I calculate: |
Co-authored-by: Larry Bradley <[email protected]>
factor when possible in photometry plugin. Improve photometry table output. Imviz parser now understands HST e- and e-/s units. Imviz parser now inherits image metadata. For FITS HDUList, this includes primary header.
* Rename pixel scale to pixel area to be more accurate. * Rename mag zeropoint to flux scaling to be more accurate. * Add calculation timestamp as astropy.time.Time object. [ci skip]
Add tests for numpy array and JWST data.
TST: Finish writing phot plugin tests.
DOC: Add intersphinx to astropy regions package doc.
Fix PEP 8.
f478f59
to
8f3441b
Compare
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.
The code looks good to me, everything looks sensible and works (as far as I can tell, perhaps @PatrickOgle will provide more rigorous validation of the calculation results). Nice addition.
Edit: I also meant to say that I appreciate the detailed documentation!
Thanks for the commit, @rosteen ! I do not mind at all. 😸 |
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.
The outputs of the photometry tool match the aperture photometry from DS9, to better than 10%. The Poisson uncertainty on counts also seems to be correct and properly incorporates the flux/counts conversion factor. More accurate science validation TBD in a separate PR.
Thanks for the reviews! |
Description
This pull request is to add a plugin to perform simple aperture photometry in Imviz.
This supersedes #930 . This is a simpler implementation that only works on default viewer and does not rely on
photutils
.TODO:
id
logic so it increments if appending successfully toQTable
.mode='center'
for normal stats.Handle pixel area correctly in aperture sum unit.New user input field for pixel scale in arcsec squared to be converted to steradians to get rid of it in JWST data unit.(Hold off for now until we have finalized the code and UI.)See https://jdaviz--938.org.readthedocs.build/en/938/imviz/plugins.html(Screenshots a bit outdated but you get the idea.)
Pre-requisite for #531 .
🐱
Fixes #531
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.CHANGES.rst
?