Skip to content

Commit

Permalink
fix merge conflict resolution mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
ehneilsen committed Sep 13, 2024
1 parent 537f91f commit 56e89b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion schedview/collect/opsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
except ModuleNotFoundError:
pass


def _all_visits_columns():
"""Return all visits columns understood by the current rubin_scheduler."""
schema_converter = SchemaConverter()
current_cols = set(schema_converter.convert_dict.keys())
backwards_cols = set(schema_converter.backwards.keys())
return current_cols.union(backwards_cols)


def _normalize_opsim_columns(opsim_rp: ResourcePath, dbcols: list[str]):
# At least one opsim column has been renamed since the start of
# simulations. The mapping between new and old names can be found in
Expand Down Expand Up @@ -123,10 +125,14 @@ def read_opsim(
with sqlite3.connect(local_obs_path.ospath) as sim_connection:
if dbcols is None:
col_query = "SELECT name FROM PRAGMA_TABLE_INFO('observations')"
dbcols = [
raw_dbcols = [
c for c in pd.read_sql(col_query, sim_connection).name if c in _all_visits_columns()
]

# Update any outdated column names
backwards = SchemaConverter().backwards
dbcols = [(backwards[c] if c in backwards else c) for c in raw_dbcols]

norm_columns, used_column_map = _normalize_opsim_columns(obs_path, dbcols)

try:
Expand Down

0 comments on commit 56e89b4

Please sign in to comment.