Skip to content

Add filter labelling - #117

Open
alexhroom wants to merge 2 commits into
99-batch-conveniencefrom
111-filter-labels
Open

alexhroom wants to merge 2 commits into
99-batch-conveniencefrom
111-filter-labels

Conversation

@alexhroom

Copy link
Copy Markdown
Collaborator

This PR adds BatchData.set_label() which allows you to set a label for a filter set and index the filter set using its label. Fixes #111.

@alexhroom
alexhroom added this pull request to stack #102 September 14, 2026 12:34
@alexhroom
alexhroom requested a lite review from Copilot September 14, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The missing-label error behavior conflicts with its documentation, and related documentation corrections remain needed.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds BatchData.set_label() and label-based filter-set indexing.

Changes:

  • Adds label assignment, lookup, validation, and lifecycle handling.
  • Supports labels in filter-set operations.
  • Documents label usage and combination behavior.
File summaries
File Summary Review findings
src/batch/interface.rs Implements filter-set labels and label resolution. Update get_histogram and get_n_events docstrings to support int | str; fix the missing-label error type or remove the KeyError claim.
docs/source/tutorials/batch_processing.ipynb Documents labeling and batch operations. Clarify that + retains histogram settings while * creates fresh histograms.
Review details

Suppressed comments (2)

docs/source/tutorials/batch_processing.ipynb:401

  • + does not reset histogram settings: add() clones the left operand's results, retaining its time range and bin count, whereas * constructs fresh histograms. This statement therefore misdocuments the behavior; distinguish the label loss from the different histogram-setting behavior of + and *.
    "Note that as `+` and `*` create new filter sets from old ones, any existing histogram settings or labels are lost when using those operations."

src/batch/interface.rs:709

  • Error::msg(...) creates an anyhow message, not a PyErr, so PyO3's anyhow conversion cannot downcast it to KeyError; a missing label will be exposed as a RuntimeError, contrary to this comment. Either propagate an actual PyKeyError through the error path or remove the claim about the exception type.
            // PyO3 downcasts back out of anyhow, so this raises a real KeyError
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/batch/interface.rs
self.check_index(*i)?;
Ok(vec![*i])
}
FilterIndex::Label(label) => Ok(vec![self.label_to_index(label)?]),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Label filter sets

2 participants