Skip to content

Commit

Permalink
Hardcode optical_prov to too for all ToO targets
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 14, 2024
1 parent b7fb79e commit f79c0fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/too/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def load_too_targets(
bright_limit_checks=validate_magnitude_limits,
)

# We always want to set the optical_prov column to too.
targets = targets.with_columns(optical_prov=polars.lit("too"))

too_columns = ["too_id"]
too_columns += [col for col in too_dtypes if col not in too_metadata_columns]

Expand Down
6 changes: 6 additions & 0 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def test_load_too_targets(too_mock: polars.DataFrame, caplog: pytest.LogCaptureF

assert added.height == 10
assert catalogdb.ToO_Target.select().count() == 10
assert (
catalogdb.ToO_Metadata.select()
.where(catalogdb.ToO_Metadata.optical_prov == "too")
.count()
== 10
)

# Repeat. No new targets should be added.
added = load_too_targets(too_mock[0:10], catalogdb.database)
Expand Down

0 comments on commit f79c0fa

Please sign in to comment.