Repository navigation
Add readable processing argument names - #814
Conversation
tompollard
left a comment
There was a problem hiding this comment.
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_peaksandshift_peaksnow takesignalbut stillpeak_inds.peak_indiceswould matchqrs_indices.calc_rr(qrs_locs=...)is the same kind of argument that #672 covers with "qrs_inds→qrs_indicesforcompute_hrand others".gqrs_detect(signal=..., d_sig=...):digital_signalwould pair withsignal.compute_hr(sig_len=..., qrs_indices=...)andbxb(sig_len=...)keepsig_len. Records now usen_framesfor that, son_frameswould suitbxb. Forcompute_hr, which sizes a 1D heart-rate array,n_samplesmight 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.
|
Thanks, I agree the touched functions should use consistent names. In eb64e0b I added I used |
Summary
Continue #672 with readable processing names. Nine public processing call points that take
signow also acceptsignal:normalize_bound,smooth,find_peaks,find_local_peaks,correct_peaks,shift_peaks,XQRS,xqrs_detect, andgqrs_detect.compute_hracceptsqrs_indicesalongsideqrs_inds, andXQRS.qrs_indicesexposes 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_indicesforcorrect_peaksandshift_peaks,digital_signalforgqrs_detect,n_samplesfor the one-dimensionalcompute_hrresult, andn_framesforbxb's record timeline.calc_rracceptsqrs_locations, since its input can be in samples or seconds.XQRS.signalaliases itssigarray. Positional-plus-new-keyword conflicts now name both spellings in the error.Verification
XQRS.qrs_indices.