User Tools

Site Tools


heartbeats

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
heartbeats [2010/05/28 23:45] – Missing paranthesis jochenheartbeats [2010/06/15 04:28] – added the second parameter-for-known filename case jochen
Line 8: Line 8:
 The [[xff]] IO reading class now supports reading the following formats: The [[xff]] IO reading class now supports reading the following formats:
   * ACQ (up until version <= 3.9.7)   * ACQ (up until version <= 3.9.7)
-  * TXT (use ''<nowiki>object = xff('*.ntt');</nowiki>'' to read!)+  * TXT (use ''<nowiki>object = xff('*.ntt');</nowiki>'' or ''<nowiki>object = xff(filename, 'ntt');</nowiki>'' to read!)
 and further formats might be added based on request and urgency. and further formats might be added based on request and urgency.
  
Line 29: Line 29:
          .freq      data frequency in Hz (default: 1000)          .freq      data frequency in Hz (default: 1000)
          .plot      plot mean +/- std estimate of signal (default: false)          .plot      plot mean +/- std estimate of signal (default: false)
 +         .plotfreq  samples per second to plot
          .plotwin   plot window size in seconds (default: 6)          .plotwin   plot window size in seconds (default: 6)
          .segsize   segmentation size in seconds (default: 5)          .segsize   segmentation size in seconds (default: 5)
          .segstep   stepping (window shift) in seconds (default: 1)          .segstep   stepping (window shift) in seconds (default: 1)
 +         .skewdt    skewness detection threshold multiplier (default: 0.5)
          .windsor   windsorizing threshold in std's (default: 3)          .windsor   windsorizing threshold in std's (default: 3)
    
Line 110: Line 112:
 Naturally, it is possible to script this function, save the pre-detected heartbeats (without manual interaction/plotting) and then, at a later time, revisit the inspection (for instance, if several subjects' datasets are to be examined, it usually is preferable to perform the extraction and detection of all datasets prior to engaging in the fine tuning). Naturally, it is possible to script this function, save the pre-detected heartbeats (without manual interaction/plotting) and then, at a later time, revisit the inspection (for instance, if several subjects' datasets are to be examined, it usually is preferable to perform the extraction and detection of all datasets prior to engaging in the fine tuning).
  
 +For instance, if the raw signal looks like this
 +
 +{{:heartbeats_crisp_example.png|crisp raw signal with very short spikes}}
 +
 +A two-pass detection scheme can be employed:
 +
 +<code matlab heartbeats_crisp_detection.m>% first, load the data
 +data = xff('*.ntt');
 +
 +% then z-transform the third column (in our case) and take the 4th power
 +pdata = ztrans(data.Data(:, 3)) .^ 4;
 +
 +% pre-detect beats
 +% since we used the 4th power, the skew detection threshold must be lowered
 +% and our signal has short spikes, so the detection length threshold also!
 +bp = heartbeats(pdata, struct( ...
 +    'skewdt',    0.05, ...
 +    'detlength', 0.01, ...
 +    'freq', 500));
 +
 +% then pass this along with the actual signal back in
 +[bp, bs, bf, bv, cp, wgd, wd] = heartbeats(data.Data(:, 3), struct( ...
 +    'bppre',   bp, ...
 +    'cleanup', true, ...
 +    'freq',    500, ...
 +    'plot',    true));</code>
heartbeats.txt · Last modified: 2010/06/29 17:17 by jochen