tag:blogger.com,1999:blog-7276377053120174333.post1991951051820388087..comments2024-03-06T23:41:22.520-05:00Comments on EEG Hacker: Live Spectrograms in Processing!Chiphttp://www.blogger.com/profile/10352943033779293161noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-7276377053120174333.post-33848824678919464232016-06-21T04:24:40.018-04:002016-06-21T04:24:40.018-04:00Hello. I am a college student and I need spectrogr...Hello. I am a college student and I need spectrogram for one of my projects. I downloaded the code from GitHub and I am running processing 2.2.1. I am getting error when trying to execute the code. It says 'Cannot find anything named "sendToSpectrogram"'. Can you help me please? <br />Thank YouAnonymoushttps://www.blogger.com/profile/16549096661631515024noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-58491984403569327732016-05-11T06:01:31.593-04:002016-05-11T06:01:31.593-04:00Hello Sir, I am also researching in looking at the...Hello Sir, I am also researching in looking at the EEG data, there is one question that is arising- Is spectrogram the best choice for analyzing eeg signals?Researcherhttps://www.blogger.com/profile/01820570018621170403noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-79036541138899957452014-01-05T09:08:44.307-05:002014-01-05T09:08:44.307-05:00Thanks to the pointers. I have used Wigner-Ville ...Thanks to the pointers. I have used Wigner-Ville Distribution (WVD) many times before in an attempt to get a higher-resolution time-frequency visualization. Unfortunately, unless the signal being analyzed has only a single component, I'm always disappointed by the results due to the cross-terms that result. The cross-terms are artifacts that do not reflect actual components that are in the signal. I hate those things. Even after applying smoothing techniques (like Gabor), I always end up going back to the STFT.<br /><br />STFT has visual artifacts, too. For example, really strong narrowband signals will appear to have sidebands, even when they're pure. These are minimized by using a windowing function such as Hanning. STFT will also have time-smearing that make really sharp events appear to start and end more gradually. Both of these artifacts are serious. It's only because I'm more familiar and comfortable with them that I prefer the STFT over the WVD (and Gabor). I guess that I just prefer the enemy that I know.<br /><br />But, back to your first point...yes, I agree that the swiss cheese behavior results from the transform being used. For the STFT, I believe that it is the length of the FFT versus the amount of overlap between FFT blocks that controls the appearance of the holes in the swiss cheese.Chiphttps://www.blogger.com/profile/10352943033779293161noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-13058536337132865302014-01-05T08:56:38.498-05:002014-01-05T08:56:38.498-05:00I work with spectrograms in many domains outside o...I work with spectrograms in many domains outside of EEG. I feel that I see this "swiss cheese" behavior everywhere that one has noisy signals. If you were to synthesize some noise (Gaussian white noise or whatever) and run it through a spectrogram, I think that you'd find this same kind of behavior. <br /><br />The particular size of the holes will have to do with the length of the FFT combined with the amount of overlap between successive FFTs. I've got quite a lot of overlap, so the "holes" are very smoothly rounded. If I had less overlap (or no overlap), the transition between "cheese" and "holes" would be very sharp and would visually remind you more of speckle or static, which would perhaps reinforce the interpretation that it is indeed a reflection of the underlying noisy activity.<br /><br />With that said, the "noise" that we're seeing can still be legitimate brain activity...I'm not implying that it is necessarily electronic noise. It could be legitimate brain activity because EEG can really only see the coordinated activity of relatively large sections of your cortex. There's no reason, though, that small regions of your brain couldn't be acting independently. When all of these little contributions are measured together at a given EEG location, it would be difficult to discern any structure in the overall signal, so it would appear as noise. It would still be legitimate brain activity despite having all the properties of noise.<br /><br />So, with the "swiss cheese" possibly reflecting legitimate brain activity, I will now keep a sharper eye in future recordings to see if the cheese exhibits different properties for different folks or for a given person under different test conditions.Chiphttps://www.blogger.com/profile/10352943033779293161noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-20286961976516020562014-01-05T01:15:06.636-05:002014-01-05T01:15:06.636-05:00Some interesting spectrogram examples comparing ST...Some interesting spectrogram examples comparing STFT Short Time Fourier Transform spectrograms to Gabor spectrograms. It's possible that the shape of our swiss cheese 'holes' are related to the transforms being used. In other words, some smearing of the image is due to the FFT windowing being done.<br /><br />STFT<br />http://zone.ni.com/reference/en-XX/help/371419D-01/lvasptconcepts/aspt_stft_spectrogram/<br /><br />Gabor<br />http://zone.ni.com/reference/en-XX/help/371419D-01/lvasptconcepts/tfa_gabor_spectrogram/<br /><br />Of course these fancier spectrograms are MUCH more compute intensive, so are rarely used in EEG work. But Val Brown does use them in his NeurOptimal software (Zengar).William J Crofthttps://www.blogger.com/profile/02830012893792978824noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-45265727067988327002014-01-05T00:31:03.293-05:002014-01-05T00:31:03.293-05:00I utilize the spectrograms with almost all of my n...I utilize the spectrograms with almost all of my neurofeedback work. And the format that Chip is using here is generally the most popular. (Two dimensional JTFA Joint Time Frequency Analysis.) National Instruments has an extensive toolbox in this area:<br /><br />http://www.ni.com/white-paper/3548/en/<br /><br />Here's question for us brainiacs: why do our EEG spectrograms frequently have areas that look like "swiss cheese", with the dark blue 'holes' surrounded by the light green 'cheese'? :-) This is very familiar to me, yet I think it is also demonstrating some deep operation characteristics of the frequency level communications used by brain. Certain bands of information transfer are "open" or active at any given moment in time and thus light up on the spectrogram. While other frequency domains stay dark and unused in those times.<br /><br />Why these inactive areas show this round hole shape, however, is still a mystery to me. It seems to imply that holes represent frequency domains that drop out and expand over time. Then "come back online" and fill in moments later. Curiouser and curiouser, said Alice.<br /><br />Is this spectrogram behavior seen in other fields besides EEG? I bet Jay Gunkleman would have an answer to this. I might ask him.<br />William J Crofthttps://www.blogger.com/profile/02830012893792978824noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-42788289946915182292014-01-01T13:41:17.713-05:002014-01-01T13:41:17.713-05:00Robert Thatcher at ANI has a number of papers onli...Robert Thatcher at ANI has a number of papers online on his Phase Shift, Phase Lock, Phase Reset measurement technologies. His current Z-score neurofeedback based on his normative database actually has norms for these metrics. And thus can include them as part of the Z-score training. See:<br /><br />http://www.appliedneuroscience.com/Articles.htmWilliam J Crofthttps://www.blogger.com/profile/02830012893792978824noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-69369257993122738172013-12-23T10:17:04.937-05:002013-12-23T10:17:04.937-05:00Hey Rob,
The traditional spectrum plot on the lef...Hey Rob,<br /><br />The traditional spectrum plot on the left has some time-smoothing built-in...precisely to enhance the ability to see EEG signals like Alpha and mu waves. For that purpose, the time-smoothing works great. Unfortunately, it also reduces the ability to see fine amplitude modulations that occur in time. That's the part that I like about these spectrograms...they expose the time-based modulations.<br /><br />Your ideas about looking at the phase behavior are sound. The difficulty with looking for phase "lock-in" is that the phase from an FFT is only constant if the true frequency of the signal is perfectly aligned with the center frequency of the FFT bin. If the true frequency is off a little, then the phase from the FFT starts wandering. If the true frequency is totally stable, just not at the center frequency, the FFT phase *rate* will be constant...which is something that we could exploit.<br /><br />To look for a consistent phase rate, you'll have to look at the first derivative of phase from FFT block to FFT block. I've done that before, and it is useful in some circumstances. Maybe it would be useful in this one, too. It does require quite a stable signal frequency, though, and I'm not sure that EEG signals are that stable.<br /><br />Perhaps a better approach would be to use tow (or more) sensing electrodes spaced around the back of the head. Because eyes-closed alpha waves are widely distributed and because they are indicative of wide areas of your brain getting in sync, the alpha waves measured by the different electrodes should be exactly the same frequency in all electrodes. Depending on what is the source of the EEG "noise", the noise may or may not be the same in all electrodes. We can exploit this difference, and hopefully enhance just the Alpha waves, by looking for just those signals that are coherent between the two electrodes. This should cause the Alpha waves to "pop" right out.<br /><br />But, to do that, I'd need to put more electrodes on my head. And that EEG paste is icky. I guess that I'll just have to man up....for SCIENCE!<br /><br />ChipChiphttps://www.blogger.com/profile/10352943033779293161noreply@blogger.comtag:blogger.com,1999:blog-7276377053120174333.post-61516511623636366462013-12-23T08:34:40.903-05:002013-12-23T08:34:40.903-05:00Interesting. Intuitively, I would think expect tha...Interesting. Intuitively, I would think expect that the spectograms on the right would yield much clearer peaks on the left... it seems like the left plot has a similar SNR to a single vertical "slice" of the spectogram. Averaging across all of those slices, I'd expect the peak to be much higher relative to the noise.... of course, log plots and jet color maps make it hard to analyze... :) <br /><br />I assume that the spectrograms show PSD. is there some measure of "phase lock-in" for alpha- and mu-waves that would not be present in background electrical noise? e.g., if we had a plot of phase next to the spectrogram, would it vary linearly for the alpha waves, and randomly for the rest? If so, are you taking that into account (e.g., by FFTing the entire timeseries at once instead of just summing the PSDs in the spectrogram)? Or, perhaps I have my math wrong...Anonymoushttps://www.blogger.com/profile/03498524091437167547noreply@blogger.com