--- a/glue/core/subset.py
+++ b/glue/core/subset.py
@@ -1283,7 +1282,16 @@ class MaskSubsetState(SubsetState):
# locate each element of data in the coordinate system of the mask
vals = [data[c, view].astype(int) for c in self.cids]
- result = self.mask[tuple(vals)]
+
+ try:
+ result = self.mask[tuple(vals)]
+ except Exception:
+ ooops = tuple(vals)
+ print(self.mask.shape)
+ print(data.label)
+ print(f"{ooops[0].max()}")
+ print(f"{ooops[1].max()}")
+ raise
I see this (reference data shape is (4718, 4735)):
I tried to weed out the offending vals but it is surprisingly hard to reformat stuff to a way that glue likes because it started to complain about dimension mismatch somewhere else when I did it.
I think int casting of pixel values cause the coordination transformation to drift and fail round-tripping, but I am unable to get this exact error using simple code snippets. There is small rounding error trying to roundtrip just using GWCS without glue but they are negligible, so the significant drift must be happening in glue somewhere.
This is a follow-up of:
The offending example was removed in this PR but you can still reproduce it by using the removed example:
Minimally reproducible code using Jdaviz in a notebook; break this into different cells:
When I peek into the values here:
https://github.com/glue-viz/glue/blob/5f38baf8d22aef572b3269149208089199c4512d/glue/core/subset.py#L1286
I see this (reference data shape is
(4718, 4735)
):I tried to weed out the offending
vals
but it is surprisingly hard to reformat stuff to a way that glue likes because it started to complain about dimension mismatch somewhere else when I did it.I think int casting of pixel values cause the coordination transformation to drift and fail round-tripping, but I am unable to get this exact error using simple code snippets. There is small rounding error trying to roundtrip just using GWCS without glue but they are negligible, so the significant drift must be happening in glue somewhere.
🐱