Skip to content

Commit

Permalink
Create a method for aligning images
Browse files Browse the repository at this point in the history
Docs cleanup
  • Loading branch information
jaladh-singhal committed Dec 19, 2024
1 parent 1019f72 commit 8105733
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
7 changes: 2 additions & 5 deletions docs/usage/displaying-images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions firefly_client/fc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
27 changes: 25 additions & 2 deletions firefly_client/firefly_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 8105733

Please sign in to comment.