Skip to content

Commit

Permalink
ID as string always
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Jul 23, 2024
1 parent 142dba9 commit 1fd35ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 6 additions & 1 deletion docs/imviz/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,12 @@ catalog dropdown menu.
and works best when you only have a single image loaded in a viewer.

To load a catalog from a supported `JWST ECSV catalog file <https://jwst-pipeline.readthedocs.io/en/latest/jwst/source_catalog/main.html#output-products>`_, choose "From File...".
The file must be able to be parsed by `astropy.table.Table.read` and contain a column labeled 'sky_centroid'.
The file must be able to be parsed by `astropy.table.Table.read` and contains the following columns:

* ``'sky_centroid'``: Column with `~astropy.coordinates.SkyCoord` sky coordinates of the sources.
* ``'label'``: Column with string identifiers of the sources. If you have numerical identifiers,
you have to recast them as string first.

Clicking :guilabel:`SEARCH` will show markers for any entry within the filtered zoom window.

If you have multiple viewers open, you will see another dropdown menu to select the active
Expand Down
6 changes: 2 additions & 4 deletions jdaviz/configs/imviz/plugins/catalogs/catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def search(self, error_on_fail=False):
for row in self.app._catalog_source_table:
row_info = {'Right Ascension (degrees)': row['ra'],
'Declination (degrees)': row['dec'],
'Object ID': row['objid']}
'Object ID': row['objid'].astype(str)}
self.table.add_item(row_info)

elif self.catalog_selected == 'From File...':
Expand All @@ -175,11 +175,9 @@ def search(self, error_on_fail=False):
skycoord_table = table['sky_centroid']

for row in self.app._catalog_source_table:
# find new to add in a way to append the source id to the table
# 'Object ID': row['label']} ; 'label' is failing tests
row_info = {'Right Ascension (degrees)': row['sky_centroid'].ra.deg,
'Declination (degrees)': row['sky_centroid'].dec.deg,
'Object ID': row.get('label', -1)}
'Object ID': row.get('label', 'N/A')}
self.table.add_item(row_info)

else:
Expand Down
4 changes: 2 additions & 2 deletions jdaviz/configs/imviz/tests/test_catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def test_plugin_image_with_result(self, imviz_helper, tmp_path):

# test loading from file
table = imviz_helper.app._catalog_source_table
skycoord_table = SkyCoord(table['ra'], table['dec'], unit='deg')
qtable = QTable({'sky_centroid': skycoord_table, 'label': table['objid']})
qtable = QTable({'sky_centroid': SkyCoord(table['ra'], table['dec'], unit='deg'),
'label': table['objid'].astype(str)})
tmp_file = tmp_path / 'test.ecsv'
qtable.write(tmp_file, overwrite=True)

Expand Down

0 comments on commit 1fd35ed

Please # to comment.