Band pass filtering and the Hilbert transform

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

SIGNAL PROCESSING & SIMULATION NEWSLETTER

PYKC Jan Lecture 1 Slide 1

Lock - in Amplifier and Applications

SGN-1158 Introduction to Signal Processing Test. Solutions

Em bedded DSP : I ntroduction to Digital Filters

What you will do. Build a 3-band equalizer. Connect to a music source (mp3 player) Low pass filter High pass filter Band pass filter

Introduction to Digital Audio

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

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

The Calculation of G rms

FAST Fourier Transform (FFT) and Digital Filtering Using LabVIEW

Introduction to Digital Filters

The continuous and discrete Fourier transforms

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

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

Lecture - 4 Diode Rectifier Circuits

A few words about imaginary numbers (and electronics) Mark Cohen

Digital filter design for electrophysiological data a practical approach

8 Filtering. 8.1 Mathematical operation

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

Positive Feedback and Oscillators

See Horenstein 4.3 and 4.4

Computational Foundations of Cognitive Science

ε: Voltage output of Signal Generator (also called the Source voltage or Applied

Signal Processing First Lab 01: Introduction to MATLAB. 3. Learn a little about advanced programming techniques for MATLAB, i.e., vectorization.

PHASOR DIAGRAMS HANDS-ON RELAY SCHOOL WSU PULLMAN, WA. RON ALEXANDER - BPA

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

Analog and Digital Signals, Time and Frequency Representation of Signals

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Transition Bandwidth Analysis of Infinite Impulse Response Filters

Obtaining Knowledge. Lecture 7 Methods of Scientific Observation and Analysis in Behavioral Psychology and Neuropsychology.

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

Analog signals are those which are naturally occurring. Any analog signal can be converted to a digital signal.

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

Sampling Theory For Digital Audio By Dan Lavry, Lavry Engineering, Inc.

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

Frequency Response of Filters

Design of FIR Filters

Lecture 1-6: Noise and Filters

Lecture 8 ELE 301: Signals and Systems

The Fourier Analysis Tool in Microsoft Excel

Applications of the DFT

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

A DESIGN OF DSPIC BASED SIGNAL MONITORING AND PROCESSING SYSTEM

Convolution. The Delta Function and Impulse Response

Diode Applications. As we have already seen the diode can act as a switch Forward biased or reverse biased - On or Off.

More Filter Design on a Budget

Rectifier circuits & DC power supplies

T = 1 f. Phase. Measure of relative position in time within a single period of a signal For a periodic signal f(t), phase is fractional part t p

Harmonics and Noise in Photovoltaic (PV) Inverter and the Mitigation Strategies

EDEXCEL NATIONAL CERTIFICATE/DIPLOMA UNIT 5 - ELECTRICAL AND ELECTRONIC PRINCIPLES NQF LEVEL 3 OUTCOME 4 - ALTERNATING CURRENT

Lecture 14. Point Spread Function (PSF)

Analog Filters. A common instrumentation filter application is the attenuation of high frequencies to avoid frequency aliasing in the sampled data.

CIRCUITS LABORATORY EXPERIMENT 3. AC Circuit Analysis

Lab 1: The Digital Oscilloscope

ANALYTICAL METHODS FOR ENGINEERS

Computer Networks and Internets, 5e Chapter 6 Information Sources and Signals. Introduction

Analysis/resynthesis with the short time Fourier transform

Implementation of Digital Signal Processing: Some Background on GFSK Modulation

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 46 Per-pin Signal Generator

SWISS ARMY KNIFE INDICATOR John F. Ehlers

The Membrane Equation

Introduction to Receivers

Aliasing, Image Sampling and Reconstruction

Time series analysis Matlab tutorial. Joachim Gross

Transmission Line Terminations It s The End That Counts!

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

MODULATION Systems (part 1)

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

Introduction to IQ-demodulation of RF-data

Binary Adders: Half Adders and Full Adders

Trigonometric functions and sound

Technical Note #3. Error Amplifier Design and Applications. Introduction

PCM Encoding and Decoding:

Convention Paper Presented at the 112th Convention 2002 May Munich, Germany

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

EXPERIMENT NUMBER 5 BASIC OSCILLOSCOPE OPERATIONS

Spike-Based Sensing and Processing: What are spikes good for? John G. Harris Electrical and Computer Engineering Dept

Constructing a precision SWR meter and antenna analyzer. Mike Brink HNF, Design Technologist.

Doppler. Doppler. Doppler shift. Doppler Frequency. Doppler shift. Doppler shift. Chapter 19

Auto-Tuning Using Fourier Coefficients

B3. Short Time Fourier Transform (STFT)

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Electronic Circuits Spring 2007

MICROPHONE SPECIFICATIONS EXPLAINED

FFT Algorithms. Chapter 6. Contents 6.1

BSEE Degree Plan Bachelor of Science in Electrical Engineering:

PHYS 331: Junior Physics Laboratory I Notes on Noise Reduction

Op-Amp Simulation EE/CS 5720/6720. Read Chapter 5 in Johns & Martin before you begin this assignment.

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

DCMS DC MOTOR SYSTEM User Manual

Precision Diode Rectifiers

Filter Design in Thirty Seconds

Experimental Modal Analysis

(Refer Slide Time: 2:03)

Agilent Time Domain Analysis Using a Network Analyzer

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

CHAPTER 3: DIGITAL IMAGING IN DIAGNOSTIC RADIOLOGY. 3.1 Basic Concepts of Digital Imaging

Reading: HH Sections , (pgs , )

Transcription:

Band pass filtering and the Hilbert transform Computational Psychiatry Seminar, Signal Processing 2015 Jakob Heinzle heinzle@biomed.ee.ethz.ch Translational Neuromodeling Unit (TNU) Institute for Biomedical Engineering (IBT) University and ETH Zürich All images (unless referenced otherwise) are from Chapter 14 of MX Cohen s book and Chapter 12 of S Luck s book. Translational Neuromodeling Unit

Looking at brain music? We want to understand brain signals! A very useful way to look at brain signals is to represent the signal in frequency space analogous to oscillations with a frequency, amplitude (power) and phase (lag). Adapted from slides by F. Petzschner Filtering and Hilberting of EEG data 2

What have we done so far? Fourier Transform: Representation in frequency space Temporal resolution completely lost. Morlet Wavelets: Complex representation of signal analytical signal Frequency information (not so precise) Temporal resolution (not so precise) Filtering and Hilberting of EEG data 3

Overview Introduction to Hilbert transform and analytic function Examples and intuition about the Hilbert transform Introduction to filtering Examples and intuition about filtering and interpretation of filtered data. Filtering and Hilberting of EEG data 4

Hilbert transform Hilbert Transform: Allows for extension of signal into complex plane. Analytic signal that has both amplitude and phase. Powerful tool together with filtering Filtering and Hilberting of EEG data 5

What does the Hilbert transform do? Why do we want to use it? Extends a real valued signal to the complex plan, by adding a complex part. For the math lovers: It s the unique (up to a constant) extension of a real valued signal to a holomorphic (Cauchy-Riemann criterion) function. Having a complex valued function is useful because many mathematical details are much easier, e.g., reading the phase and amplitude information (c.f. Wavelet lecture) The Hilbert transform does not add anything new to the data, all could be done with real valued methods as well. Filtering and Hilberting of EEG data 6

A simple example cosine function HH cos(ωωtt) = sin(ωωtt) Analytic signal of Mcos ωωtt is: Mcos(ωt) + imsin(ωωtt) Filtering and Hilberting of EEG data 7

Brief recap: Complex numbers http://betterexplained.com/articles/a-visual-intuitive-guide-to-imaginary-numbers/ Filtering and Hilberting of EEG data 8

Simple matlab demo So, how does this look like? Filtering and Hilberting of EEG data 9

Movie illustration Filtering and Hilberting of EEG data 10

Math slide 1: Hilbert transform Definition: p.v. (Cauchy principle value) Some properties: HH HH uu tt = uu(tt) HH uu (tt) = 1 ππ HH 1 = HH uu(ττ) pp. vv. tt ττ ddττ Relation to Fourier transform: F HH uu ωω = ( ii ssssssss(ωω))f uu (ωω) Method used to calculate H in MX Cohen s book. Analytic signal: yy tt = uu tt + iiii[uu](tt) Filtering and Hilberting of EEG data 11

Hilbert Summary Extends a real valued signal to the complex plan, by adding a complex part. Works on the entire signal, but is mostly applied to band-pass filtered data. Alternative to wavelets. It allows for more control on the filter properties (although one could create wavelets with the desired filter properties.) There is many ways to compute the Hilbert transform in Matlab, e.g. hilbert() Filtering and Hilberting of EEG data 12

Know what you do and what you expect to happen with (artificial) data Matlab s hilbert() works on columns, not rows!!! We regret that there was an error in the analytic code used to compute oscillatory power in our article. Specifically, there was a matrix transposition error in the code (see abs(hilbert(eegfilt(data,fs,f1,f2))) on page 7588, right column, end of second full paragraph). The data matrix was oriented correctly for the call to eegfilt, but the output of the call to eegfilt was not correctly transposed in the standard Matlab format before passing into the built-in Matlab hilbert function, as the EEGLAB function eegfilt and the built-in Matlab function hilbert require the data matrix to have different dimensions in order to operate correctly across time. (The Journal of Neuroscience, 2015; 35(6): 2838) Filtering and Hilberting of EEG data 13

Hilbert questions The speaker first Which of the following statements are true/false or need discussion: The Hilbert transform increases the dimensionality of the data. The Hilbert transform enables analyses which are otherwise not possible. The Hilbert transformed data allows us to easily calculate the instantaneous frequency. Filtering and Hilberting of EEG data 14

Hilbert questions The audience Filtering and Hilberting of EEG data 15

Why filtering? Filtering in a nutshell Filtering is used to extract/eliminate certain features from the data. How? In fact, filtering is nothing but clever averaging of the signal. Filtering and Hilberting of EEG data 16

Filtering is nothing but averaging Filtering and Hilberting of EEG data 17

But, we can be a bit clever about it tt 2xx xx ff tt = ττ WW tt + ττ dddd tt 1 Usually the averaging is performed as convolution with a filter kernel K, the so called impulse response function. tt 2xx xx ff tt = ττ KK tt ττ dddd tt 1 Filtering and Hilberting of EEG data 18

and even more clever (with the help of Monsieur Fourier) Filtering and Hilberting of EEG data 19

Illustration of fourier and filtering Filtering and Hilberting of EEG data 20

Filtering via the Fourier transform ERP example Filtering and Hilberting of EEG data 21

Math slide 2: Convolutions and filters Convolution with Impulse response function KK tt : xx ff tt = xx ττ KK tt ττ dddd Multiplication with Frequency response function KK ωω : xx ff ωω = xx ωω KK ωω Where ^ denotes the Fourier transform Causal filters KK tt = 0 if tt < 0 Sharp edges in one domain, result in a lot of leak in the other domain!! Filter design Filtering and Hilberting of EEG data 22

Definitions: Length of filter in time Finite impulse response (FIR) filter Restricts the effect of an event, data point, to a finite time window. Infinite impulse response (IIR) filter Allows for infinite time effects of single events, data points. Disclaimer: The term FIR is often used differently in dynamical systems and it might be more correct to adopt the terminology of MX Cohen and talk about. Time domain filter kernel and Frequency domain filter kernel In this talk, FIR and filter kernel are used interchangeably. Filtering and Hilberting of EEG data 23

Definitions: Frequency pass properties Low pass filter Lets low frequencies pass, attenuates high frequencies High pass filter Lets high frequencies pass, attenuates low frequencies. Band pass filter Lets intermediate frequencies pass, attenuates others. Band stop filter Attenuates intermediate frequencies, lets others pass. Filtering and Hilberting of EEG data 24

Causal filters Definitions: Causality Ensures causality, i.e., there is no leak of signal into the past. This means that the impulse response is 0 for negative time. Non-causal filters Does not respect causality, i.e., there can be leak of signal into the past. This means that the impulse response is non-zero for negative time. Causal or not? Filtering and Hilberting of EEG data 25

Analog filters Definitions: Analog vs. digital Filters that are built with electronic circuits, e.g. capacitances, resistors and solenoids. Analog filters are always causal! Digital filters Filters that are implemented on computer. Are much more flexible and might be non-causal! Images: www.wikipedia.org Filtering and Hilberting of EEG data 26

In the rest of this lecture we will focus on digital, FIR filters and look at different filter properties and causality. 1) We try to develop an intuition for filters. 2) We have a look at some Matlab examples using the firls() function. Filtering and Hilberting of EEG data 27

Comparing filtering and Morlet wavelets Filtering and Hilberting of EEG data 28

Notch filters Filtering and Hilberting of EEG data 29

Low pass filters Filtering and Hilberting of EEG data 30

Creating a high pass filter in the time domain Just take the difference between a non-filter (unity) and a low-pass filter. Filtering and Hilberting of EEG data 31

High pass filter Filtering and Hilberting of EEG data 32

Causal vs. non-causal filters Filtering and Hilberting of EEG data 33

Be aware Filters can do stuff to your data (not all of it very intuitive) that can influence your conclusions. E.g. about causality. Filtering and Hilberting of EEG data 34

Designing filters with Matlab(with firls) Filtering and Hilberting of EEG data 35

What is the best filter? Filter design is an art on its own. There is no perfect filter. A chosen filter always has its pros (hopefully) and cons (for sure). Filter design is not the topic today! Filtering and Hilberting of EEG data 36

But let s do some filtering in Matlab Filtering and Hilberting of EEG data 37

But let s do some filtering in Matlab Amplitude of filter Define relevant frequencies Compute IRF and filter data: Filtering and Hilberting of EEG data 38

Band pass Filtering and Hilberting of EEG data 39

Band stop Filtering and Hilberting of EEG data 40

High pass Filtering and Hilberting of EEG data 41

Low pass Filtering and Hilberting of EEG data 42

Look at your filters Filtering and Hilberting of EEG data 43

and at the results of your pipeline Feed your filtering Hilbert pipeline with artificial data, where you know what you should get. e.g. the sum of two sinusoids, with one frequency that should be suppressed and one that should pass. Filtering and Hilberting of EEG data 44

Recipe for an analysis using the Hilbert transform. Remove very low and very high frequencies using high and low pass filters. For a series of bands use a band pass filter followed by a Hilbert transform to extract instantaneous phase or frequency. Filtering and Hilberting of EEG data 45

Filtering summary Filtering is nothing but clever (weighted) averaging. In the Fourier domain, filtering consists of using multiplication to select a suitable set of frequencies. Filtering is an art on its own. Filters can introduce artefacts. Filtering and Hilberting of EEG data 46

Fundamental Principle of Frequency-Based Analyses Power at a given frequency does not mean that the brain was oscillating at that frequency. Luck (2014), Chapter 12 Filtering and Hilberting of EEG data 47

Filtering helps seeing oscillations Filtering is like putting on very specific glasses that let through only the red and yellow light and it will always be autumn when you look at a forest! Filtering and Hilberting of EEG data 48

Filter questions The speaker first Does the peak of a waveform change, when applying a symmetrical/causal filter? What filter would you use? if you want to detect the earliest onset of activity after stimulation if you want to analyze sleep slow waves (2-5 Hz) Does filtering only change the power/amplitude or the phase as well? Filtering and Hilberting of EEG data 49

Filter questions The audience Thank you for your attention! Filtering and Hilberting of EEG data 50

The last slide The End All images (if not referenced otherwise) are from Chapter 14 of MX Cohen s book and Chapter 12 of S Luck s book. Filtering and Hilberting of EEG data 51