From 4d45bf5878da665740392d5769ac81bb332db31a Mon Sep 17 00:00:00 2001 From: Jesse Averbukh Date: Tue, 16 Jul 2024 13:26:48 -0400 Subject: [PATCH] Add Gaia catalog to plugin Address review comments Add max rows option for Gaia --- jdaviz/configs/imviz/plugins/catalogs/catalogs.py | 14 +++++++++++++- jdaviz/configs/imviz/plugins/catalogs/catalogs.vue | 12 ++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/jdaviz/configs/imviz/plugins/catalogs/catalogs.py b/jdaviz/configs/imviz/plugins/catalogs/catalogs.py index 49da2d998c..46ef13c44f 100644 --- a/jdaviz/configs/imviz/plugins/catalogs/catalogs.py +++ b/jdaviz/configs/imviz/plugins/catalogs/catalogs.py @@ -10,6 +10,7 @@ from jdaviz.core.template_mixin import (PluginTemplateMixin, ViewerSelectMixin, FileImportSelectPluginComponent, HasFileImportSelect, with_spinner) +from jdaviz.core.custom_traitlets import IntHandleEmpty from jdaviz.core.template_mixin import TableMixin from jdaviz.core.user_api import PluginUserApi @@ -34,6 +35,7 @@ class Catalogs(PluginTemplateMixin, ViewerSelectMixin, HasFileImportSelect, Tabl catalog_selected = Unicode("").tag(sync=True) results_available = Bool(False).tag(sync=True) number_of_results = Int(0).tag(sync=True) + max_rows = IntHandleEmpty(1000).tag(sync=True) # setting the default table headers and values _default_table_values = { @@ -50,7 +52,8 @@ def __init__(self, *args, **kwargs): self.catalog = FileImportSelectPluginComponent(self, items='catalog_items', selected='catalog_selected', - manual_options=['SDSS', 'From File...']) + manual_options=['SDSS', 'Gaia', + 'From File...']) # set the custom file parser for importing catalogs self.catalog._file_parser = self._file_parser @@ -167,6 +170,15 @@ def search(self, error_on_fail=False): 'Object ID': row['objid']} self.table.add_item(row_info) + elif self.catalog_selected == 'Gaia': + from astroquery.gaia import Gaia + + Gaia.ROW_LIMIT = self.max_rows + sources = Gaia.query_object(skycoord_center, radius=zoom_radius, + columns=('source_id', 'ra', 'dec')) + self.app._catalog_source_table = sources + skycoord_table = SkyCoord(sources['ra'], sources['dec'], unit='deg') + elif self.catalog_selected == 'From File...': # all exceptions when going through the UI should have prevented setting this path # but this exceptions might be raised here if setting from_file from the UI diff --git a/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue b/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue index 6f62e0dbfb..f21f74035e 100644 --- a/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue +++ b/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue @@ -28,6 +28,18 @@ + + + +