Skip to content

Commit

Permalink
resolve test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
gibsongreen committed Dec 13, 2024
1 parent 0f54902 commit 6f98781
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions jdaviz/configs/imviz/plugins/catalogs/catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def search(self, error_on_fail=False):

# NOTE: If performance becomes a problem, see
# https://docs.astropy.org/en/stable/table/index.html#performance-tips
if self.catalog_selected in ["SDSS", "Gaia", "From File..."]:
if self.catalog_selected in ["SDSS", "Gaia"]:
# for single source convert table information to lists for zipping
if len(self.app._catalog_source_table) == 1 or self.max_sources == 1:
x_coordinates = [x_coordinates]
Expand All @@ -256,8 +256,6 @@ def search(self, error_on_fail=False):
row_id = row["objid"]
elif self.catalog_selected == "Gaia":
row_id = row["SOURCE_ID"]
elif self.catalog_selected == "From File...":
row_id = len(self.table)
# Check if the row contains the required keys
row_info = {'Right Ascension (degrees)': row['ra'],
'Declination (degrees)': row['dec'],
Expand All @@ -266,6 +264,22 @@ def search(self, error_on_fail=False):
'x_coord': x_coord.item() if x_coord.size == 1 else x_coord,
'y_coord': y_coord.item() if y_coord.size == 1 else y_coord}
self.table.add_item(row_info)
elif self.catalog_selected in ["From File..."]:
# for single source convert table information to lists for zipping
if len(self.app._catalog_source_table) == 1 or self.max_sources == 1:
x_coordinates = [x_coordinates]
y_coordinates = [y_coordinates]

for row, x_coord, y_coord in zip(self.app._catalog_source_table,
x_coordinates, y_coordinates):
# Check if the row contains the required keys
row_info = {'Right Ascension (degrees)': row['sky_centroid'].ra.deg,
'Declination (degrees)': row['sky_centroid'].dec.deg,
'Object ID': str(row.get('label', 'N/A')),
'id': len(self.table),
'x_coord': x_coord.item() if x_coord.size == 1 else x_coord,
'y_coord': y_coord.item() if y_coord.size == 1 else y_coord}
self.table.add_item(row_info)

filtered_skycoord_table = viewer.state.reference_data.coords.pixel_to_world(x_coordinates,
y_coordinates)
Expand Down

0 comments on commit 6f98781

Please sign in to comment.