Repository navigation
Extending mainpage example - #114
Conversation
There was a problem hiding this comment.
Rename central_data -> image to make the rest of the example nice and simple?
|
@cdeil - what about using an inverted grayscale for the image? |
|
Inverted grayscale could look nicer ... @bsipocz can you try and paste the result here before we decide? |
|
Yes, I guess the inverted gray looks way much better. |
|
@bsipocz - cool, can you upload an example here? (I mean in a comment, so I can see) |
|
@astrofrog - yes, I'm trying, but can't figure out how to do it via github as @cdeil 's figure. Anyway here it is: |
|
@bsipocz You can drag & drop images into the Github issue input fields: https://github.com/blog/1347-issue-attachments |
|
Wow, thanks @cdeil. |
|
I like the inverted color scale. |
|
OK, we can go smaller. However I would enlarge the circles as they show the actual apertures. But if you mean make them relatively larger, that having a smaller cut will solve that, too. |
I don't know what you mean here. |
|
I mean the smaller cut-out you sad. Now it's 400x400 pixels, if it's just 200x200 the fix 4pixel radius will look relatively larger for the apertures. |
|
Ah ... OK .. my suggestion was to make the circles so large that they visually contain the whole source, i.e. are not in the black part of the image when using the inverted color scale as we are now. My main point would be that this makes them more visible, but I guess it also corresponds to "full-enclosure" aperture photometry, i.e. getting the total flux from each source, which is anyways a reasonable thing to do as long as we don't have a PSF model to provide a correction for the flux in smaller apertures? |
|
@astrofrog To me it looks like some apertures are well-centered on the sources and only some are shifted ... @larrybradley maybe you can help check if the |
|
This is the version @bsipocz showed before, it seems the apertures are very slightly too low and too left. Do you see that too? |
|
@cdeil - OK, not I see what you meant. Optimizing the aperture size for the brightest sources means on the other hand that you measure too many sky in the fainter sources, and so screw up their photometry. The brightest sources in this image are saturated anyway, so most people would throw them away. One typical approach is to use multiple apertures per sources and choose an optimal one for each in a later step. |
|
@astrofrog - yes, I had the same feeling, but couldn't find where it went wrong. |
|
I will compare |
|
@larrybradley - now that you said it, I remember we indeed had some similar issues with |
|
Actually I think the issue is that matplotlib is assuming te center of the bottom left pixel is 0.5,0.5, so I think you need e.g.: |
I don't see a shift in either of these images ... both look correct to me (blinking in Chrome). |
|
Sorry, my previous comment was a bit fuzzy. |
There was a problem hiding this comment.
It obviously works ... but why 3 sigma below the median background level?
I would have thought 3 sigma above should be used for detection?
There was a problem hiding this comment.
The 3 was an arbitrary choice. I run it with the median bkg first, which left me with a few undetected sources. In this image the fluctuations are not big, but large scale variations can be very common. If part the image has lower background, and all the faint sources get undetected with a high threshold. Maybe a better parametrization is to have a very low threshold but higher S/N.
Estimating the background can be quite tricky, here is the approach I'm most familiar with as a user: http://casu.ast.cam.ac.uk/surveys-projects/software-release/imcore
There was a problem hiding this comment.
I didn't mean "why 3"?
I meant the sign, i.e "why threshold = background - 3 * sigma and not threshold = background + 3 * sigma?
Threshold is the absolute image level above which to select sources, so it should be higher than background, no?
But looking at the detections it obviously works, so we can ignore this for now ... it's just a bit weird.
There was a problem hiding this comment.
There was a problem hiding this comment.
however it's obvious I should check how daofind works exactly because not the faintest sources were left out as one would expect...
There was a problem hiding this comment.
Yes ... very bright isolated stars are missing, so there must be other selections applied by doafind than the simple thresholding ... maybe @larrybradley can comment or you can switch to irafstarfind if that behaves as expected?
(I'll start playing with the detection methods a bit now to try to understand what is going on.)
There was a problem hiding this comment.
they might be saturated, and daofind is clever to threat saturated ones
differently? I'll check it once I finish with the other comments.
On 8 July 2014 21:57, Christoph Deil notifications@github.com wrote:
In docs/photutils/index.rst:
import numpy as np
from photutils import datasets
hdu = datasets.load_star_image() # doctest: +REMOTE_DATA
image = hdu.data[500:700, 500:700] # doctest: +REMOTE_DATA
+
photutilssupports different source detection algorithms, this example
+uses~photutils.daofind. The threshold is set to be the 3-sigma below the
+median background level:Yes ... very bright isolated stars are missing, so there must be other
selections applied by doafind than the simple thresholding ... maybe
@larrybradley https://github.com/larrybradley can comment or you can
switch to irafstarfind if that behaves as expected?
(I'll start playing with the detection methods a bit now to try to
understand what is going on.)—
Reply to this email directly or view it on GitHub
https://github.com/astropy/photutils/pull/114/files#r14679671.
|
Looking at the current example I'm not sure adding all the code to find and plot the faintest and brightest source is an improvement ... @bsipocz what do you think? Possible alternatives are to end with the line running the aperture photometry and to simply state that the returned In any case I'd like to merge this soon so that we can give Perry this plot for the presentation tomorrow ... the code will change in the next weeks anyways when |
|
Agreed ... let's not show the fluxes for now ... it will take more time to get reliable results. |
|
Sorry I missed the discussion about the flux comparison, but I would not use this plot. Note, that this is |
|
@larrybradley I agree eventually we probably want to add aperture photometry to this example, but the way it's implemented at the moment it probably won't work for so few stars (see discussion in #104) and it's mostly untested, so I'd suggest leaving it out for today. As I said somewhere above, IMO it would be OK to end the example with |
|
I just now sent this slide to Perry for tomorrow's presentation of Astropy at Scipy where Fitting the code example on a slide would have been difficult in any case. So I don't think we have to rush this PR too much ... if it's ready by tomorrow fine, but if it takes a few more days, no problem. |
|
@cdeil Sounds good to me. (I think you meant we should eventually add PSF photometry as an example). And thanks for putting the slide together for Scipy. |
|
This bkg estimation is rather ugly, but for the time being it's better than nothing. Most of the code is under refactoring anyway. |
There was a problem hiding this comment.
In this duplicated code that makes the plot you are not doing the background subtraction from the annulus, which leads to the brightest source you mark in red not being the one at [ 141.14990304, 180.75490949] as printed above.
|
@bsipocz Thanks for all the work you've put into this and the patience with my comments. I'm not sure hard-wiring this one form of background estimation into For this example I'd suggest to subtract the global median from the image at the top and add a sentence or two explaining that from here on for this example we assume the image is background-subtracted. In the future better background estimation methods might be added to photutils or ccdproc. Before I merge this, could you please squash the commits into a single commit "Update getting started example"? (using |
There was a problem hiding this comment.
I've looked a bit into daofind and while I still don't understand it in detail, I'm pretty sure passing a threshold below the background level doesn't make sense. So could you please change the - to + here even if you loose some faint detections? I think it's OK to not detect the bright saturated stars if you explain that in a sentence, but if you do want them here I think you have to adjust the sharp and round cuts when calling daofind.
|
@cdeil - I don't like the hard wired way of estimating the local background either, and definitely would be good to have some astropy/ccdproc/photutils tools to do local bkg estimations. |
|
@cdeil - I think this is ready to be merged. I've removed the duplicate plot, and only kept the second one. |
|
Here's a comparison of Note I used |
|
Looks good .. merging this now. Everyone, feel free to extend / improve this example and other parts of the docs in future pull requests. |
|
@cdeil - I reported the bug in the shift here: matplotlib/matplotlib#3776 |
|
Actually my MWE was showing a different bug, so investigating some more. |
|
Ok, I'm clearly confused - re-reading this I realize that there was actually no bug and that it was just previous versions that had a bug. But everything seems fine here. |





No description provided.