Calculate raster coords identically to other primitives #1046
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.
Fixes issue #1038, supersedes PR #1042.
Calculation of x, y coords for rasters was using a different code path to that used by other geometric primitives, leading to very small differences (~1e-15) that can cause problems when using
tf.stack
.This PR removes the
utils.compute_coords
function that was only used byCanvas.raster
and instead uses the same combination ofAxis.compute_scale_and_translation
andAxis.compute_index
as the other primitives, so that now the coordinates are identical.I have slightly refactored where this code is called in
Canvas.raster
as the x and y coords are now independent, and replaced use ofnp.isclose(...).all()
withnp.allclose(...)
which is simpler.