Skip to content

Add ingest_spectra function #168

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

Merged
merged 25 commits into from
Jun 18, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Run linter
run: |
ruff check . --ignore=C901 --exit-zero
ruff check . --statistics
ruff check . --statistics --exit-zero

- name: Test with pytest
run: |
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,5 @@ cython_debug/
.DS_Store

# AstroDB Toolkit Specific
tests/astrodb-template-db
astrodb_utils/tests/astrodb-template-db
astrodb-template-db/
astrodb_utils/version.py
11 changes: 6 additions & 5 deletions astrodb_utils/publications.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,16 +483,17 @@ def get_db_publication(db, reference: str, raise_error: bool = True):

if len(pubs_table) == 0:
msg = (
f"Reference {reference} not found in database. "
"Please add it to the Publications table."
f"Reference not found in database: {reference} "
"Add it to the Publications table."
)
elif len(pubs_table) > 1:
msg = (
f"Multiple entries for reference {reference} found in database. "
"Please check the Publications table. \n "
"Check the Publications table. \n "
f"Matches: \n {pubs_table}"
)
else:
msg = f"Unexpected condition while searching for reference {reference} in database."
msg = f"Unexpected condition while searching for reference: {reference}"

exit_function(msg, raise_error=raise_error, return_value=None)
result = exit_function(msg, raise_error=raise_error, return_value=None)
return result
8 changes: 8 additions & 0 deletions astrodb_utils/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from astrodb_utils import AstroDBError, exit_function
from astrodb_utils.publications import find_publication
from astrodb_utils.utils import internet_connection

__all__ = [
"find_source_in_db",
Expand Down Expand Up @@ -89,6 +90,13 @@ def find_source_in_db(
resolve_simbad=use_simbad,
)

# If no internet, then do not use Simbad
if use_simbad and not internet_connection():
logger.warning(
f"{source}: No internet connection, not using Simbad to resolve source name."
)
use_simbad = False

# If still no matches, try to resolve the name with Simbad
if len(db_name_matches) == 0 and use_simbad:
logger.debug(
Expand Down
Loading