Add despike_jacobian option for adaptive resampling #366
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds an option to smooth over numerical quirkiness when, for example, the longitude wraps around in an all-sky map. The quirk occurs when computing the Jacobian, which is d(input-image pixel) / d(output-image pixel). This is done by finite differences, so when the input coordinates jump from one side of the map to the other, the Jacobian comes out extremely large, despite the actual transformation being unremarkable at that location. The new option looks for outlier Jacobian values, measured relative to a 3x3 local neighborhood, and replaces those outliers with a mean of the non-outlier values in the neighborhood.
Before this PR, the extremely-large Jacobian would cause the input-image region that is to be sampled to be extremely large---larger than a safety-valve threshold in the code that just outputs a
nan
for that output pixel. This caused a band ofnans
near the wrap-point's location in the output image. With this change, that seam is handled correctly.Looks like this might close #195.