Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise exception when simbad name query returns more names than there are objects queried #490

Merged
merged 3 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased](https://github.com/askap-vast/vast-tools/compare/v2.0.0...HEAD)

#### Added

- Raise exception when simbad name query returns more names than there are objects queried [#490](https://github.com/askap-vast/vast-tools/pull/490)
- Added open_fits function to correctly handle compressed image HDUs [#480](https://github.com/askap-vast/vast-tools/pull/480)
- Added epoch 41 [#470](https://github.com/askap-vast/vast-tools/pull/470)
- Added warning when querying corrected data [#465](https://github.com/askap-vast/vast-tools/pull/465)
Expand Down Expand Up @@ -107,6 +109,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

#### List of PRs

- [#490](https://github.com/askap-vast/vast-tools/pull/490): feat: Raise exception when simbad name query returns more names than there are objects queried
- [#478](https://github.com/askap-vast/vast-tools/pull/478): fix: Account for pipeline runs with no measurement pairs file
- [#483](https://github.com/askap-vast/vast-tools/pull/483): fix: Ensure that full image data does not persist when creating FITS cutouts from compressed HDUs
- [#480](https://github.com/askap-vast/vast-tools/pull/480): feat: Added open_fits function to handle compressed image HDUs
Expand Down
9 changes: 9 additions & 0 deletions vasttools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ def simbad_search(

Returns:
Coordinates and source names. Each will be NoneType if search fails.

Raises:
Exception: Simbad table length exceeds number of objects queried.
"""
if logger is None:
logger = logging.getLogger()
Expand All @@ -406,6 +409,12 @@ def simbad_search(

simbad_names = np.array(result_table['TYPED_ID'])

if len(simbad_names) > len(objects):
raise Exception("Returned Simbad table is longer than the number "
"of queried objects. You likely have a malformed "
"object name in your query."
)

return c, simbad_names

# TODO: This needs better handling below.
Expand Down