-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Extending ePSF building framework to accept odd oversampling factors and non-zero offset grid points #989
Conversation
After a quick look (will need to do more later), this is in the right direction. One thing to change, though:
Not strictly necessary, but I think it would be useful to add an example of this to the bottom of https://photutils.readthedocs.io/en/stable/epsf.html - perhaps even follow what went above with only a change to oversampling=1 ? Obviously the PSF won't look as good but it'll at least illustrate the idea that this is now an option.
Yes, I think this goes in 0.8 and have milestoned as such. It's a bit debatable if this is a "new feature" vs "bringing back an old feature", but since the latter isn't a category I think it's best to just say it's a new feature (it's new relative to 0.7.x, anyway...). |
… EPSFModel -- now implicitly just an integer
…id shapes and offsets to interpolation spline points
…d offsets to spline points.
…centroid_epsf is accepted -- due to incompatibility with several oversampling/offset combinations
…ng centroid_com -- the new default -- as it cannot handle non-zero grid offsets
…ere might not be a grid point exactly in the middle of a detector pixel
…ion, allowing for avoidance of circular dependencies on oversampling and grid_offset in the super() init call
…versampling/grid_offset values
…t checks in EPSFBuilder and EPSFModel
…rsampling and grid_offset, ensuring a grid point represents the middle of a detector pixel for symmetry
…, shifting by default an ePSF grid point to map to exactly the middle of a detector pixel -- 0 shift for even oversampling but half a grid spacing for odd oversampling -- as the default behaviour
…ampling factor as an option
…d raising warnings when checking if grid_offset is center
…scuss the grid offset a little bit
5b12a8f
to
1a2a126
Compare
Hi @eteq I've made the changes you suggested -- added changelog (again, let me know if there's anything I missed or if something's in the wrong place), added the Let me know your thoughts on a more thorough test! (cc @larrybradley also to keep in the loop) |
Travis CI seems to have fallen over |
…mpling with zero grid offset, now that grid_offset's default was changed
This was added back in version 1.0.0 (#1076) without needing an extra parameter. Forgot to close this one. |
This PR extends
EPSFBuilder
andEPSFModel
to accept more than the currently assumed even oversampling with grid points representing the left/right hand edges and center of each given pixel (and other linearly spaced grid points, for oversampling > 2), allowing for odd oversampling factors (including 1), and an arbitrary grid offset, displacing the first grid point from the left hand edge of a pixel, towards the right of a given pixel.This adds the argument
grid_offset
representing this right hand shift of all grid points (representing the evaluation of a PRF with star offset from its central pixel by some dx, dy position), allowing for more flexible ePSF creation. Previously, the assumption was that even oversampling and zero offset meant that grid points [0, 1, 2, 3, [4]] mapped to [0, 1/4, 1/2, 3/4, [1]] detector pixel offsets (where [1] is the 0 of the next-but-one pixel) -- now grid point indices can map [0, 1, 2] todx
s of [0.1, 1/3+0.1, 2/3+0.1] foroversampling=3
andgrid_offset=0.1
.This primarily is necessary to allow for
oversampling=1
, as otherwise each single grid point per detector pixel would have been assumed to sit in a corner of a pixel, whereas most use cases would want the grid point to represent the center of a pixel. Thus, the default inputs are 0.5 offset foroversampling=1
, or no offset otherwise.centroid_epsf
was extended to accept thegrid_offset
argument too, as it is now necessary to check whether this algorithm can be used with the combination ofoversampling
andgrid_offset
-- this is because the algorithm, tuned to the previous defaults ofoversampling=4
andgrid_offset=0
from Anderson & King (2000), requires a grid point representing the center of the pixel, such that N grid points either side of this central point are equally spaced, symmetrically, either side of the middle. This symmetry evaluation is howcentroid_epsf
centers itsdata
input, so this is fundamental. Thuscentroid_epsf
can only be used for even oversampling with zero offset, OR odd oversampling with an offset of half a grid spacing (i.e.,grid_offset=0.5/oversampling
). Offline discussions with @eteq resulted in the decision to keep backwards compatibility as much as possible, socentroid_epsf
has been left as the default input, but I've been back and forth on that so if anyone has strong opinions the other way let me know. If all defaults are input I believecentroid_epsf
should be fine (oversampling=4
andgrid_offset=0
would be set by default), which makes it slightly less precarious...Two outstanding issues I haven't dealt with (or am unsure of whether I need to deal with) are:
0.8
not being bug fixes?) but also because I'm not sure what of all of this needs to go in the changelog:grid_offset
added to the three functions is API change, and I'd guess the extension of odd oversampling + arbitrary grid offsets is "New Features", but let me know what else needs to be added to the changelog and I'll add a quick commit!cc @eteq @larrybradley for review