Skip to content

Commit

Permalink
Do not concatenate empty dataframes (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored Jan 10, 2025
1 parent 2ded3e0 commit 6ee25af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion strax/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ def get_components(
if targets[0].startswith(TEMP_DATA_TYPE_PREFIX):
raise ValueError(
"When only combining subruns, you can only assign one target, "
f"but got{plugins[targets[0]].depends_on}!"
f"but got {plugins[targets[0]].depends_on}!"
)
raise ValueError(f"Plugin {targets} does not allowed superrun!")

Expand Down
6 changes: 4 additions & 2 deletions strax/run_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ def scan_runs(
docs = new_docs
else:
# Keep only new runs (not found by earlier frontends)
docs = pd.concat([docs, new_docs[~np.in1d(new_docs["name"], docs["name"])]], sort=False)
docs.reset_index(drop=True, inplace=True)
mask = ~np.in1d(new_docs["name"], docs["name"])
if np.any(mask):
docs = pd.concat([docs, new_docs[mask]], sort=False)
docs.reset_index(drop=True, inplace=True)

# Rearrange columns
if not self.context_config["use_per_run_defaults"] and strax.RUN_DEFAULTS_KEY in docs.columns:
Expand Down

0 comments on commit 6ee25af

Please sign in to comment.