peakdetection command line

The peak detection can be run without the GUI. The x, y and flags are passed, and Pout returned.

Pout = peakdetect_run( y, x, flags );
x: time values
y: waveform

flags: parameters

flags.use_defaults: (optional) true uses default settings, false does not. 
flags.use_previous: (optional) true uses last GUI settings, false does not.
flags.timeunits: the time units of "x", used for calculating rate in Hz and cycles/minute (as in beats/minute, or breaths/minute)
flags.[parameter]: (optional) use specified parameter values, and default settings for other parameters.

flags.decaytimeconstpk = 1;
flags.decaytimeconsttr = 3;
flags.flagmininterval = 0;
flags.mawindow = 5;
flags.mininterval = 0.25;
flags.threshlimpk = 10;
flags.threshlimtr = 8;

*flags.flagpeakmax = 0;
*flags.flagtroughmin = 0;

*flags.flagmeanmax = 0;
*flags.flagmeanmin = 0;
*flags.troughmin = -100;

*flags.meanmax = 100;
*flags.meanmin = -100;

*flags.peakmax = 100;

  • Not used (as of 2015-03-23)

Example

x = D.recording{i}.ts.pleth.Time;

y = squeeze( D.recording{1}.ts.pleth.Data);

flags.timeunits = 'minutes';

flags.use_defaults = true;

P = peakdetect_run( y, x, flags );

figure, plot(P.ratex_seconds, P.ratey_bpm), xlabel('Time (seconds)'), ylabel('Rate (bpm)')