From 97c0210e4735337a4a966b6b21e64863e21127c7 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 5 Aug 2021 22:03:07 +0100 Subject: [PATCH 1/3] Use affine approximation to WCS links for performance --- notebooks/ImvizExample.ipynb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/notebooks/ImvizExample.ipynb b/notebooks/ImvizExample.ipynb index a9a24b859b..39beb94bf6 100644 --- a/notebooks/ImvizExample.ipynb +++ b/notebooks/ImvizExample.ipynb @@ -114,19 +114,11 @@ "viewer = imviz.app.get_viewer('viewer-1')\n", "\n", "# Manually link the data. We can remove this when Imviz auto-linking issue is resolved.\n", - "# This is necessary for blink to function properly.\n", + "# This is necessary for blink to function properly. We add affine approximations to the\n", + "# links instead of the full WCS links.\n", "wcs_links = wcs_autolink(viewer.session.data_collection)\n", "for link in wcs_links:\n", - " exists = False\n", - " for existing_link in viewer.session.data_collection.external_links:\n", - " if isinstance(existing_link, WCSLink):\n", - " if (link.data1 is existing_link.data1\n", - " and link.data2 is existing_link.data2):\n", - " exists = True\n", - " break\n", - " # Add only those links that don't already exist\n", - " if not exists:\n", - " viewer.session.data_collection.add_link(link)\n", + " viewer.session.data_collection.add_link(link.as_affine_link())\n", "\n", "# Because linking happens after load, the image display is broken a little.\n", "# So, please do this manually **after** running this cell.\n", @@ -582,7 +574,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -596,7 +588,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.3" + "version": "3.9.5" } }, "nbformat": 4, From f40795014dbfad953758c08c1395ae3d33fb92af Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 5 Aug 2021 22:14:34 +0100 Subject: [PATCH 2/3] Update BqplotMatchWCS --- jdaviz/configs/imviz/plugins/tools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdaviz/configs/imviz/plugins/tools.py b/jdaviz/configs/imviz/plugins/tools.py index 55cf825487..5b925d91a0 100644 --- a/jdaviz/configs/imviz/plugins/tools.py +++ b/jdaviz/configs/imviz/plugins/tools.py @@ -6,7 +6,7 @@ from glue.config import viewer_tool from glue_jupyter.bqplot.common.tools import Tool from glue.viewers.common.tool import CheckableTool -from glue.plugins.wcs_autolinking.wcs_autolinking import wcs_autolink, WCSLink +from glue.plugins.wcs_autolinking.wcs_autolinking import wcs_autolink, WCSLink, AffineLink from glue_jupyter.bqplot.common.tools import BqplotPanZoomMode __all__ = [] @@ -54,13 +54,13 @@ def activate(self): for link in wcs_links: exists = False for existing_link in self.viewer.session.data_collection.external_links: - if isinstance(existing_link, WCSLink): + if isinstance(existing_link, (AffineLink, WCSLink)): if (link.data1 is existing_link.data1 and link.data2 is existing_link.data2): exists = True break if not exists: - self.viewer.session.data_collection.add_link(link) + self.viewer.session.data_collection.add_link(link.as_affine_link()) # Set the reference data in other viewers to be the same as the current viewer. # If adding the data to the viewer, make sure it is not actually shown since the From 5835780f7dcb29ac10f6a10b0f7b591dc9308ab8 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Tue, 10 Aug 2021 14:53:09 +0100 Subject: [PATCH 3/3] Remove unused import --- notebooks/ImvizExample.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/ImvizExample.ipynb b/notebooks/ImvizExample.ipynb index 39beb94bf6..664ab37b48 100644 --- a/notebooks/ImvizExample.ipynb +++ b/notebooks/ImvizExample.ipynb @@ -66,7 +66,7 @@ "from astropy.coordinates import SkyCoord, Angle\n", "from astropy.table import Table\n", "from astropy.utils.data import download_file\n", - "from glue.plugins.wcs_autolinking.wcs_autolinking import wcs_autolink, WCSLink\n", + "from glue.plugins.wcs_autolinking.wcs_autolinking import wcs_autolink\n", "from photutils import CircularAperture, SkyCircularAperture\n", "from regions import PixCoord, CirclePixelRegion, CircleSkyRegion\n", "\n",