Short-time FFT, Multi-taper analysis & Filtering in SPM12



Similar documents
B3. Short Time Fourier Transform (STFT)

Analysis/resynthesis with the short time Fourier transform

L9: Cepstral analysis

Design of FIR Filters

Window function From Wikipedia, the free encyclopedia For the term used in SQL statements, see Window function (SQL)

SIGNAL PROCESSING & SIMULATION NEWSLETTER

Filter Comparison. Match #1: Analog vs. Digital Filters

The continuous and discrete Fourier transforms

This document is downloaded from DR-NTU, Nanyang Technological University Library, Singapore.

ANALYZER BASICS WHAT IS AN FFT SPECTRUM ANALYZER? 2-1

Probability and Random Variables. Generation of random variables (r.v.)

Em bedded DSP : I ntroduction to Digital Filters

Correlation and Convolution Class Notes for CMSC 426, Fall 2005 David Jacobs

SWISS ARMY KNIFE INDICATOR John F. Ehlers

Time series analysis Matlab tutorial. Joachim Gross

Summary Nonstationary Time Series Multitude of Representations Possibilities from Applied Computational Harmonic Analysis Tests of Stationarity

Lecture 1-6: Noise and Filters

Applications of the DFT

Matlab GUI for WFB spectral analysis

AN-007 APPLICATION NOTE MEASURING MAXIMUM SUBWOOFER OUTPUT ACCORDING ANSI/CEA-2010 STANDARD INTRODUCTION CEA-2010 (ANSI) TEST PROCEDURE

RF Measurements Using a Modular Digitizer

Design of Efficient Digital Interpolation Filters for Integer Upsampling. Daniel B. Turek

8 Filtering. 8.1 Mathematical operation

Lecture 1-10: Spectrograms

Wavelet analysis. Wavelet requirements. Example signals. Stationary signal 2 Hz + 10 Hz + 20Hz. Zero mean, oscillatory (wave) Fast decay (let)

SGN-1158 Introduction to Signal Processing Test. Solutions

Convolution, Correlation, & Fourier Transforms. James R. Graham 10/25/2005

The front end of the receiver performs the frequency translation, channel selection and amplification of the signal.

TCOM 370 NOTES 99-4 BANDWIDTH, FREQUENCY RESPONSE, AND CAPACITY OF COMMUNICATION LINKS

Agilent Time Domain Analysis Using a Network Analyzer

Lab 1. The Fourier Transform

Transition Bandwidth Analysis of Infinite Impulse Response Filters

Author: Dr. Society of Electrophysio. Reference: Electrodes. should include: electrode shape size use. direction.

Introduction to Digital Filters

Appendix D Digital Modulation and GMSK

Auto-Tuning Using Fourier Coefficients

Time Series Analysis: Introduction to Signal Processing Concepts. Liam Kilmartin Discipline of Electrical & Electronic Engineering, NUI, Galway

Sampling Theorem Notes. Recall: That a time sampled signal is like taking a snap shot or picture of signal periodically.

SOFTWARE FOR GENERATION OF SPECTRUM COMPATIBLE TIME HISTORY

Midwest Symposium On Circuits And Systems, 2004, v. 2, p. II137-II140. Creative Commons: Attribution 3.0 Hong Kong License

5 Signal Design for Bandlimited Channels

Digital filter design for electrophysiological data a practical approach

Non-Data Aided Carrier Offset Compensation for SDR Implementation

Computational Foundations of Cognitive Science

Computational Optical Imaging - Optique Numerique. -- Deconvolution --

Admin stuff. 4 Image Pyramids. Spatial Domain. Projects. Fourier domain 2/26/2008. Fourier as a change of basis

Laboratory #5: RF Filter Design

How To Understand The Nyquist Sampling Theorem

HYBRID FIR-IIR FILTERS By John F. Ehlers

FAST Fourier Transform (FFT) and Digital Filtering Using LabVIEW

Loop Bandwidth and Clock Data Recovery (CDR) in Oscilloscope Measurements. Application Note

The Effective Number of Bits (ENOB) of my R&S Digital Oscilloscope Technical Paper

Sampling and Interpolation. Yao Wang Polytechnic University, Brooklyn, NY11201

The Algorithms of Speech Recognition, Programming and Simulating in MATLAB

Jeff Thomas Tom Holmes Terri Hightower. Learn RF Spectrum Analysis Basics

Aliasing, Image Sampling and Reconstruction

RADIO FREQUENCY INTERFERENCE AND CAPACITY REDUCTION IN DSL

Final Year Project Progress Report. Frequency-Domain Adaptive Filtering. Myles Friel. Supervisor: Dr.Edward Jones

Electronic Communications Committee (ECC) within the European Conference of Postal and Telecommunications Administrations (CEPT)

Nonlinear Signal Analysis: Time-Frequency Perspectives

FUNDAMENTALS OF MODERN SPECTRAL ANALYSIS. Matthew T. Hunter, Ph.D.

A Sound Analysis and Synthesis System for Generating an Instrumental Piri Song

Clutter Filter Design for Ultrasound Color Flow Imaging

1995 Mixed-Signal Products SLAA013

Positive Feedback and Oscillators

Agilent AN 1316 Optimizing Spectrum Analyzer Amplitude Accuracy

Lecture 14. Point Spread Function (PSF)

Impedance 50 (75 connectors via adapters)

Lock - in Amplifier and Applications

First, we show how to use known design specifications to determine filter order and 3dB cut-off

Measuring Line Edge Roughness: Fluctuations in Uncertainty

Introduction to Digital Audio

Introduction to IQ-demodulation of RF-data

Wavelet Analysis on Stochastic Time Series A visual introduction with an examination of long term financial time series

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

SIGNAL PROCESSING FOR EFFECTIVE VIBRATION ANALYSIS

TTT4110 Information and Signal Theory Solution to exam

Making OSNR Measurements In a Modulated DWDM Signal Environment

THE SPECTRAL MODELING TOOLBOX: A SOUND ANALYSIS/SYNTHESIS SYSTEM. A Thesis. Submitted to the Faculty

Bandwidth-dependent transformation of noise data from frequency into time domain and vice versa

WAVEFORM DICTIONARIES AS APPLIED TO THE AUSTRALIAN EXCHANGE RATE

Space Environment and Satellite Systems: Removing Clutter from Ground-to-Satellite Signals. Sigrid Close

How To Understand The Discrete Fourier Transform

Network Traffic Characterization using Energy TF Distributions

Understanding CIC Compensation Filters

Structural Health Monitoring Tools (SHMTools)

Keysight Technologies 8 Hints for Better Spectrum Analysis. Application Note

Spectral Line II. G ij (t) are calibrated as in chapter 5. To calibrated B ij (ν), observe a bright source that is known to be spectrally flat

Module 13 : Measurements on Fiber Optic Systems

CHAPTER 6 Frequency Response, Bode Plots, and Resonance

Agilent Creating Multi-tone Signals With the N7509A Waveform Generation Toolbox. Application Note

Optimizing IP3 and ACPR Measurements

Convolution. 1D Formula: 2D Formula: Example on the web:

MPEG Unified Speech and Audio Coding Enabling Efficient Coding of both Speech and Music

73M2901CE Programming the Imprecise Call Progress Monitor Filter

SUMMARY. Additional Digital/Software filters are included in Chart and filter the data after it has been sampled and recorded by the PowerLab.

AN-756 APPLICATION NOTE One Technology Way P.O. Box 9106 Norwood, MA Tel: 781/ Fax: 781/

MUSICAL INSTRUMENT FAMILY CLASSIFICATION

VCO Phase noise. Characterizing Phase Noise

R&S FSW signal and spectrum analyzer: best in class now up to 50 GHz

Transcription:

Short-time FFT, Multi-taper analysis & Filtering in SPM12 Computational Psychiatry Seminar, FS 2015 Daniel Renz, Translational Neuromodeling Unit, ETHZ & UZH 20.03.2015

Overview Refresher Short-time Fourier transform Filter design Multitapering Filtering of EEG data in SPM12 Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 2

Recap: Fourier Transform (FT) Our goal: To analyze event related signal changes in the time-frequency domain. FT expands a function in terms of sinusoids (or complex exponentials) to fully reveal all frequency components. FT does not have any time resolution. Cohen 2014 http://nbviewer.ipython.org/github/calebmadrigal/fourier TalkOSCON/blob/master/images/prism.png Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 3

Recap: Fourier Transform (FT) http://upload.wikimedia.org/wikipedia/commons/7/72/fourier _transform_time_and_frequency_domains_%28small%29.gif Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 4

Recap: Inner product (dot product) Measures covariance / similarity / non-orthogonality between two vectors (the inner product of orthogonal vectors is zero). Can be extended to functions. Any two sinusoids of different frequency are orthogonal. This means that sinusoids can be used as basis functions. We can think of Fourier transformation at frequency ω as the inner product of the signal with a complex-valued oscillation. As the basis functions are orthogonal, the Fourier-transform gives a perfect representation of the frequency spectrum. How to extend this to have temporal resolution? http://mathinsight.org/media/ima ge/image/dot_product_projection _unit_vector.png Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 5

How to get a time-frequency representation Model-free non-parametric methods: Short-time Fourier, Wavelet, Hilbert. We can view all three methods as convolutions with complex oscillatory kernels [Bruns 2003]. Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 6

How to get a time-frequency representation Model-free non-parametric methods: Short-time Fourier, Wavelet, Hilbert. We can view all three methods as convolutions with complex oscillatory kernels [Bruns 2003]. http://www.merriam-webster.com/dictionary/convolution Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 7

Recap: Convolution We can think of convolution as the extension of the inner product (dot product) to incorporate timelags. Compute the inner product of signal with kernel (window) at beginning of signal, then move across the signal, computing products on the way. Outcome: time series of one signal weighted by another signal that slides along the first signal. repeat Cohen 2014 Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 8

Recap: Convolution http://www.hpleym.no/atcm99/paper8.html Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 9

Recap: Convolution http://www.hpleym.no/atcm99/paper8.html Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 10

Short-time Fourier Transform (STFT) Segment signal in narrow time segments. Taper (apply window on segment) each segment. Apply Fourier transform to each segment. repeat Cohen 2014 Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 11

Short-time Fourier Transform (STFT) What shape should the window function have? Boxcar, Gaussian,... How wide should it be? Should be narrow enough to consider windowed signal stationary. Narrow windows do not offer good localization in the frequency domain. Uncertainty principle: There is always a trade-off. Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 12

Windows in STFT Should not use boxcar function as a window, as this will lead to unwanted artifacts. The discontinuities at the ends of the signal are the problem. Idea: smooth signal to zero at the end points. http://www.ni.com/white-paper/4844/en/ Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 13

Windows in STFT Should not use boxcar function as a window, as this will lead to unwanted artifacts. Many possible windows, e.g. Hann, Hamming, Gaussian. A Gaussian has the same localization in time and frequency domain. Often Hann is preferred, because it tapers the data fully to zero. Use overlapping segments to compensate for signal loss (often around 90% overlap). http://www.ni.com/white-paper/4844/en/ Cohen 2014 Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 14

Recap: Wavelets Complex Morlet wavelet: Complex-valued oscillation multiplied by Gaussian-shaped envelope. Variance of Gaussian envelope scales with frequency of oscillation. The wavelet is convolved with the signal of interest. This effectively implements a band-pass filter. No fundamental difference to STFT with Gaussian window, but more convenient to use if frequency-dependent temporal resolution is required. http://upload.wikimedia.org/wikipedia/commons/c/c4/stft_and_wt.jpg Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 15

Recap: Hilbert analysis Window on frequencies only (via band-pass filter). Then extend the signal to the complex plane (analytic signal) via Hilbert transform. One can show that this, too, is equivalent to convolution of the signal with a complex oscillatory kernel [Bruns 2003]. In practice, Hilbert analysis allows for direct control over filter properties as compared to wavelets. But it s also more complicated. Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 16

Comparing STFT, Wavelet and Hilbert Formally, they are very close (convolutions with complex-valued kernels). Practical differences: Computation speed, ease-of-use Conventional shape of kernel: Gaussian for Wavelets, Hamming for STFT, the equivalent of an ideal bandpass impulse response for Hilbert. Bruns 2004: Fourier with Hamming window, Hilbert with ideal bandpass filter (smooth flanks) and complex Morlet wavelet. Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 17

Comparing STFT, Wavelet and Hilbert The interpretation of power is the same for STFT, filter-hilbert and wavelet convolution. The interpretation of phase changes Hilbert / Wavelet methods give instantaneous phase (phase at each time point). STFT gives one phase value per time window, referring to the phase of the sinusoid in that window. STFT phase in window Cohen 2014 Hilbert / Wavelet phase time series Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 18

Recap: Filtering We can think of filtering as a clever kind of averaging performed as a convolution with a filter s impulse reponse function (Thus, STFT can also be viewed as a filtering procedure). And this is equivalent to multiplication in the frequency domain. Slides from J. Heinzle Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 19

Recap: Filtering Can use filters to cut out a band of frequencies or cut out everything but a band of frequencies. But not perfectly: Precise cutoffs in the time domain (box-car function!) result in problems in the frequency domain, and vice versa. http://www.ni.com/white-paper/4844/en/ Slides from J. Heinzle Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 20

Spectral Leakage Steep slopes in time domain cause low main-lob width (good!) and high side-lobes (bad!) in the frequency domain. Fundamental trade-off between main-lobe width and side-lobe amplitude. http://www.ni.com/white-paper/4844/en/ Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 21

Multitapering Idea: Apply several tapers (window functions) that have slightly different temporal characteristics and then average the power spectra. This increases the SNR, so it s useful for situations of low SNR ratio, such as higherfrequency activity or single-trial analysis. Cohen 2014 Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 22

Multitapering: Slepian tapers If we use orthogonal tapers, windowed signals provide independent spectral estimates. This reduces estimation bias of power. Discrete prolate spheroidal sequence (DPSS, also known as Slepian sequence) is the orthogonal sequence that has the optimal main lobe energy concentration (main lobe energy/ total energy). Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 23

Multitapering More tapers means more smoothing. How much smoothing is appropriate? Trade-Off between SNR and accuracy. In MATLAB, the function dpss will compute a number of tapers, based on the desired spectral smoothing and the length of the time segment. [desired segment length] * [frequency bandwidth of main lobe] = 2* [number of tapers]. Should only use tapers with energy concentration > 90%. Good official tutorial: http://ch.mathworks.com/help/signal/ref/pmtm.html Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 24

Filter design Can optimize two out of three requirements: filter order (lower=better), main lobe width (narrower=better) and side-lobe amplitude (lower=better). Filter order refers to the complexity of the filter. In FIR filters, it specifies the number of time points in the signal that are used to compute the filter output (so higher order = more temporal smoothing). In IIR filters, it s more complicated, but higher order filters can quickly get unstable. Butterworth filter IIR filter that is maximally flat in the pass-band (no ripples). This means that the transition band is really wide. http://www.electronics-tutorials.ws/filter/fil57.gif Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 25

Summary By Multitapering we mean taking the average of several STFT on the same signal with orthogonal windows. This improves SNR at the cost of more smoothing. STFT, Wavelet and Hilbert can all be thought of as convolving the signal with complex oscillatory kernels. Which one you want to use depends on your requirements STFT by default has a fixed resolution across frequencies and enables multitapering Wavelets provide higher temporal resolutions for higher frequencies. Hilbert is flexible, as it gives complete control over filter design. Designing a good filter is difficult and always depends on your specific goals. The butterworth filter is a good general-purpose choice, as it has a flat pass-band. Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 26

Filtering of EEG data in SPM12 Daniel Renz, Short-time FFT, Multi-tapering & Filtering in SPM12 27