sep
sep copied to clipboard
Large shifts in windowed positions
When using windowed positions, both SExtractor and SEP can cause a sources position to drift due to the presence of nearby neighbors. This behavior is demonstrated for SEP in this notebook and SExtractor in this notebook.
It might be best to document this effect but not fix it as this is likely to be strongly dependent on the detector and image.
Nice notebook Fred. Another workaround would be to mask the neighbor's pixels and pass the mask to sep.winpos
. You'd have to use a different mask for every object though, so it would be a little tedious to code.
I added a short note to the docstring of sep.winpos
. See http://sep.readthedocs.io/en/latest/api/sep.winpos.html. Suggestions for rewording welcome.
That's a good idea to use a mask, I hadn't thought of that. It might not be as tedious as you think. Theoretically a mask could be applied to all of the sources with good windowed positions, based on their aperture, and only the windowed positions of bad positions would need to be recalculated.
This will still fail for blended sources with overlapping apertures or non-detections of neighbors but it may improve things for a sizable number of sources with bad windowed positions.
Where is the documentation for SEP kept, I couldn't find it on gitub. I think your note is useful but I might expand it a bit. For example:
One should be cautious about using windowed positions in crowded fields or for sources with nearby neighbors, as the iterative algorithm can fail catastrophically. It can be useful to check the difference between extracted positions and windowed positions to verify that the algorithm is behaving as expected.
While this should be obvious to an astronomer, I could see a student just blindly using the code and obtaining unphysical results. You could also point them to my ipython notebook, or for consistency, a copy or some version of the notebook included with SEP if you like.
The reference docs are built from the function docstrings. Here's the source for the note I added: https://github.com/kbarbary/sep/blob/8fb49accc9073ff598c66cdedb5effeb00d3c695/sep.pyx#L1679-L1681
The other docs are in the docs
directory. It would be great if you add to the section "Equivalent of XWIN_IMAGE, YWIN_IMAGE in Source Extractor" in docs/apertures.rst
. Perhaps just a short demo of how to check the position differences.