# [Eeglablist] [External] Re: Frequency-time spectrogram deconstruction

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Thu Jan 10 15:57:48 PST 2019

```Dear Panos,

> 1) In addition to calculating the average absolute power (as your script
nicely shows), I was also interested in calculating the average absolute
(and relative) power at binned time intervals (e.g. avg power between
0-1sec, avg power between 1-2sec, etc) within the dataset. I tried to use
the "spectra" output from spectopo but from what I gather it comes up with
[(sampling rate)/2 + 1] points rather that one power-spectral point per
timepoint. How would you recommend that I proceed?

You can repeatedly apply EEGLAB spectopo() function to perform hand-made
short-term Fourier transform (STFT), but alternatively you might want to
use either EEGLAB newtimef() or Matlab spectrogram() function (the latter
may require some additional Toolbox). The output will be frequency x time
matrix. The interval of time bins needs to be calcualted. Basically,
{(length of data) - (sliding window length)}/(number of steps) gives you
the interval (step size). Adjust the (number of steps) so that you can
obtain the desired interval.

> 2) Is there a way to display how do topographic maps (scalp heat maps)
change with time (I'm able to see how they change with different
frequencies but I was interested in seeing how they also change with time)?
Would the function timtopo be the best way to do that?

See this wiki page.
https://sccn.ucsd.edu/wiki/Chapter_02:_Writing_EEGLAB_Scripts#Creating_a_scalp_map_animation

> 3) A more general question:  If I write a matlab script that I would like
to apply on a bunch of datasets (which in my case are just epochs of
different lengths that I have extracted from my original dataset), should I
put all said datasets  (which I have already pre-processed and applied ICA
on) in a STUDY set and then apply the script there, or should I just write
a for loop in matlab and apply the script in each individual dataset? In
other words, does the STUDY set offer an advantage in this case?  (I
apologize for the potential triviality of this one!)

If you are a beginner, it is always a good idea to make things as simple as
possible. I recommend you organize your own code to loop the single-subject
process for all the subjects. After all, that's the only to learn the
process!

Makoto

On Wed, Jan 9, 2019 at 11:47 AM Fotiadis, Panagiotis <

> Hi Makoto,
>
>
> Thank you for the really great advice! The two links you provided are
>
>
> I had a few follow-up questions:
>
> 1) In addition to calculating the average absolute power (as your script
> nicely shows), I was also interested in calculating the average absolute
> (and relative) power at binned time intervals (e.g. avg power between
> 0-1sec, avg power between 1-2sec, etc) within the dataset. I tried to use
> the "spectra" output from spectopo but from what I gather it comes up with
> [(sampling rate)/2 + 1] points rather that one power-spectral point per
> timepoint. How would you recommend that I proceed?
>
>
> 2) Is there a way to display how do topographic maps (scalp heat maps)
> change with time (I'm able to see how they change with different
> frequencies but I was interested in seeing how they also change with time)?
> Would the function timtopo be the best way to do that?
>
>
> 3) A more general question:  If I write a matlab script that I would like
> to apply on a bunch of datasets (which in my case are just epochs of
> different lengths that I have extracted from my original dataset), should I
> put all said datasets  (which I have already pre-processed and applied
> ICA on) in a STUDY set and then apply the script there, or should I just
> write a for loop in matlab and apply the script in each individual dataset?
> In other words, does the STUDY set offer an advantage in this case?  (I
> apologize for the potential triviality of this one!)
>
>
>
>
> Best,
>
> Panos
>
>
>
> PhD Student | Neuroscience Graduate Group
>
> Perelman School of Medicine, University of Pennsylvania
> ------------------------------
> *From:* Makoto Miyakoshi <mmiyakoshi at ucsd.edu>
> *Sent:* Monday, January 7, 2019 2:48:37 PM
> *Cc:* eeglablist at sccn.ucsd.edu
> *Subject:* [External] Re: [Eeglablist] Frequency-time spectrogram
> deconstruction
>
> Dear Panos,
>
> Welcome to the time-frequency world.
>
> > Would I just need to bandpass filter my post-processed EEG signal to
> each frequency range of interest (i.e., alpha: 8-12Hz etc) and then plot
> the remaining EEG signal over time, or is there another way to do this?
>
> That's one way to go. Nothing is wrong with that!
>
> More convenient and established way to go is to perform time-frequency
> transform using short-term Fourier transform or Wavelet transform. Google
> EEGLAB time-frequency and you'll find many of our past workshop materials.
> For example, see Slide 21 of this file
>
>
> You can also obtain bin-mean values from power spectral density. See
> below.
>
> https://sccn.ucsd.edu/wiki/Makoto's_useful_EEGLAB_code#How_to_extract_EEG_power_of_frequency_bands
>
> Makoto
>
> On Mon, Jan 7, 2019 at 1:34 AM Fotiadis, Panagiotis <
>
> Hello,
>
>
> I am fairly new to EEGLab and I had a question concerning the
> deconstruction of my EEG signal into its alpha/beta/theta/delta
> sub-components:
>
>
> After pre-processing some subjects with EEG data from 128 channels and
> performing ICA (using runica), I used eeglab and chronux to plot the
> power/frequency and frequency/time spectrograms of several epochs of
> interest.
>
>
> Is there a way to extract the alpha/beta/theta/delta frequencies of those
> epochs and quantify when they occur in time? I can visualize when each type
> of neuronal oscillation occurs by looking at the overall
> frequency/time spectrogram, but I was wondering whether there was a more
> robust way to actually plot each type of oscillation separately and/or
> quantify when it occurs.
>
>
> Would I just need to bandpass filter my post-processed EEG signal to each
> frequency range of interest (i.e., alpha: 8-12Hz etc) and then plot the
> remaining EEG signal over time, or is there another way to do this?
>
>
>
>
> Best,
>
> Panos
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
>
>
> --
> Makoto Miyakoshi
> Swartz Center for Computational Neuroscience
> Institute for Neural Computation, University of California San Diego
>

--
Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20190110/bd715741/attachment.html>
```