Skip to content

Commit

Permalink
Fixed regime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lesliech1004 committed Jan 22, 2025
1 parent 4451cd1 commit 56e58f6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
34 changes: 27 additions & 7 deletions scripts/ingests/bones_archive/ingest_BONES_photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
photometry_ingested = 0
skipped = 0
total =0
duplicate_measurement = 0
multiple_sources = 0
no_sources = 0

# Logger setup
# This will stream all logger messages to the standard output and
Expand Down Expand Up @@ -62,7 +65,9 @@
for source in bones_sheet_table:
bones_name = source["NAME"]
match = None

if isnan(source["GAIA_G"]):
skipped+=1
continue
##tries to find match of name in database
##if found, ingest
if len(bones_name) > 0 and bones_name != "null":
Expand All @@ -71,6 +76,8 @@
source["NAME"],
ra=source["RA"],
dec=source["DEC"],
ra_col_name="ra",
dec_col_name="dec",
)
if len(match) == 1:
try:
Expand All @@ -87,6 +94,8 @@
source("NAME"),
ra=source["RA"],
dec=source["DEC"],
ra_col_name="ra",
dec_col_name="dec",
)
if len(match) == 1:
simple_source = match[0]
Expand All @@ -100,8 +109,8 @@
db,
source = simple_source,
band = band_filter,
magnitude = measurement,
magnitude_error = error,
magnitude = float(measurement),
magnitude_error = float(error),
telescope = telescope,
reference = reference,
raise_error = True,
Expand All @@ -112,11 +121,22 @@
msg = "ingest failed with error: " + str(e)
logger.warning(msg)
skipped +=1
raise AstroDBError(msg) from e
if "The measurement may be a duplicate." in str(e) :
duplicate_measurement+=1
else:
raise AstroDBError(msg) from e
elif len(match) == 0:
skipped+=1
no_sources+=1
else:
skipped+=1
multiple_sources+=1

total = len(bones_sheet_table)
logger.info(f"skipped:{skipped}")
logger.info(f"photometry_ingested:{photometry_ingested}")
logger.info(f"total:{total}")
logger.info(f"skipped:{skipped}") #192 skipped
logger.info(f"photometry_ingested:{photometry_ingested}") #17 ingested
logger.info(f"no sources:{no_sources}") #69 no sources
logger.info(f"multiple_sources:{multiple_sources}") #0 multiple sources
logger.info(f"total:{total}") #209 total
if DB_SAVE:
db.save_database(directory="data/")
1 change: 1 addition & 0 deletions simple/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class Photometry(Base):
telescope = Column(String(30), ForeignKey('Telescopes.telescope'))
epoch = Column(Float) # decimal year
comments = Column(String(1000))
regime = Column(String(30), ForeignKey("Regimes.regime"))
reference = Column(
String(30),
ForeignKey("Publications.reference", onupdate="cascade"),
Expand Down

0 comments on commit 56e58f6

Please sign in to comment.