Skip to content

Commit

Permalink
correctly create empty visits df when there are no visits
Browse files Browse the repository at this point in the history
  • Loading branch information
ehneilsen committed Sep 13, 2024
1 parent b7e152d commit 4b8e62b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion schedview/collect/opsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ def read_opsim(
visits = pd.DataFrame(maf.get_sim_data(sim_connection, constraint, dbcols, **kwargs))
except UserWarning:
warn("No visits match constraints.")
visits = pd.DataFrame(rubin_scheduler.scheduler.utils.empty_observation()).drop(index=0)
visits = (
SchemaConverter()
.obs2opsim(rubin_scheduler.scheduler.utils.empty_observation())
.drop(index=0)
)
if "observationId" not in visits.columns and "ID" in visits.columns:
visits.rename(columns={"ID": "observationId"}, inplace=True)
except NameError as e:
Expand Down

0 comments on commit 4b8e62b

Please sign in to comment.