diff --git a/CHANGES.rst b/CHANGES.rst index 23fe33569d..8de4035469 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -32,6 +32,8 @@ Imviz - Added a table with catalog search results. [#2915] +- Added Gaia catalog to Catalog plugin. [#3090] + Mosviz ^^^^^^ diff --git a/jdaviz/configs/imviz/plugins/catalogs/catalogs.py b/jdaviz/configs/imviz/plugins/catalogs/catalogs.py index 49da2d998c..038bca9261 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_gaia_sources = 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,21 @@ 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, conf + + with conf.set_temp("ROW_LIMIT", self.max_gaia_sources): + 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') + # adding in coords + Id's into table + for row in sources: + row_info = {'Right Ascension (degrees)': row['ra'], + 'Declination (degrees)': row['dec'], + 'Source ID': row['SOURCE_ID']} + self.table.add_item(row_info) + 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..4f23c35247 100644 --- a/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue +++ b/jdaviz/configs/imviz/plugins/catalogs/catalogs.vue @@ -28,6 +28,24 @@ + + + See the for details on the query defaults. + + + + + + +