MIT-LCP / waveform-annotation

Platform for annotating physiological waveform data.
11 stars 4 forks source link

Multi-frequency input records #49

Open bemoody opened 2 years ago

bemoody commented 2 years ago

A minor issue is that it might be nice to read multi-frequency records at their original sampling rates.

(In the WFDB format, multi-frequency records are accommodated by storing multiple samples per "frame". For example, if the ECG is sampled at 250 Hz and ABP is 100 Hz, the frame frequency might be set to 50 Hz, and each frame would contain 5 samples of ECG and 2 samples of ABP.)

Currently, update_graph uses wfdb.rdsamp to read the signals, which downsamples all signals to the frame frequency: https://github.com/MIT-LCP/waveform-annotation/blob/98d89fd8535cdb052259a353ee216a67672fc00a/waveform-django/waveforms/dash_apps/finished_apps/waveform_vis.py#L1144

A better approach might be to use wfdb.rdrecord instead, with the argument smooth_frames=False. However, as of wfdb-python v3.4.1, this doesn't work consistently with single-frequency records (see https://github.com/MIT-LCP/wfdb-python/pull/313).

Lucas-Mc commented 2 years ago

Hi @bemoody , just wanted to circle back here to see if there's any updates that's happened with the WFDB-Python repo that would make reading all these files faster? I thought I saw you do something that made reading a specific case faster but not sure

EDIT: I do want to have a quick test using wfdb.rdrecord with smooth_frame=False on breadboard to see if it makes a difference or causes issues like you mentioned

bemoody commented 2 years ago

There definitely have been some updates; the issue I mentioned above has since been resolved and there have been some performance improvements (I don't know how much difference they will make in practice.)

Upgrading to wfdb-python 4.0.0 and porting from rdsamp to rdrecord would be a good idea either way.