Skip to content

Add processing.Comparator with Comparitor alias - #813

Merged
tompollard merged 2 commits into
mainfrom
feature/processing-comparator
Nov 30, 2026
Merged

tompollard merged 2 commits into
mainfrom
feature/processing-comparator

Conversation

@tompollard

@tompollard tompollard commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Add processing.Comparator as the correctly spelled class name from #672. Keep processing.Comparitor as an alias to the same class, so existing imports and old pickle references still resolve. compare_annotations now returns the class under its new canonical name. Update the processing docs and examples.

Refresh demo.ipynb as a 17-cell offline walkthrough using the current reading and writing APIs. It covers headers, selected signals, annotations, expanded and multi-segment data, QRS comparison with Comparator, and safe writes in a temporary directory. Optional PhysioNet access is shown separately. Remove the old saved outputs, repeated imports, and examples that wrote into the checkout. Update the README link and comparison test variable names.

Verification

  • Full offline suite: 1,488 passed, 4 skipped, 22 deselected.
  • Focused comparator and integer-precision tests: 21 passed.
  • After the notebook update, nine relevant comparison tests passed and every
    offline notebook code cell executed successfully.
  • Ruff format and lint passed.
  • Strict Sphinx HTML build passed.

@tompollard tompollard left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks. Comparator and Comparitor are the same class, compare_annotations returns Comparator, objects built through the old name pass isinstance for both, subclasses of the old name still work, and old pickles referencing wfdb.processing.evaluate.Comparitor load (good to have that tested). The offline suite, Ruff and the strict docs build pass locally.

Optional: the old spelling is still used as a local variable name in demo.ipynb (comparitor = processing.compare_annotations(...), then .print_summary() and .plot()), which users see, and in the existing comparison tests in tests/test_processing.py. Renaming those to comparator would finish the job, but it doesn't affect behaviour.

Ready to merge once CI is green.

@tompollard

Copy link
Copy Markdown
Member Author

Thanks, I updated the comparison test variables and the notebook example to use comparator. I also refreshed the notebook as an offline walkthrough: it now uses the current read and write APIs, covers expanded and multi-segment data, runs the QRS comparison with Comparator, and writes copies only in a temporary directory. PhysioNet access is an optional example. The old saved outputs and repeated imports are gone; the notebook is now about 8 KB instead of 3.5 MB. I executed every offline code cell, and the nine relevant comparison tests and Ruff pass. This is in bd319ea.

@tompollard
tompollard merged commit ef5e889 into main Nov 30, 2026
19 checks passed
@tompollard
tompollard deleted the feature/processing-comparator branch November 30, 2026 22:29
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.

1 participant