Skip to content

Commit

Permalink
use the ingest function from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Exu-112 committed Jul 12, 2024
1 parent 66436be commit 9f38361
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions scripts/ingests/ultracool_sheet/Ingest_YJHK_MKO_Photometry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from astrodb_utils import load_astrodb, find_source_in_db, AstroDBError
from astrodb_utils import (
load_astrodb,
find_source_in_db,
AstroDBError,
)
from astrodb_utils.photometry import ingest_photometry
import sys

sys.path.append(".")
Expand Down Expand Up @@ -53,7 +58,7 @@
)


def ingest_Photometry(
def ingest_Photometry_Evan(
source: str = None,
band: str = None,
magnitude: float = None,
Expand Down Expand Up @@ -160,21 +165,22 @@ def ingest_Photometry(
comment = None
else:
comment = comment_filter + comment_reference
ingest_Photometry(
ingest_photometry(
db,
source=simple_source,
band=band_filter,
magnitude=measurement,
mag_error=error,
magnitude_error=error,
telescope=telescope,
# instrument=instrument,
comment=comment,
comments=comment,
reference=reference,
raise_error=True,
)
ingested += 1
except AstroDBError as e:
msg = "ingest failed with error: " + str(e)
if "Photometry with same reference already exists" in str(e):
if "The measurement may be a duplicate" in str(e):
already_exists += 1
else:
logger.warning(msg)
Expand All @@ -196,7 +202,7 @@ def ingest_Photometry(
logger.info(f"no data: {no_data}") # 5412
logger.info(
f"data points tracked:{ingested+already_exists+no_sources+multiple_sources}"
)
) # 10148
total = ingested + already_exists + no_sources + multiple_sources + no_data
logger.info(f"total: {total}") # 15560

Expand Down

0 comments on commit 9f38361

Please sign in to comment.