Time-Frequency Analysis

Similar documents
Signal Processing. Naureen Ghani. December 9, 2017

Cross-Frequency Coupling. Naureen Ghani. April 28, 2018

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

Introduction to Wavelets Michael Phipps Vallary Bhopatkar

Signal segmentation and waveform characterization. Biosignal processing, S Autumn 2012

(Time )Frequency Analysis of EEG Waveforms

Introduction to Wavelet Transform. Chapter 7 Instructor: Hossein Pourghassem

PSYC696B: Analyzing Neural Time-series Data

Signal Processing. Introduction

Time-Frequency analysis of biophysical time series

Time-Frequency Analysis of Shock and Vibration Measurements Using Wavelet Transforms

21/01/2014. Fundamentals of the analysis of neuronal oscillations. Separating sources

Phase Synchronization of Two Tremor-Related Neurons

Data Analysis in MATLAB Lab 1: The speed limit of the nervous system (comparative conduction velocity)

Fourier and Wavelets

Wavelets and wavelet convolution and brain music. Dr. Frederike Petzschner Translational Neuromodeling Unit

Post-processing using Matlab (Advanced)!

Understanding Digital Signal Processing

Post-processing data with Matlab

Outline. Introduction to Biosignal Processing. Overview of Signals. Measurement Systems. -Filtering -Acquisition Systems (Quantisation and Sampling)

Limulus eye: a filter cascade. Limulus 9/23/2011. Dynamic Response to Step Increase in Light Intensity

Applications of Music Processing

Introduction to Computational Neuroscience

Project 0: Part 2 A second hands-on lab on Speech Processing Frequency-domain processing

SIMULATING RESTING CORTICAL BACKGROUND ACTIVITY WITH FILTERED NOISE. Journal of Integrative Neuroscience 7(3):

Spectro-Temporal Methods in Primary Auditory Cortex David Klein Didier Depireux Jonathan Simon Shihab Shamma

MUS421/EE367B Applications Lecture 9C: Time Scale Modification (TSM) and Frequency Scaling/Shifting

Sound synthesis with Pure Data

Introduction. Chapter Time-Varying Signals

Signals, sampling & filtering

EE 791 EEG-5 Measures of EEG Dynamic Properties

ELECTROMYOGRAPHY UNIT-4

Singing Voice Detection. Applications of Music Processing. Singing Voice Detection. Singing Voice Detection. Singing Voice Detection

Worksheet for the afternoon course Tune measurements simulated with a DSP card

Detection, localization, and classification of power quality disturbances using discrete wavelet transform technique

Power Spectral Estimation With FFT (Numerical Recipes Section 13.4)

Filtering and Data Cutoff in FSI Retrievals

Encoding of Naturalistic Stimuli by Local Field Potential Spectra in Networks of Excitatory and Inhibitory Neurons

Wavelet Transform for Bearing Faults Diagnosis

Non-Sinusoidal Activity Can Produce Cross- Frequency Coupling in Cortical Signals in the Absence of Functional Interaction between Neural Sources

Spur Detection, Analysis and Removal Stable32 W.J. Riley Hamilton Technical Services

Detection of gear defects by resonance demodulation detected by wavelet transform and comparison with the kurtogram

6.555 Lab1: The Electrocardiogram

Practical Application of Wavelet to Power Quality Analysis. Norman Tse

Practical Applications of the Wavelet Analysis

EBU5375 Signals and Systems: Filtering and sampling in Matlab. Dr Jesús Requena Carrión

Lab P-4: AM and FM Sinusoidal Signals. We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: ) X

Biosignal filtering and artifact rejection. Biosignal processing I, S Autumn 2017

TRANSFORMS / WAVELETS

2 Oscilloscope Familiarization

Introduction. In the frequency domain, complex signals are separated into their frequency components, and the level at each frequency is displayed

Non-stationary Analysis/Synthesis using Spectrum Peak Shape Distortion, Phase and Reassignment

EE216B: VLSI Signal Processing. Wavelets. Prof. Dejan Marković Shortcomings of the Fourier Transform (FT)

Computing with Biologically Inspired Neural Oscillators: Application to Color Image Segmentation

SINOLA: A New Analysis/Synthesis Method using Spectrum Peak Shape Distortion, Phase and Reassigned Spectrum

!"!#"#$% Lecture 2: Media Creation. Some materials taken from Prof. Yao Wang s slides RECAP

ASSESSMENT OF POWER QUALITY EVENTS BY HILBERT TRANSFORM BASED NEURAL NETWORK. Shyama Sundar Padhi

Theory of Telecommunications Networks

Kate Allstadt s final project for ESS522 June 10, The Hilbert transform is the convolution of the function f(t) with the kernel (- πt) - 1.

International Journal of Modern Trends in Engineering and Research e-issn No.: , Date: 2-4 July, 2015

Neural Coding of Multiple Stimulus Features in Auditory Cortex

MATLAB for time series analysis! e.g. M/EEG, ERP, ECG, EMG, fmri or anything else that shows variation over time! Written by!

Spectrum Analysis - Elektronikpraktikum

Figure S3. Histogram of spike widths of recorded units.

Complex Sounds. Reading: Yost Ch. 4

Large-scale cortical correlation structure of spontaneous oscillatory activity

Lab S-7: Spectrograms of AM and FM Signals. 2. Study the frequency resolution of the spectrogram for two closely spaced sinusoids.

Question 1 Draw a block diagram to illustrate how the data was acquired. Be sure to include important parameter values

Lecture 3 Complex Exponential Signals

Lecture 13 Read: the two Eckhorn papers. (Don t worry about the math part of them).

EE 464 Short-Time Fourier Transform Fall and Spectrogram. Many signals of importance have spectral content that

EPILEPSY is a neurological condition in which the electrical activity of groups of nerve cells or neurons in the brain becomes

Determination of human EEG alpha entrainment ERD/ERS using the continuous complex wavelet transform

Figure 1: Block diagram of Digital signal processing

DSP First. Laboratory Exercise #7. Everyday Sinusoidal Signals

Empirical Mode Decomposition: Theory & Applications

Linear Time-Invariant Systems

Objectives. Abstract. This PRO Lesson will examine the Fast Fourier Transformation (FFT) as follows:

DSP First Lab 03: AM and FM Sinusoidal Signals. We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: k=1

Final Exam Practice Questions for Music 421, with Solutions

WAVELET TRANSFORMS FOR SYSTEM IDENTIFICATION AND ASSOCIATED PROCESSING CONCERNS

Massachusetts Institute of Technology Dept. of Electrical Engineering and Computer Science Spring Semester, Introduction to EECS 2

Time-Frequency Enhancement Technique for Bevel Gear Fault Diagnosis

Physiological Signal Processing Primer

FFT analysis in practice

Electrical & Computer Engineering Technology

2015 HBM ncode Products User Group Meeting

FFT 1 /n octave analysis wavelet

Application of Fourier Transform in Signal Processing

Introduction to Signals and Systems Lecture #9 - Frequency Response. Guillaume Drion Academic year

APPENDIX F: ACROSS-WIND EXCITATION ALGORITHM

Lab 8. Signal Analysis Using Matlab Simulink

Discrete Fourier Transform (DFT)

THE CITADEL THE MILITARY COLLEGE OF SOUTH CAROLINA. Department of Electrical and Computer Engineering. ELEC 423 Digital Signal Processing

ON THE RELATIONSHIP BETWEEN INSTANTANEOUS FREQUENCY AND PITCH IN. 1 Introduction. Zied Mnasri 1, Hamid Amiri 1

ELEC-C5230 Digitaalisen signaalinkäsittelyn perusteet

CN510: Principles and Methods of Cognitive and Neural Modeling. Neural Oscillations. Lecture 24

Machine recognition of speech trained on data from New Jersey Labs

Signal Processing Toolbox

Lecture 5: Sinusoidal Modeling

Transcription:

Seizure Detection Naureen Ghani December 6, 27 Time-Frequency Analysis How does a signal change over time? This question is often answered by using one of the following three methods: Apply a Fourier transform with a sliding window Use a wavelet transform Filter the signal and apply a Hilbert transform A sliding window is a segment of data ( window ) within which the computation (often a Fourier transform) is applied. The window slides through the data, repeating the computation until the entire signal is covered. The built-in spectrogram function in MATLAB performs a sliding window, and allows the user to vary window lengths and window overlaps. A wavelet transform is an alternative to the Fourier transform. This algorithm computes the similarity between each segment of a signal and a short, wave-like distribution called a wavelet. The wavelet can be scaled across many widths to capture different frequencies. The Hilbert transform is often applied to pre-filtered signals. It can be thought of as a convolution (using a distribution to transform the signal) that produces a complex number at each point. These complex numbers can be re-interpreted in terms of phases and amplitudes. Thus, the Hilbert transform is an instantaneous Fourier transform. Uncertainty Principle There are limits to how precisely the frequency spectrum of a signal can be computed. In signal processing, the limiting factor is the length of the signal. Dennis Gabor, inventor of the hologram, was the first to realize that the uncertainty principle applies to signals. The exact time and frequency of a signal can never be known simultaneously: a signal cannot plot as a point on the time-frequency plane. This uncertainty is a property of signals, not a limitation of mathematics. Heisenberg s uncertainty principle is often written in terms of the standard deviation of position svx, the standard deviation of momentum svp, andtheplanckconstanth: x p h 4 t 5.3 35 m 2 kg.s In other words, the product of the uncertainties of position and momentum is small, but not zero. If the standard deviations of the time and frequency estimates are svtand svfrespectively, then we can write Gabor s uncertainty principle as: t f 4 t.8cycles Thus, the product of the standard deviations of time (ms) and frequency (Hz) must be at least 8 ms-hz. Regardless of how the transform is computed, we pay for time information with frequency information. Specifically, the product of time uncertainty and frequency uncertainty must be at least 4. Types of Wavelets Time-varying frequency components can be identified by filtering a signal with short distibrutions called wavelets. Wavelets are brief oscillations. When a filter is applied, these wavelets expand or contract to fit the frequencies of interest.

Mexican Hat Wavelet Morlet Wavelet.8.8.6.6.4.4.2.2 -.2 -.4 -.6 -.2 -.8 -.4-8 -6-4 -2 2 4 6 8 - -8-6 -4-2 2 4 6 8 In neurophysiological signal analysis, the Mexican Hat and Morlet wavelets are commonly used. The Morlet wavelet contains a greater number of cycles, which improves the detection of signal oscillations relative to transient events. It also means that we lost time information in order to increase frequency resolution. One common error in time-frequency analysis is the misattribution of signal events as oscillations. Neural signals appear as spikes. Sharp transitions in the signal are built not of a single frequency component, but a vast range of frequencies. Any filter that is applied to the signal over a spike will give the appearance of a power increase at that moment, and the strength of the power inrease is related to the size of the spike. Thus, noise can lead to mistinterpretation of time-frequency results. Here is code to pre-filter a signal to remove noise: function flfp = filt_lfp(sig,lower_limit,upper_limit,sf) % flfp = filt_lfp(sig, lower_limit, upper_limit) % % filt_lfp uses a butterworth filter to bandpass filter the signal between % lower and upper limit % % INPUTS: % sig = signal to be filtered % lower_limit = lower bound of bandpass % upper_limit = upper bound of bandpass % sf = sampling Frequency ( default: 2 Hz) % Set Default sf = 2 Hz if nargin < 4 sf = 2; end if isempty(sf) sf = 2; end Nyquist_freq = sf/2; lowcut = lower_limit/nyquist_freq; highcut = upper_limit/nyquist_freq; filter_order = 3; % may need to be changed based on bandpass limits passband = [lowcut highcut]; [Bc Ac] = butter(filter_order, passband); flfp = filtfilt(bc,ac,sig); 2

Wavelet Demo To begin this demo, let s simulate a signal with an 8 to Hz segment followed by a 6 to 2 Hz segment and then apply a sliding window Fourier analysis: % Wavelet Analysis % Generate a signal with a 8- Hz segment rng(); % seeds random number generator noiselfp = rand(,4); LFP_6to = filt_lfp(noiselfp,6,,2); % Generate a signal with a 6-2 Hz segment rng(2); noiselfp = rand(,4); LFP_6to2 = filt_lfp(noiselfp,6,2,2); % Concatenate signals LFP = [LFP_6to LFP_6to2]; figure; plot(linspace(,4,82),lfp); title(' Original Signal'); xlabel('time'); ylabel(' Voltage'); % Apply sliding window Fourier analysis window = ; % the sampling rate is 2 data points per second % so the window size represents /2 second or 5 ms of data noverlap = 8; % amount of overlap from one window to the next. An overlap of 8 samples % will mean that the window steps over the data in ms increments % (-8 = 2 samples = ms) F = 2:2:4; % freq to compute spectral data Fs = 2; figure; spectrogram(lfp,window,noverlap,f,fs); view(2) colormap jet; title(' Spectrogram of Signal'); % Morlet wavelet coefsi = cwt(lfp,centfrq('cmor -')*Fs./F,'cmor -'); f2 = figure; wm_image = imagesc(abs(coefsi)); % Mexican hat wavelet coefsi_hat = cwt(lfp,centfrq('mexh')*fs./[2:4],'mexh'); imagesc(abs(coefsi_hat)); 3

. Original Signal Spectrogram of Signal.8 3.5-5.6 3-6 Voltage.4.2 -.2 Time (secs) 2.5 2.5-7 -8-9 Power/frequency (db/hz) -.4 - -.6 -.8.5.5 2 2.5 3 3.5 4 Time.5 5 5 2 25 3 35 4 Frequency (Hz) There are two approaches to applying wavelet transformations in MATLAB: discrete and continuous. These differ according to how the set of frequencies (wavelet width) are chosen. In this exercise, we compute the complex Morlet wavelet. We can obtain meaningful values of amplitude and phase in this way. - 2 4 6 8 2 4 6 8 2 2 3 4 5 6 7 8 We repeat this process for the Mexican hat wavelet. The built-in MATLAB function does not use complex conjugates, so we will only detect upward deflections in the LFP signal at each frequency band. 5 5 2 25 3 35 2 3 4 5 6 7 8 In this image, we see stripes where we previously saw smooth transitions across time bins. The warmer-colored streaks also extend farther across the frequency spectrum, while the resolution appears to be stronger in the temporal domain. This illustrates the uncertainty principle described above. 4

Hilbert Transform The Hilbert transform is used to compute the instantaneous phase and amplitude of a signal. It is best to use pre-filtered data. Here is the code to do so: % Compute instantaneous phase and amplitude of a signal using Hilbert % transform LFP_6topost = filt_lfp(lfp,6,,2); h_lfp_6topost = hilbert(lfp_6topost); amp_lfp_6topost = abs(h_lfp_6topost); figure; hold on; plot(linspace(,4,82),lfp_6topost); plot(linspace(,4,82),amp_lfp_6topost,'r',' LineWidth',2); legend('raw signal',' instant amplitude'); xlabel('time'); ylabel(' Amplitude'); title(' Instaneous Amplitude'); hold off; figure; phs = atan2(imag(h_lfp_6topost),real(h_lfp_6topost)); plotyy(linspace(,4,82), LFP_6topost, linspace(,4,82), phs); title(' Instaneous Phase');.8.6 Hilbert Transform raw signal instant amplitude.4.2 Amplitude -.2 -.4 -.6 -.8.5.5 2 2.5 3 3.5 4 Time The red line indicates our instanteous amplitude, which envelopes the filtered signal. We could alternatively use the complex conjugate to identify the instantaneous phase of the oscillation in the filtered signal: 5

.8 Instaneous Phase 4.6 3.4 2.2 -.2 - -.4-2 -.6-3 -.8-4.5.5 2 2.5 3 3.5 4 Seizure Simulation Epilepsy is a chronic neurological disorder characterized by recurrent seizures. In children, many seizures display rhythmin spike-wave (SW) discharges in the EEG. In a study published by PLoS One (Taylor and Wang, 24 ), a computational model of seizures was built on MATLAB. In this demo, we will explore their simulation: function dudt=amaritcimpbs(t,u) % % connectivity parameters w =.8;%PY -> PY w2 = 4; %PY -> I w3 =.5; % I - PY % w4= ; w5 =.5; % TC -> RTN w6 =.6; % RTN - TC w7 = 3; % PY -> TC w8 = 3; % PY -> RTN w9 = ; % TC -> PY w=.2;% RTN - RTN h_p = -.35; % h_i = -3.4; % h_t = -2; % -2 for bistable for ode45; -2.2 for excitable for ode45. h_r = -5; % s=2.8; a=; % Time scale parameters tau=*26; % tau2=.25*26; % tau3=.*a*26; % tau4=.*a*26; % sig_py = (./(+25.^-(u()))); sig_in = (./(+25.^-(u(2)))); sig_tc = (./(+25.^-(u(3)))); sig_re = (./(+25.^-(u(4)))); dudt=zeros(4,); 6

dudt() = (+h_p -u() +w*sig_py -w3*sig_in + w9*sig_tc )*tau; dudt(2) = (+h_i -u(2) +w2*sig_py )*tau2; dudt(3) = (+h_t -u(3) +w7.*sig_py - w6*(s*u(4)+.5) )*tau3; dudt(4)= (+h_r -u(4) +w8.*sig_py + w5*(s*u(3)+.5) -w*(s*u(4)+.5))*tau4; end The model describes the temporal evolution of the state of four variables corresponding to the activity of populations of: cortical pyramidal neurons (PY) cortical inhibitory interneurons (IN) thalamo-cortical neurons (TC) inhibitory (thalamic) reticular neurons (RE) There is a background state of normal activity and a rhythmic state of pathalogical activity (SW complex). We can then modify their code to detect peaks by thresholding: % initial condition near the fixed point fp_approx = [.724.787 -.88.2775]; [t,u]=ode45(@amaritcimpbs,[ ],fp_approx);% background state [t2,v]=ode45(@amaritcimpbs,[ 5],u(end,:) -[.3.3 ]);% seizure state [t3,w]=ode45(@amaritcimpbs,[5 3],v(end,:) -[.3.3 ]);% background state %% PY=[u(:,); v(2:end,); w(2:end,)]; IN=[u(:,2); v(2:end,2); w(2:end,2)]; TC=[u(:,3); v(2:end,3); w(2:end,3)]; RE=[u(:,4); v(2:end,4); w(2:end,4)]; t=[t;t2(2:end);t3(2:end)]; figure() plot(t,mean([py,in],2),'k') hold on m=mean(fp_approx(:2)); % plot([ ],[m m -.3],'r',' LineWidth ',5) % plot([5 5],[m m -.3],'b',' LineWidth ',5) hold off xlabel('time ( sec)',' FontSize',2) ylabel(' Simulated EEG',' FontSize',2) set(gca,' FontSize',5) % legend(' Simulated EEG',' Stimulus pulse to induce SWD',' Stimulus pulse to terminate SWD ') % Use built -in peak detection time = t; volt = mean([py,in],2); pks = findpeaks(volt,.3); % threshold for peaks >.3 pks = pks.loc; % convert struct to double hold on; scatter(t(pks),volt(pks),'r'); 7

legend('raw signal','spikes'); title(' Simulated Seizure'); hold off;.6.4 Simulated Seizure raw signal spikes Simulated EEG.2 -.2 -.4 2 3 Time (sec) 8