[Mne_analysis] Need Help to do Cross Spectral Density Analysis

MD KHORSHED ALAM khorshed.alam at live.iium.edu.my
Mon Jan 15 07:12:24 EST 2018
Search archives:

MD KHORSHED ALAM has shared OneDrive for Business files with you. To view them, click the links below.


<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=1eb6a280061744ca9b705f4ea7b58128c&authkey=AQMmGyPVIA7Pz9jbPOIViSE>
[https://r1.res.office365.com/owa/prem/images/dc-generic_20.png]<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=1eb6a280061744ca9b705f4ea7b58128c&authkey=AQMmGyPVIA7Pz9jbPOIViSE>

sample_audvis_raw-eve.fif<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=1eb6a280061744ca9b705f4ea7b58128c&authkey=AQMmGyPVIA7Pz9jbPOIViSE>

<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=16a9797e124604875abf52b5a1d0b3bfb&authkey=ARQ9cXRvtDNUYl_mOx9IeGU>
[https://r1.res.office365.com/owa/prem/images/dc-generic_20.png]<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=16a9797e124604875abf52b5a1d0b3bfb&authkey=ARQ9cXRvtDNUYl_mOx9IeGU>

sample_audvis_raw-trans.fif<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=16a9797e124604875abf52b5a1d0b3bfb&authkey=ARQ9cXRvtDNUYl_mOx9IeGU>

<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=19e95cbf189a04d5cbea46a2a5ee09173&authkey=AQxxQosHzzo84psAkGe5dR0>
[https://r1.res.office365.com/owa/prem/images/dc-generic_20.png]<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=19e95cbf189a04d5cbea46a2a5ee09173&authkey=AQxxQosHzzo84psAkGe5dR0>

sample_audvis_raw.fif<https://liveiiumedu-my.sharepoint.com/personal/khorshed_alam_live_iium_edu_my/_layouts/15/guestaccess.aspx?docid=19e95cbf189a04d5cbea46a2a5ee09173&authkey=AQxxQosHzzo84psAkGe5dR0>




Hi Clemens,


Please here is the scripts:

import mne
import numpy as np
import os
import matplotlib
from mne.datasets import sample
from mne.time_frequency import csd_epochs, csd_array
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(raw_fname, preload=True, verbose=None )
eeg_channels=raw.pick_types(meg=False, eeg=True, stim=False, eog=False, ecg=False, emg=False, ref_meg='auto', misc=False, resp=False, chpi=False, exci=False, ias=False, syst=False, seeg=False, dipole=False, gof=False, bio=False, ecog=False, fnirs=False, include=(), exclude='bads', selection=None)
raw=raw.filter(l_freq=0.5, h_freq=35.0, picks=None, filter_length=10, l_trans_bandwidth='auto', h_trans_bandwidth='auto', n_jobs=1, method='fir', iir_params=None, phase='zero', fir_window='hamming', fir_design=None, pad='edge', verbose=None)
mne.compute_proj_raw(raw, start=0, stop=None, duration=1, n_grad=0, n_mag=0, n_eeg=5, reject=None, flat=None, n_jobs=1, verbose='INFO')
events = mne.find_events(eeg_channels, stim_channel='STI 014')
event_id = dict(aud_l=1, aud_r=2, vis_l=3, vis_r=4, smiley=5, button=32)
epochs = mne.Epochs(eeg_channels, events=events, event_id=event_id, tmin=-0.2, tmax=0.5, proj=True, baseline=(None, 0), preload=True)
mne.time_frequency.csd_epochs(epochs, mode='multitaper', fmin=0.0, fmax=35.0, fsum=False, tmin=-0.2, tmax=0.5, n_fft=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, projs=None, verbose=None)
X=epochs['aud_l', 'aud_r', 'vis_l', 'vis_r', 'smiley', 'button'].get_data()
mne.time_frequency.csd_array(X, sfreq=600.614990234375, mode='multitaper', fmin=0.0, fmax=35.0, fsum=False, n_fft=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, verbose=None)

I am just starting work with MNE Python and practicing with online available MNE data-set.

Please refer attached.



Thanks With Warm Regards,

MD. KHORSHED ALAM (Shishir)

Graduate Research Assistant (GRA)

Center of Intelligent Signal and Imaging Research (CISIR)
Department of Electrical and Electronic Engineering
Universiti Teknologi PETRONAS
Bandar Seri Iskandar
32610 Tronoh
Perak Darul Ridzuan
Malaysia

Mobile no: +60176459080
Email ID: khorshed.alam at live.iium.edu.my<mailto:khorshed.alam at live.iium.edu.my>
Alternative :shishir_lmu at yahoo.com<mailto:shishir_lmu at yahoo.com>, alam.0213 at gmail.com<mailto:alam.0213 at gmail.com>

________________________________
From: mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Brunner, Clemens (clemens.brunner at uni-graz.at) <clemens.brunner at uni-graz.at>
Sent: Monday, January 15, 2018 11:06:52 AM
To: Discussion and support forum for the users of MNE Software
Subject: Re: [Mne_analysis] Need Help to do Cross Spectral Density Analysis

Hi!

Could you share the raw data file with me so that I can reproduce the issue? I'd also need your script, at least the part in which you load the data, i.e. eeg_channels, events, event_id.

Clemens


> On Jan 15, 2018, at 10:59, MD KHORSHED ALAM <khorshed.alam at live.iium.edu.my> wrote:
>
> Hi,
>
> Epochs Object:
> epochs = mne.Epochs(eeg_channels, events=events, event_id=event_id, tmin=-0.2, tmax=0.5, proj=True, baseline=(None, 0), preload=True)
>
> The following epochs is used for the following function and work perfectly I think.
>
> import mne
> from mne.time_frequency import csd_epochs
> mne.time_frequency.csd_epochs(epochs, mode='multitaper', fmin=fmin, fmax=fmax, fsum=False, tmin=tmin, tmax=tmax, n_fft=n_fft, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, projs=None, verbose=None)
>
> Problem arises once I applied 'X'=3D array of epochs data to:
>
> mne.time_frequency.csd_array(X, sfreq, mode='multitaper', fmin=fmin, fmax=fmax, fsum=True, n_fft=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, verbose=None)
>
> I am using windows system and I run your given code.
> Output:  ['C:\\Anaconda2\\envs\\mymayavi\\lib\\site-packages\\mne']
>
> Unfortunately, I don't understand about your later instruction (e.g. Replace $MNE, download test data and copy into the given path)
>
> Thanks With Warm Regards,
> MD. KHORSHED ALAM (Shishir)
> Graduate Research Assistant (GRA)
> Center of Intelligent Signal and Imaging Research (CISIR)
> Department of Electrical and Electronic Engineering
> Universiti Teknologi PETRONAS
> Bandar Seri Iskandar
> 32610 Tronoh
> Perak Darul Ridzuan
> Malaysia
> Mobile no: +60176459080
> Email ID: khorshed.alam at live.iium.edu.my
> Alternative :shishir_lmu at yahoo.com, alam.0213 at gmail.com
>
> From: mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Brunner, Clemens (clemens.brunner at uni-graz.at) <clemens.brunner at uni-graz.at>
> Sent: Monday, January 15, 2018 9:13:14 AM
> To: Discussion and support forum for the users of MNE Software
> Subject: Re: [Mne_analysis] Need Help to do Cross Spectral Density Analysis
>
> Hi!
>
> Could you please send me your Epochs object? I want to test if it works on my machine.
>
> In addition, can you please run the tests in $MNE/time_frequency/tests? You can find out where MNE is installed with:
>
> import mne
> mne.__path__
>
> Then replace $MNE in the path above with the actual path.
>
> Note that you also need to download the test data separately (https://github.com/mne-tools/mne-python/tree/master/mne/io/tests/data) and copy everything into $MNE/io/tests/data.
>
> Does someone else have an idea/suggestion what's going on?
>
> Clemens
>
>
>
> > On Jan 15, 2018, at 09:51, MD KHORSHED ALAM <khorshed.alam at live.iium.edu.my> wrote:
> >
> > Hi,
> >
> > Yes, I am using Anaconda 2 python distribution and I followed all the instruction on the given link.
> >
> > Thanks With Warm Regards,
> > MD. KHORSHED ALAM (Shishir)
> > Graduate Research Assistant (GRA)
> > Center of Intelligent Signal and Imaging Research (CISIR)
> > Department of Electrical and Electronic Engineering
> > Universiti Teknologi PETRONAS
> > Bandar Seri Iskandar
> > 32610 Tronoh
> > Perak Darul Ridzuan
> > Malaysia
> > Mobile no: +60176459080
> > Email ID: khorshed.alam at live.iium.edu.my
> > Alternative :shishir_lmu at yahoo.com, alam.0213 at gmail.com
> >
> > From: mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Brunner, Clemens (clemens.brunner at uni-graz.at) <clemens.brunner at uni-graz.at>
> > Sent: Monday, January 15, 2018 8:34:51 AM
> > To: Discussion and support forum for the users of MNE Software
> > Subject: Re: [Mne_analysis] Need Help to do Cross Spectral Density Analysis
> >
> > Hi!
> >
> > Are you using the recommended Anaconda Python distribution? There might be something wrong with you Python setup. Did you follow the installation instructions summarized on https://martinos.org/mne/stable/install_mne_python.html?
> >
> > Clemens
> >
> >
> > > On Jan 15, 2018, at 09:18, MD KHORSHED ALAM <khorshed.alam at live.iium.edu.my> wrote:
> > >
> > > Hi,
> > >
> > > Thank you and unfortunately, still getting the same errors after executing the recommended codes.
> > >
> > > I am using WIN 64-bits, Python 2.7.14.
> > >
> > > I have checked the following code:
> > > import sys
> > > sys.maxint
> > >
> > > Output:  2147483647 (32-bits integer value )
> > >
> > >
> > > I think, because of this may get the errors. Please anyone helps me to update my 'sys' to 64-bits integer value?
> > >
> > >
> > > Thanks With Warm Regards,
> > > MD. KHORSHED ALAM (Shishir)
> > > Graduate Research Assistant (GRA)
> > > Center of Intelligent Signal and Imaging Research (CISIR)
> > > Department of Electrical and Electronic Engineering
> > > Universiti Teknologi PETRONAS
> > > Bandar Seri Iskandar
> > > 32610 Tronoh
> > > Perak Darul Ridzuan
> > > Malaysia
> > > Mobile no: +60176459080
> > > Email ID: khorshed.alam at live.iium.edu.my
> > > Alternative :shishir_lmu at yahoo.com, alam.0213 at gmail.com
> > >
> > > From: mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Brunner, Clemens (clemens.brunner at uni-graz.at) <clemens.brunner at uni-graz.at>
> > > Sent: Sunday, January 14, 2018 4:46:36 PM
> > > To: Discussion and support forum for the users of MNE Software
> > > Subject: Re: [Mne_analysis] Need Help to do Cross Spectral Density Analysis
> > >
> > > Hi!
> > >
> > > I don’t really understand why the array is of type int64 (and why that matters - are you on Python 2)?
> > >
> > > Can you try if this minimal example works for you:
> > >
> > > import mne
> > > import numpy as np
> > >
> > > X = np.random.rand(320, 60, 421)
> > > csd = mne.time_frequency.csd_array(X, 128)
> > >
> > > Clemens
> > >
> > >
> > > > On Jan 14, 2018, at 11:15, MD KHORSHED ALAM <khorshed.alam at live.iium.edu.my> wrote:
> > > >
> > > > Hi,
> > > > Thank you for your suggestion.
> > > > However,
> > > > Code: epochs = mne.Epochs(eeg_channels, events=events, event_id=event_id, tmin=-0.2, tmax=0.5, proj=True, baseline=(None, 0), preload=True)
> > > > X=epochs['aud_l', 'aud_r', 'vis_l', 'vis_r', 'smiley', 'button'].get_data()
> > > > print(X.shape)
> > > > Output:
> > > > 320 matching events found
> > > > 3 projection items activated
> > > > Loading data for 320 events and 421 original time points ...
> > > > 0 bad epochs dropped
> > > > (320L, 60L, 421L)
> > > >
> > > >
> > > > Then i have applied 3D array 'X' to:  mne.time_frequency.csd_array(X, sfreq, mode='multitaper', fmin=0, fmax=35.0, fsum=False, n_fft=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, verbose=None)
> > > >
> > > > But still getting the following errors:
> > > >
> > > > ValueError
> > > >                                 Traceback (most recent call last)
> > > >
> > > > <ipython-input-177-d7b62b6f3fe7> in <module>()
> > > > ----> 1 mne.time_frequency.csd_array(X, sfreq, mode='multitaper', fmin=0, fmax=35.0, fsum=False, n_fft=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, verbose=None)
> > > >
> > > > ValueError: when using select="i", select_range must contain integers, got dtype int64
> > > >
> > > >
> > > > Thanks With Warm Regards,
> > > > MD. KHORSHED ALAM (Shishir)
> > > > Graduate Research Assistant (GRA)
> > > > Center of Intelligent Signal and Imaging Research (CISIR)
> > > > Department of Electrical and Electronic Engineering
> > > > Universiti Teknologi PETRONAS
> > > > Bandar Seri Iskandar
> > > > 32610 Tronoh
> > > > Perak Darul Ridzuan
> > > > Malaysia
> > > > Mobile no: +60176459080
> > > > Email ID: khorshed.alam at live.iium.edu.my
> > > > Alternative :shishir_lmu at yahoo.com, alam.0213 at gmail.com
> > > >
> > > > From: mne_analysis-bounces at nmr.mgh.harvard.edu <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Brunner, Clemens (clemens.brunner at uni-graz.at) <clemens.brunner at uni-graz.at>
> > > > Sent: Tuesday, January 9, 2018 8:40:03 AM
> > > > To: Discussion and support forum for the users of MNE Software
> > > > Subject: Re: [Mne_analysis] Need Help to do Cross Spectral Density Analysis
> > > >
> > > > Hi!
> > > >
> > > > You can use the get_data method on your Epochs object, e.g.
> > > >
> > > > X = epochs.get_data()
> > > >
> > > > will return a 3D array of the desired shape.
> > > >
> > > > HTH
> > > > Clemens
> > > >
> > > >
> > > > > On Jan 9, 2018, at 07:25, MD KHORSHED ALAM <khorshed.alam at live.iium.edu.my> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I want to do CSD analysis on EEG data but facing problem with the following function:
> > > > >
> > > > > csd_array(X, sfreq, mode='multitaper' fmin=0 fmax=np.inf, fsum=True, n_fft=None, mt_bandwidth=None, mt_adaptive=False, mt_low_bias=True, verbose=None):
> > > > >
> > > > > I am unable to extract the "X" parameter values. Can you let me know the file where "X" (data matrix) structure is defined in order to have a better idea about "X" parameter.
> > > > >
> > > > > Thank you.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Thanks With Warm Regards,
> > > > > MD. KHORSHED ALAM (Shishir)
> > > > > Graduate Research Assistant (GRA)
> > > > > Center of Intelligent Signal and Imaging Research (CISIR)
> > > > > Department of Electrical and Electronic Engineering
> > > > > Universiti Teknologi PETRONAS
> > > > > Bandar Seri Iskandar
> > > > > 32610 Tronoh
> > > > > Perak Darul Ridzuan
> > > > > Malaysia
> > > > > Mobile no: +60176459080
> > > > > Email ID: khorshed.alam at live.iium.edu.my
> > > > > Alternative :shishir_lmu at yahoo.com, alam.0213 at gmail.com
> > > > >
> > > > > _______________________________________________
> > > > > Mne_analysis mailing list
> > > > > Mne_analysis at nmr.mgh.harvard.edu
> > > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > > > >
> > > > >
> > > > > The information in this e-mail is intended only for the person to whom it is
> > > > > addressed. If you believe this e-mail was sent to you in error and the e-mail
> > > > > contains patient information, please contact the Partners Compliance HelpLine at
> > > > > http://www.partners.org/complianceline . If the e-mail was sent to you in error
> > > > > but does not contain patient information, please contact the sender and properly
> > > > > dispose of the e-mail.
> > > >
> > > >
> > > > _______________________________________________
> > > > Mne_analysis mailing list
> > > > Mne_analysis at nmr.mgh.harvard.edu
> > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > > > _______________________________________________
> > > > Mne_analysis mailing list
> > > > Mne_analysis at nmr.mgh.harvard.edu
> > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > > >
> > > >
> > > > The information in this e-mail is intended only for the person to whom it is
> > > > addressed. If you believe this e-mail was sent to you in error and the e-mail
> > > > contains patient information, please contact the Partners Compliance HelpLine at
> > > > http://www.partners.org/complianceline . If the e-mail was sent to you in error
> > > > but does not contain patient information, please contact the sender and properly
> > > > dispose of the e-mail.
> > >
> > >
> > > _______________________________________________
> > > Mne_analysis mailing list
> > > Mne_analysis at nmr.mgh.harvard.edu
> > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > > _______________________________________________
> > > Mne_analysis mailing list
> > > Mne_analysis at nmr.mgh.harvard.edu
> > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > >
> > >
> > > The information in this e-mail is intended only for the person to whom it is
> > > addressed. If you believe this e-mail was sent to you in error and the e-mail
> > > contains patient information, please contact the Partners Compliance HelpLine at
> > > http://www.partners.org/complianceline . If the e-mail was sent to you in error
> > > but does not contain patient information, please contact the sender and properly
> > > dispose of the e-mail.
> >
> >
> > _______________________________________________
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > _______________________________________________
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >
> >
> > The information in this e-mail is intended only for the person to whom it is
> > addressed. If you believe this e-mail was sent to you in error and the e-mail
> > contains patient information, please contact the Partners Compliance HelpLine at
> > http://www.partners.org/complianceline . If the e-mail was sent to you in error
> > but does not contain patient information, please contact the sender and properly
> > dispose of the e-mail.
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the e-mail
> contains patient information, please contact the Partners Compliance HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in error
> but does not contain patient information, please contact the sender and properly
> dispose of the e-mail.


_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180115/5cc44549/attachment-0001.html 


More information about the Mne_analysis mailing list