glue
glue copied to clipboard
Fix vector directions when overlaid on image
When a scatter layer is overlaid on an image, vectors will have the wrong orientation if one (or both) of the axes have different pixel and world coordinate orientations. To fix this issue, this PR looks at the signs of the relevant entry of the cdelt coordinate increments. If they're opposite, it negates the corresponding vector components. The relation between x/y attributes and the wcs coordinate indices is the same one used here.
I would be curious to know if @astrofrog or @catherinezucker (or anyone who's knowledgeable about WCS) has any additional thoughts/suggestions.
Codecov Report
Merging #2276 (577cd83) into main (2d64631) will decrease coverage by
0.02%
. The diff coverage is58.62%
.
:exclamation: Current head 577cd83 differs from pull request most recent head 9bbdf09. Consider uploading reports for the commit 9bbdf09 to get more accurate results
@@ Coverage Diff @@
## main #2276 +/- ##
==========================================
- Coverage 88.07% 88.04% -0.03%
==========================================
Files 247 247
Lines 23279 23302 +23
==========================================
+ Hits 20502 20517 +15
- Misses 2777 2785 +8
Impacted Files | Coverage Δ | |
---|---|---|
glue/viewers/scatter/layer_artist.py | 95.10% <11.11%> (-2.11%) |
:arrow_down: |
glue/conftest.py | 63.75% <78.94%> (+10.71%) |
:arrow_up: |
glue/core/state.py | 92.12% <100.00%> (ø) |
|
glue/_mpl_backend.py | 80.00% <0.00%> (-8.00%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 2d64631...9bbdf09. Read the comment docs.
This PR definitely fell off of my radar. @astrofrog I had used the get_cdelt()
method since the astropy docs say that it should work for CD or CROTA as well. I don't have a good set of examples of these on hand, but will certainly try this out if someone has any.
As far as defining the vectors, it looks like numerical components are what are allowed for the vector attributes of a scatter layer.