[Mne_analysis] cluster permutation connectivity matrix

Alexandre Gramfort alexandre.gramfort at inria.fr
Fri Sep 22 07:42:33 EDT 2017
Search archives:

hi yvonne,

connectivity must be a sparse matrix not a numpy array

from scipy import sparse
connectivity = sparse.eye(numChan)

HTH
Alex


On Wed, Sep 20, 2017 at 10:00 PM, Yvonne Fonken <yfonken at berkeley.edu>
wrote:

> Hi Alex,
>
> Thank you for your reply.
>
> This is my code, with two versions of a diagonal connectivity matrix
> (using version 14.1 of MNE):
> # Implement cluster permutation
> numChan = Data.shape[1] # Data is shaped: Trials (115) x channels (217) x
> timepoints (30) numpy array
> #connectivity =  np.diagflat( range(0,numChan), k = 0)
> connectivity =  np.diagflat( np.ones((1,numChan)), k = 0) # N x N diagonal
> matrix with N being # of electrodes
> TestData = np.swapaxes(Data, 1,2) # trials x time x space (electrodes)
> T_obs, clusters, p_values, H0 = mne.stats.permutation_cluster_1samp_test(TestData,
> n_permutations = 500, tail = 0, connectivity = connectivity)
>
> Both versions of the connectivity matrix now give me the following error:
> 'numpy.ndarray' object has no attribute 'tocsr'
>
> Thanks,
> Yvonne
>
> On Tue, Sep 19, 2017 at 1:02 AM, Alexandre Gramfort <
> alexandre.gramfort at inria.fr> wrote:
>
>> Hi Yvonne
>>
>> I would have said that a sparse diagonal matrix should work.
>>
>> can you share the code snippet you used?
>>
>> Alex
>>
>>
>> On Tue, Sep 19, 2017 at 3:17 AM, Yvonne Fonken <yfonken at berkeley.edu>
>> wrote:
>> > Hi all,
>> >
>> > I am trying to apply the cluster permutation function in MNE on
>> intracranial
>> > data (electrodes by time points), either by using
>> > mne.stats.permutation_cluster_test, or
>> > mne.stats.permutation_cluster_1samp_test. In this case, I do not want
>> to
>> > cluster across electrodes, but I want to include this dimension in
>> order to
>> > correct for multiple comparisons.
>> >
>> > My question is: how do I specify to only cluster over time, and not
>> > electrodes? Can I do this using the connectivity matrix, and if yes,
>> what
>> > would a connectivity matrix look like when all electrodes do not have
>> > neighbors? I've tried using diagonal matrices already, but I still get
>> > clusters spanning multiple electrodes.
>> >
>> > Thanks,
>> > Yvonne
>> >
>> > --
>> > Yvonne Fonken
>> > PhD Candidate
>> > Helen Wills Neuroscience Institute
>> > University of California, Berkeley
>> >
>> > _______________________________________________
>> > 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
>>
>
>
>
> --
> Yvonne Fonken
> Graduate student
> Helen Wills Neuroscience Institute
> University of California, Berkeley
>
> _______________________________________________
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170922/e8528125/attachment-0001.html 


More information about the Mne_analysis mailing list