Convert get_crop_item_from_points to work self-consistently in pixel space until min/max array indices calculated#1
Merged
Conversation
…ray index space. This is preferred so that it can be determined whether the maximum input world coordinate corresponds to a pixel edge. In this case, the rightward pixel can be excluded from the cropped cube.
This commit raises a warning for each axis when the input points all correspond to the same pixel edge. This allows more explicit information in the warning and less code.
…array axis correspond to pixel edge. Previously it was raised if all coords for the array axis were in the same pixel.
85a4210 to
c537398
Compare
…revious implementation. Previous implementation was correct and is simpler. Also, raise warning of whether all world values land on a single pixel edge once, but build message on an axis by axis basis.
c537398 to
b632092
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 PR alters ndcube#874 to work explicitly work from world space to pixel space until the min and max array indices are calculated.
This was inspired because at the time of writing this PR, ndcube#874 used pixel coordinates arranged in array order. This was a consequence of how the function was originally written, but made the new variable names confusing. Explicitly working in pixel space first and then switching to array space allows some of the code in
get_crop_item_from_pointsfunction to be simplified.Additionally, this PR moves the warning so that a separate one is raised for each array axis for which all world values correspond to a single pixel edge. This allows more explicit information in the warning. Since the likelihood of all world coords corresponding to the same exact pixel edge is very small, the likelihood of this resulting in 1, let alone multiple, warnings for a single crop operation very low.