Closed dhomeier closed 2 years ago
OK, looks like the problem was using the wrong Data
for the mask, effectively creating an empty (or invalid?) subset (though maybe it should still include the legend in that case?).
Thanks for adding the helper method! That'll be fine for now, no need to make it a fixture.
Description
This fixes an issue I found when trying to use the
Save Python script
function on a viewer using a dataset with a standard (Astropy) WCS, such as the examplew5.fits
data. The script thus created failed with anon
ax.reset_wcs(slices=['x', 'y', 0], wcs=ref_data.coords.wcs)
asref_data.coords
itself is already the WCS.The fix, to test for that case first in the exporter, seems quite straightforward. I've parametrised some test to run on a dataset with WCS; could think about running this with all tests, or always adding a WCS in
self.data.coords
; howevertest_subset_legend
still fails with this patch, as the version with WCS somehow is not including the subset label:Basically in the latter case the script is missing these lines:
so this looks like another actual bug in the exporter (those lines were already missing before this change), as if in https://github.com/glue-viz/glue/blob/aabb5ebb1b5227f973a99f9aa905d6bfe6988b0b/glue/viewers/common/viewer.py#L447
the subset layer is not
visible and enabled
when a WCS ist present (indeedlayer.enabled = False
), but I could not yet figure out why.Actually comparing to the non-WCS plot it does not seem like the subset is really displayed in the WCS version: