From 81057337ea9650259de64c974bc885f24f0984f2 Mon Sep 17 00:00:00 2001 From: Jaladh Singhal Date: Wed, 18 Dec 2024 17:37:10 -0800 Subject: [PATCH] Create a method for aligning images Docs cleanup --- docs/usage/displaying-images.rst | 7 ++----- firefly_client/fc_utils.py | 1 + firefly_client/firefly_client.py | 27 +++++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/docs/usage/displaying-images.rst b/docs/usage/displaying-images.rst index 8f5e47b..128033d 100644 --- a/docs/usage/displaying-images.rst +++ b/docs/usage/displaying-images.rst @@ -103,14 +103,11 @@ Turning On WCS Locking ---------------------- When multiple images covering the same sky location are displayed, you can -align and lock by sky coordinates. A dedicated method is not available, but -the following action can be dispatched to lock and align by world coordinates: +align and lock by sky coordinates. To lock and align by world coordinates: .. code-block:: py - fc.dispatch('ImagePlotCntlr.wcsMatch', - payload=dict(matchType='Standard', - lockMatch=True)) + fc.align_images(lock_match=True) Retrieving Images Using IRSA-Specific Searches ---------------------------------------------- diff --git a/firefly_client/fc_utils.py b/firefly_client/fc_utils.py index 36f0a69..11336a2 100644 --- a/firefly_client/fc_utils.py +++ b/firefly_client/fc_utils.py @@ -76,6 +76,7 @@ def ensure3(val, name): 'ShowPlot': 'charts.data/chartAdd', 'ZoomImage': 'ImagePlotCntlr.ZoomImage', 'PanImage': 'ImagePlotCntlr.recenter', + 'AlignImages': 'ImagePlotCntlr.wcsMatch', 'StretchImage': 'ImagePlotCntlr.StretchChange', 'ColorImage': 'ImagePlotCntlr.ColorChange', 'CreateRegionLayer': 'DrawLayerCntlr.RegionPlot.createLayer', diff --git a/firefly_client/firefly_client.py b/firefly_client/firefly_client.py index 1c6d228..3658723 100644 --- a/firefly_client/firefly_client.py +++ b/firefly_client/firefly_client.py @@ -1458,6 +1458,29 @@ def set_pan(self, plot_id, x=None, y=None, coord='image'): payload.update({'centerPt': f'{x};{y};{coord}'}) return self.dispatch(ACTION_DICT['PanImage'], payload) + + def align_images(self, match_type='Standard', lock_match=False): + """ + Align the images being displayed. + + Parameters + ---------- + match_type : {'Standard', 'Target', 'Pixel', 'PixelCenter'}, optional + Match type to use to align the images: align by WCS ('Standard'), + by target ('Target'), by pixel prigins ('Pixel'), and by pixel at + image centers ('PixelCenter'). + lock_match : bool, optional + Whether to lock the alignment. Panning/zooming in one image will + preserve the alignment in other images. Default is False. + + Returns + ------- + out : `dict` + Status of the request, like {'success': True}. + + """ + payload = dict(matchType=match_type, lockMatch=lock_match) + return self.dispatch(ACTION_DICT['AlignImages'], payload) def set_stretch(self, plot_id, stype=None, algorithm=None, band=None, **additional_params): """ @@ -1926,7 +1949,7 @@ def apply_table_filters(self, tbl_id, filters): Parameters ---------- - plot_id : `str` + tbl_id : `str` ID of the table where you want to apply filters filters : `str` SQL WHERE clause-like string specifying filters. Column names must be quoted. @@ -1947,7 +1970,7 @@ def sort_table_column(self, tbl_id, column_name, sort_direction=''): Parameters ---------- - plot_id : `str` + tbl_id : `str` ID of the table where you want to apply sort column_name : `str` Name of the table column to sort