<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Stephen, </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
That is great Stephen. Thanks for the tips, helpful advises and guidelines. I will go through the links and watch the videos </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
My project is basically a group of generalized epilepsy patients and trying to study their outcomes. One of the variables I am planning to look at is PSD of the epileptiform discharges but it turns out to be abit more trickier given the variability in duration
 of the spike/waves in each patients, visual variety of the signal during discharge, different noise levels, different burden of spike/wave in a standard routine EEG and the many methods and toolboxes out there e.t.c. So ideally am aiming for standardized way
 where I can end up extracting <i>accurately</i> a mean single value frequency of the spike/wave discharges for each patient (probably the slow frequency components of the discharge) and a mean spectral power of those (most importantly the method is standardized
 for all patients for eventual stat comparisons between cases and controls). At this stage I am trying different things but finding a reference as to what would be best.  I am using default parameters in the various toolboxes but dont know if they are the best
 for my project. This is summary of one of the variable for the project. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Mubeen  </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> fieldtrip <fieldtrip-bounces@science.ru.nl> on behalf of Stephen Whitmarsh <stephen.whitmarsh@gmail.com><br>
<b>Sent:</b> Thursday, February 18, 2021 9:59 AM<br>
<b>To:</b> FieldTrip discussion list <fieldtrip@science.ru.nl><br>
<b>Subject:</b> Re: [FieldTrip] best parameters for wavelet convolution.</font>
<div> </div>
</div>
<div>
<div dir="ltr">Dear Mubeen,
<div><br>
</div>
<div>1) My short answer would be:</div>
<div><br>
</div>
<div>a) There are very good "Fieldtip Lectures" on the topic that addresses questions of frequency resolution and time-windows in general and which would be a good place to start. </div>
<div>There are several people presenting nearly the same slides, so you can take a pick based on flavour, e.g.:</div>
<div><a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQLvsa1r1Voc&data=04%7C01%7C%7Ca99c76b4039b4019b01508d8d3de8d7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637492300122594032%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=gMqhkirYC00d1rIKYg4OMVnR6W5tAJSswe6faRmvTpE%3D&reserved=0" originalsrc="https://www.youtube.com/watch?v=QLvsa1r1Voc" shash="tAipOZeyuEgJTN8YGCa4mUGpf3qpB7CvvFpgCDyKVvURqoCAmYWEt57x8iUYEnlTwtdn249bnbMJTPjOfkcB4FIPN6pIkS5gTwXTuzWJgC8ir0ttgT/exrFUq9ovNcfSbTeIXMVWkAJsc5aN5Ajbe+sAQTSAeTAajQ8h7gEYm6M=">https://www.youtube.com/watch?v=QLvsa1r1Voc</a><br>
</div>
<div><a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvwPpSglPJTE&data=04%7C01%7C%7Ca99c76b4039b4019b01508d8d3de8d7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637492300122604024%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=18jOdjrm9yB5Q1yOQKnj%2F6NSoNvUWAU4XMa19lYiXvk%3D&reserved=0" originalsrc="https://www.youtube.com/watch?v=vwPpSglPJTE" shash="LJttau+IQqfJ2tOiDz/2AAFohXVHBRlRypIJebrsqee8Eqs+NDH8mgz7jZ3FcQlhTibfMEQ/taS2Np+mlcIVuo+wHL2275HOO3FEJAXnsuYD1lovQnjTzPVgYYUStHIIN3jquVFzYMjyDFIVoYnajhRzZ6VzYOqp753L/bCcQFg=">https://www.youtube.com/watch?v=vwPpSglPJTE</a><br>
</div>
<div><a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdHTuzMsjVJA&data=04%7C01%7C%7Ca99c76b4039b4019b01508d8d3de8d7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637492300122604024%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ifrp57mVWxsQAL%2FG5NsLEPJLVDBLiQNmPw6HYxzWBDk%3D&reserved=0" originalsrc="https://www.youtube.com/watch?v=dHTuzMsjVJA" shash="Iyt1w3DE2MnnSwGqWqF+WlGbyOQzb8y8OK6SsprkemKKUxxKh24j5a0E1eAovu5JxBtFrpTRThbMKkTl4c9wHH1fyYCjwHuLXPyFBmrm/AAF8zxXwS2ZITL95DlH4t5jLzwCFtXUkh4W7ojzLdGU62w4Meyh8dY0Uw/6eXgtzvQ=">https://www.youtube.com/watch?v=dHTuzMsjVJA</a><br>
</div>
<div><br>
</div>
<div>b) If you really want to estimate power changes *over time*, using wavelets is one way, and using tapered sliding time-windows using FFT is another ('cfg.method = 'mtmconvol'). The latter allows you even more freedom in how much you want to smooth over
 frequencies (see lectures for explanation of "multi tapering").</div>
<div><br>
</div>
<div>d) Your question suggests, however, that you would like to capture the 1-4Hz peaks in SWDs *averaged over time*. For this you would not necessarily need a time-resolved frequency estimate, right? E..g. an averaged FFT done on each segment might suffice
 and be more to the point. Wavelets do not come into play then. Correct me if I'm wrong! Perhaps doing a peak detection on the spikes - and calculating the inter-spike intervals - might be another approach.<br>
</div>
<div><br>
</div>
<div>c) If you are set on doing a time-resolved spectral analysis, then you will probably be able to see broad-band high-frequency power associated with the SWD peaks. However, to accurately estimate power at lower frequencies, especially as low as 1Hz, you
 might need time-widows of over a second (e.g. 3 seconds if you want to base it on 3 cycles of 1Hz, which would be a bare minimum). So you might not be able to resolve those low frequencies over time. Again, I think the lecture might clarify this point, and
 I am not sure you are asking for time-resolved analysis.<br>
</div>
<div>
<div><br>
</div>
<div>d) Feel free to experiment with different parameters, this will give you a sense of the data and limits of frequency analyses, and the effect of certain parameters. In the end it also depends on how stationary the spectral content of the signal is, which
 is sometimes hard to determine a-priori.</div>
<div><br>
</div>
<div>e) Wavelets can be easily used in a way that creates far more data than necessary, e.g. by resolving at every sample, instead of in e.g. steps of tens of milliseconds. So you might want to keep memory usage and CPU time in mind. A bit of experimentation
 might help you set parameters that are "good enough" but don't overload your computer's resources.</div>
<div></div>
</div>
<div><br>
</div>
<div>2a) Baseline normalization of the timecourses is a good idea before frequency analysis:</div>
<div><a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ffaq%2Fwhy_does_my_tfr_look_strange%2F&data=04%7C01%7C%7Ca99c76b4039b4019b01508d8d3de8d7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637492300122604024%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=jDaHyILSjGk%2Bm0FGZ2dIC2hCh3dXDyTilymwO0A5Rc0%3D&reserved=0" originalsrc="https://www.fieldtriptoolbox.org/faq/why_does_my_tfr_look_strange/" shash="VoOFU5Bn0O0TNai0HjY0Vxssm+ADC4ge/dWgThk/pEiIW29wL4TBVLPzBLxxvahz/mEexkjDjuw6hiNpq5eYpAUfiQ1H1Kgzi6WC1m1KRjKBf/bduu30t5el4svQweAwVJEJS9uLTjK1AKxLlDEsTVrsmzwxDDlxQlVKMTMH808=">https://www.fieldtriptoolbox.org/faq/why_does_my_tfr_look_strange/</a><br>
</div>
<div><br>
</div>
<div>2b) Baseline normalization of the time-resolved power estimates can only be done
<i>after </i>doing the spectral estimates, right? If/when depends on the reason you want to do so though. For exploring and plotting, note that you can do it 'on the fly' in FieldTrip's plotting functions.<br>
</div>
<div> </div>
<div>Anyway, that's the 'short' answer. I might be able to say more if I know more about the goal of the frequency analysis of PWDs (with which I am somewhat familiar). And check the videos!</div>
<div><br>
</div>
<div>Happy fieldtripping,</div>
<div>Stephen</div>
<div><br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">Op do 18 feb. 2021 om 07:10 schreef mubeen afzal <<a href="mailto:mubafzal@hotmail.com">mubafzal@hotmail.com</a>>:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi all,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am aiming to calculate average spectral values for segment of EEG containing spike/wave discharges in patients which can last anywhere between 0.5 seconds to 6 seconds. I am planning on morlet wavelet convolution but am unsure what the best parameters would
 be in terms of width/cycles/timewin of the morlet configurations. Typically these spike/waves on visual inspection are anywhere between 1hz to more commonly between 3-4 Hz or less often 5 hz frequency discharges. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<ol>
<li>What would be the best parameters for a wavelet convolution?</li></ol>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
 2. is baseline normalization usually done before spectral analysis or can it be done after? </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Any help would be highly appreciated. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Mubeen J </div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=04%7C01%7C%7Ca99c76b4039b4019b01508d8d3de8d7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637492300122614021%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8otdqQyPbfmub8lSukcvvp%2BOY3e0QVtCd3Lh%2BueoyeM%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="q+xOQIUeuvJQ7Yh6Q5BP6QK54uAnEozfphSrGYXqFAm27gvGhxGBDxKJd2yuxGNbCyvVipSsw9vBHCJOlzZLN6S2Ety7AHVNWnkf2t+qWmFMlyxZ0UV7emvBFjQl/VpbJ+dJmDkN5cIoX2ZqoRI8im6LBvfxAx+0nCA9SySIZ6I=" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=04%7C01%7C%7Ca99c76b4039b4019b01508d8d3de8d7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637492300122614021%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8vqE8vg4gvFZxWRwuHxg%2BE0o5a0RyDzN%2FlzfTRPH2Ic%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="sRl8ud3G7oJ7G8BWYlkoZNruL84FPfnvIegWsgd/+ANkrjAk+Sdxkzf3s9OMff5MIAQi7tayjfNtNNyARVxe+irZDB3lPjz4TksbFr05MjJfNCuMRoQ4BIzq7lYapAlO3q1sAr5i/pMfPa3tC4AvaWxqbywKdjQjtJUL4sL82A8=" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote>
</div>
</div>
</div>
</body>
</html>