Skip to content

Commit

Permalink
Adjust affine matrix to avoid three correlated axes in final plot
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Jan 7, 2025
1 parent 488b1b3 commit 3afdd50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions glue/core/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ def __setgluestate__(cls, rec, context):
units=rec['units'],
labels=rec['labels'])

@property
def axis_correlation_matrix(self):
return self._matrix[:-1, :-1] != 0


# Kept for backward-compatibility
WCSCoordinates = WCS
Expand Down
2 changes: 1 addition & 1 deletion glue/viewers/image/tests/test_python_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def setup_method(self, method):
with NumpyRNGContext(12345):
self.data = Data(cube=np.random.random((30, 50, 20)))
# Create data versions with WCS and affine coordinates
matrix = np.array([[2, 3, 0, -1], [1, 2, 0, 2], [0, 0, 1, -2], [0, 0, 0, 1]])
matrix = np.array([[2, 0, 0, -1], [0, 2, 1, 2], [0, 3, 1, -2], [0, 0, 0, 1]])
affine = AffineCoordinates(matrix, units=['Mm', 'Mm', 'km'], labels=['xw', 'yw', 'zw'])

self.data_wcs = Data(label='cube', cube=self.data['cube'], coords=WCS(naxis=3))
Expand Down

0 comments on commit 3afdd50

Please sign in to comment.