J.M. O' Toole bio photo

J.M. O' Toole

Researcher @ Neonatal Brain Research Group, UCC, Ireland. Topic: biomedical signal processing

Github

Methods to Estimate the Instantaneous Frequency (IF) of EEG Periodic Discharges

Contents

Collection of M-files (computer code) implements a method to estimate the IF for periodic discharges on EEG [1]. Requires Matlab or Octave (programming environments) and the fast_TFDs package.

Download

download IF_estimation_PLEDs (or fork on github)

Quick Start

The first and necessary step is to add paths so Matlab can find all the code; use the load_paths_all function:

>> load_paths_all;

Files

All Matlab files (.m files) have a description and an example in the header. To read this header, type help <filename.m> in Matlab. Directory structure is as follows:

.
├── data                 # some signal examples in .mat files
├── methods              # IF estimation methods
├── synth_PLED_signal    # generate the synthetic (PLED-like) signals
│   └── generate_data
└── utils                # miscellaneous collection of utilities

Example 1

An example, from [1], compares the proposed IF estimation method with other methods:

>> demo_compare_3methods;

Example 2

To generate the PLED (periodic lateralized epilepiform discharges) example figure from [1]:

>> generate_Fig_IFest_example('a');
  >> generate_Fig_IFest_example('b');
  >> generate_Fig_IFest_example('c');
  >> generate_Fig_IFest_example('d');
  >> generate_Fig_IFest_example('e');

Synthetic Signals

Call function gen_synth_signals_plus_noise (in the synth_PLED_signals directory) to generate the synthetic signals:

snr=0; Fs=50; 
   N_iters=10; WAVEFORM_MONOPHASIC=0;
   [sigs,IFs]=gen_synth_signals_plus_noise(snr,N_iters,Fs,'CGN',WAVEFORM_MONOPHASIC);

   figure(1); clf; Fs=50; 
   n=(1:size(sigs,2))./Fs; 
   subplot(2,1,1); plot(n,sigs(1,:)); xlim([5 35]);
   xlabel('time (seconds)');  ylabel('amplitude');
   subplot(2,1,2); plot(n,IFs(1,:)); xlim([5 35]);
   xlabel('time (seconds)');  ylabel('frequency (Hz)');

These synthetic signals use the Duffing waveform from [4], stored in data file data/duffing_waveforms.mat directory.

Example 3

Estimate the IF on synthetic signal using the proposed method (log-lag time–frequency filtering):

b=load('synth_signal_example_0dB.mat');
   [iflaw,t_scale,f_scale]=estIF_epoch_overlapadd(b.x,b.Fs);
   
   % plot:
   figure(1); clf;  hold all;
   n=1:length(iflaw);
   plot(n.*t_scale,iflaw.*f_scale);
   plot( (1:length(b.true_IF))./b.Fs,b.true_IF);
   legend('proposed','true IF');
   xlim([10 30]); ylim([0 2]);
   xlabel('time (seconds)'); 
   ylabel('frequency (Hz)');

Requirements

  • Either Matlab (R2012 or newer, http://www.mathworks.co.uk/products/matlab/) or Octave (v3.6 or newer, http://www.gnu.org/software/octave/index.html, with the ‘octave-signal’ add-on package).
  • The fast time–frequency distribution algorithms are required [3], available for free download here.
  • At least 2 GB of RAM available, preferably >4 GB.

Test Computer Setup

  • hardware: Intel(R) Xeon(R) CPU E5-1603 0 @ 2.80GHz; 8GB memory.
  • operating system: Ubuntu GNU/Linux x86_64 distribution (Raring, 13.04), with Linux kernel 3.5.0-28-generic
  • software: Octave 3.6.4 (using Gnuplot 4.6 patchlevel 1), with ‘octave-signal’ toolbox and Matlab (R2009b, R2012a, and R2013a)

Licence

Copyright (c) 2011 and 2012, John O' Toole, University of Deusto
Copyright (c) 2013, John O' Toole, University College Cork
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

  Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

  Redistributions in binary form must reproduce the above copyright notice, this
  list of conditions and the following disclaimer in the documentation and/or
  other materials provided with the distribution.

  Neither the name of the University of Deusto nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

References

  1. in preparation

  2. B. Boashash, A. Ghazem, and J.M. O’ Toole. “Time–frequency processing of nonstationary signals: advanced TFD design to aid diagnosis with highlights from medical applications.” IEEE Signal Processing Magazine, vol. 30, no. 6, pp. 108–119, November 2013.

  3. J.M. O’ Toole and B. Boashash, “Fast and memory-efficient algorithms for computing quadratic time–frequency distributions”, Applied and Computational Harmonic Analysis, vol. 35, no. 2, pp. 350–358, 2013.

  4. N.J. Stevenson, M. Mesbah, G.B. Boylan, P.B. Colditz, and B. Boashash, “A nonlinear model of newborn EEG with non-stationary inputs,” Annals of Biomedical Engineering, vol. 38, no. 9, pp. 3010–3021, Sep. 2010.