Skip to content

Add readable processing argument names - #814

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

tompollard merged 2 commits into
mainfrom
feature/processing-argument-names

Conversation

@tompollard

@tompollard tompollard commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Continue #672 with readable processing names. Nine public processing call points that take sig now also accept signal: normalize_bound, smooth, find_peaks, find_local_peaks, correct_peaks, shift_peaks, XQRS, xqrs_detect, and gqrs_detect. compute_hr accepts qrs_indices alongside qrs_inds, and XQRS.qrs_indices exposes the detected array through the new name.

The keyword alias helper preserves existing positional calls and keywords, rejects both spellings supplied together, and shows the new names in inspected signatures. The established names keep working without warnings. Update the processing docs and notebook example.

The review follow-up completes related names in the touched functions: peak_indices for correct_peaks and shift_peaks, digital_signal for gqrs_detect, n_samples for the one-dimensional compute_hr result, and n_frames for bxb's record timeline. calc_rr accepts qrs_locations, since its input can be in samples or seconds. XQRS.signal aliases its sig array. Positional-plus-new-keyword conflicts now name both spellings in the error.

Verification

  • Full offline suite: 1,503 passed, 4 skipped, 22 deselected.
  • Focused processing alias tests: 15 passed, including detector behavior and copy/pickle of XQRS.qrs_indices.
  • Updated notebook code cells 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. The keyword_alias helper works well: positional calls and sig= still work, both spellings are rejected together, inspect.signature and the docs show the new name, and wrapped functions still pickle by reference (which matters for benchmark_mitdb's worker pool). Both detectors give identical results with signal=, sig= and positional input, and XQRS.qrs_indices shares the array with qrs_inds. The offline suite, Ruff and the strict docs build pass locally.

My main suggestion is to finish the renames in the functions this touches, so none of them mix styles:

  • correct_peaks and shift_peaks now take signal but still peak_inds. peak_indices would match qrs_indices.
  • calc_rr(qrs_locs=...) is the same kind of argument that #672 covers with "qrs_inds → qrs_indices for compute_hr and others".
  • gqrs_detect(signal=..., d_sig=...): digital_signal would pair with signal.
  • compute_hr(sig_len=..., qrs_indices=...) and bxb(sig_len=...) keep sig_len. Records now use n_frames for that, so n_frames would suit bxb. For compute_hr, which sizes a 1D heart-rate array, n_samples might read better. Either way, it would be good to decide now rather than rename these arguments twice.

Optional: calling find_local_peaks(x, signal=x) raises got multiple values for argument 'sig', naming the old spelling, and XQRS has .qrs_indices but no .signal for its .sig attribute.

@tompollard

Copy link
Copy Markdown
Member Author

Thanks, I agree the touched functions should use consistent names. In eb64e0b I added peak_indices to correct_peaks and shift_peaks, digital_signal to gqrs_detect, n_samples to compute_hr, and n_frames to bxb. I also added XQRS.signal and made positional-plus-new-keyword conflicts name both spellings.

I used qrs_locations for calc_rr rather than qrs_indices: calc_rr accepts locations in seconds as well as samples, so “indices” would be inaccurate for one supported input. compute_hr always uses sample indices and keeps qrs_indices. All old keywords and positional calls still work without warnings. The full offline suite (1,503 passed), 15 focused tests, Ruff, and the strict docs build pass.

@tompollard
tompollard merged commit 2d1bdab into main Nov 30, 2026
19 checks passed
@tompollard
tompollard deleted the feature/processing-argument-names branch November 30, 2026 22:59
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