Photometry API proposal#2
Conversation
There was a problem hiding this comment.
Allowing a single object to represent multiple apertures has advantages. But keep in mind that it makes the classes a lot more complicated and therefore makes writing a custom Aperture class more difficult. It may also make the API for the Aperture classes less intuitive. We should think about how this would work inside the aperture_photometry function before deciding on this. An alternative is to
have
aps1 = [CircularAperture(1.), CircularAperture(2.), CircularAperture(3.)]
aps1 = [CircularAperture(1.5), CircularAperture(2.5), CircularAperture(3.5)]
results = aperture_photometry(image, (x, y), [aps1, aps2])
There was a problem hiding this comment.
Done - I actually removed the bit about multiple apertures that are different for every source. This would make things a lot more complicated, and I don't think there's any advantage to trying to have the function do multiple apertures that are different for every source, as opposed to having the user do this manually.
|
Comments
Arbitrary user statistics We may want to have This would address astropy/photutils#8. I haven't yet figured out an elegant way to account for pixels partially in the aperture. One idea: we could force the There could also be a registry of built-in statistics, so that |
There was a problem hiding this comment.
I'd really like to be able to specify aperture dimensions in arcseconds or arcminutes. Specifying it only in pixels places a burden on the user to look up the pixel size. Of course that assumes the aperture is going to applied to a higher-level object than an array.
There was a problem hiding this comment.
By default, I think these should be pixels (as for x and y since not all images have WCS, but it would be easy to use other units:
from astropy import units as u
a1 = CircularAperture(1.) # pixels
a2 = CircularAperture(1. * u.arcsec)
a3 = CircularAperture(1. * u.arcmin)
a4 = CircularAperture(1. * u.degree)
does this seem like a good idea to you?
|
Thanks everyone for all the comments! I'll work on a second iteration taking everything into account. |
|
@bretonr @kbarbary @stargaser - I've updated the document, taking into account all your comments. Could you review one more time and let me know whether you agree with it? I still need to add something about source detection, so if you have suggestions about this, please let me know! Also, let me know if anything else needs fixing! |
There was a problem hiding this comment.
Just note that this wouldn't quite work the way it is written. In the code for aperture_photometry(...) we have two arrays before we use the "statistic": the value of each pixel (subarr), and the fraction of the pixel in the aperture (frac). The default behavior is np.sum(subarr * frac). However, this cannot simply be replaced by np.median(subarr * frac), or even np.average(subarr * frac).
You probably realize this but it is not clear from the API document that the above is not an actual solution. Perhaps put the registry solution above and then say that a user can also define their own function that accepts values and weights, such as my_median(a, weights).
There was a problem hiding this comment.
I have now clarified this.
|
What do you all think about including galaxy model photometry? (e.g., A simple Sersic profile convolved with a PSF) It seems like this is simply an extension of PSF magnitudes, in that one is fitting a model for the flux distribution of the source. However, rather than fitting a single parameter (PSF amplitude) one is fitting multiple parameters of the galaxy model. If not defined here, it might be good to keep this sort of functionality in mind when defining the PSF photometry API, as we would want the APIs to be similar. |
|
@kbarbary - good idea, I guess that there is nothing in the current API that would preclude having PSF objects have multiple parameters. The PSF object could return a list of parameters (with the default being |
…multiple parameters.
|
@kbarbary - I think I've addressed all your comments - could you give it one final read before I open it for review by the other developers? @bretonr @stargaser - do you have any other comments? |
|
Hey guys I'm really sorry I've been traveling outside the country with poor Rene Sent from my iPhone On 2012-12-02, at 3:57 PM, Thomas Robitaille notifications@github.com @kbarbary https://github.com/kbarbary - I think I've addressed all your @bretonr https://github.com/bretonr — |
There was a problem hiding this comment.
I like the capability to make a custom statistic. However it reminded me that when photometry of a calibrated NDData object is run, meaning there are units of Jy/pixel or MJy/sr or whatever, it's nice to get units of Jy or whatever out in the output table. Perhaps this should be done by a later "aperture correction" stage.
There was a problem hiding this comment.
Automatic unit conversion would indeed be nice. I'll add a note to the document to mention that this would be nice, and it should just be part of the internal magic (like coordinate transformations).
|
Looks good, I just made one comment on getting calibrated brightnesses in the output table, which perhaps has to be handled by an "aperture correction" task. |
|
@stargaser - thanks for reviewing this! Since you've all agreed to this document now, I will merge this PR, and then open a PR to the main |
|
@stargaser @bretonr @kbarbary - merged into my |
|
Hi @sophiathl ! I'm trying to get an overview of photutils-related codes by collecting links here. |
|
Hi Christoph! Sounds great, yes, that's the link to imagecube! On Sun, Apr 27, 2014 at 12:50 PM, Christoph Deil
|
This is an initial version of the Photometry API document, based on the discussion in
https://github.com/astropy/photutils/wiki/Proposed-photutils-API
Note that for now, I have left out object detection and regions. I believe that for now we should go ahead with the idea of having aperture objects that have no specific center, because we want to be able to efficiently do photometry on tens of thousands of sources or more, and tens of thousands of instances of aperture objects is not efficient. The
Regionstuff could be developed separately, and just rely on the same cython routines under the hood. But I think for now we should focus on the photometry API without worrying about the regions (sorry for bringing it up in the first place!).Note also that the standalone photometry routines can work directly with Numpy arrays as @kylebarbary was asking. They also work with NDData objects, but that doesn't prevent using simply Numpy arrays. The only place where I think we should stick with an astropy object is the Table object for the output. It really is just a structured array, so should be familiar to users, but just has a lot of nice extras.
I also tried to re-think how we deal with multiple apertures per source and different apertures for each sources, trying to make it as intuitive as possible - I'd be interested to hear what you think.
I tried to re-think the API to ensure consistency between the aperture and PSF photometry. Note that in fact, we could even consider having a high-level
photometryfunction that could do:This would be awesome, because it would provide a way to do simultaneous aperture and PSF photometry. But that's not in the API document yet.
Things that still need to be added to this API document:
I will work on these, but let's first see if there is agreement about what's already there.
I will not add anything about the internal API, as that is a separate matter.
Once you agree with this document, I will add you as an author, and once we've converged, I'll open a PR on the main astropy-api repository!
cc @bretonr @kbarbary @stargaser