Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subset on dithered data linked by WCS ignores the dither #52

Open
pllim opened this issue Oct 20, 2021 · 3 comments
Open

Subset on dithered data linked by WCS ignores the dither #52

pllim opened this issue Oct 20, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@pllim
Copy link
Contributor

pllim commented Oct 20, 2021

I saw this at Imviz (from jdaviz) but I think the bug is within the regions translator, but I am not familiar enough with this package to fix it.

>>> from astropy.utils.data import download_file
>>> from glue.core.subset import Subset
>>> from jdaviz import Imviz
>>> imviz = Imviz(verbosity='warning')  # Hide info messages
>>> acs_47tuc_1 = download_file('https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/jbqf03gjq_flc.fits', cache=True)
>>> acs_47tuc_2 = download_file('https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/jbqf03h1q_flc.fits', cache=True)
>>> imviz.load_data(acs_47tuc_1, data_label='acs_47tuc_1')
>>> imviz.load_data(acs_47tuc_2, data_label='acs_47tuc_2')
>>> imviz.link_data(link_type='wcs')
>>> my_cen = (1090, 1157)
>>> my_radius = 10
>>> imviz._apply_interactive_region(
...     'bqplot:circle', (my_cen[0] - my_radius, my_cen[1] - my_radius),
...                      (my_cen[0] + my_radius, my_cen[1] + my_radius))
>>> regions = {}
>>> for lyr in imviz.default_viewer.layers:
...     if isinstance(lyr.layer, Subset):
...         regions[f'{lyr.layer.label}[{lyr.layer.data.label}]'] = lyr.layer.data.get_selection_definition(subset_id=lyr.layer.label, format='astropy-regions')
>>> regions
{'Subset 1[acs_47tuc_1[SCI,1]]': <CirclePixelRegion(center=PixCoord(x=1090.0, y=1157.0), radius=10.0)>,
 'Subset 1[acs_47tuc_2[SCI,1]]': <CirclePixelRegion(center=PixCoord(x=1090.0, y=1157.0), radius=10.0)>}

I expected the center for subset region derived from acs_47tuc_1[SCI,1] to be a little different from acs_47tuc_2[SCI,1] but they are exactly the same. One of them is wrong.

On the Imviz display, I see the Subset properly displayed at the correct sky location when I blink them.

🐱

@pllim
Copy link
Contributor Author

pllim commented Feb 15, 2022

@astrofrog said to fix this properly, the fix should be here:

class AstropyRegionsHandler:

Maybe translating ROI of the Subset, if not w.r.t. reference data, to polygon ROI. He needs to think about it.

Currently, it always returns the Subset w.r.t. reference data even if you pass in a Subset w.r.t. non-reference data.

@pllim

This comment was marked as outdated.

@pllim
Copy link
Contributor Author

pllim commented Aug 23, 2022

I ended up just working around this for that one plugin. See spacetelescope/jdaviz#1524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant