wfdb-python icon indicating copy to clipboard operation
wfdb-python copied to clipboard

Original WFDB C package notes and nuances

Open cx1111 opened this issue 8 years ago • 1 comments

WFDB Invalid sample limitation

Currently the wfdb library does not account for >16bit formats and hence uses the value -32768 as nan.

For this python package for rdsamp physical==0, I have currently decided to set empty multi-segment channels (with stacksegments==1) to -2^31. We can revise this later if needed and see what happens with the next version of the wfdb library. In addition, all format samples will be stored (with physical==0) as they are with no mapping.

For rdsamp for option physical==1, 2^(fmt-1) will be interpreted as nans.

cx1111 avatar Jul 14 '16 17:07 cx1111

Reading physical samples in multi-segment records

If you call rdsamp -p on a multi-segment record, it will read the digital values from each segment and use the layout header's gain and baseline for each channel to convert the values to physical. It is possible (such as in record sampledata/matched/s25047/s25047-2704-05-04-10-44) that the layout header's gains/baselines do not match those of the individual segment headers, and hence calling rdsamp on the master record may return slightly different values than calling rdsamp on individual segments.

In this python package, rdsamp will convert each segment's values into physical units using the gain and baseline specified in each individual segment header. This makes it so that the values received from calling rdsamp on the master record will give the exact same values as if it were called on the individual records.

I think the latter method is more proper and I discussed this with Benjamin as well. But this does mean the two rdsamps perform slightly differently for multi-segment records, and also that any integrity checks will have to be done via reading the individual segments.

cx1111 avatar May 26 '17 15:05 cx1111