[Mne_analysis] cluster permutation connectivity matrix

Chris Holdgraf choldgraf at berkeley.edu
Sat Sep 23 06:06:32 EDT 2017
Search archives:

PR merged... It'll give a more helpful error message now

On Fri, Sep 22, 2017, 3:48 PM Eric Larson <larson.eric.d at gmail.com> wrote:

> Yes that would be useful.
>
> Eric
>
>
> On Fri, Sep 22, 2017 at 10:45 AM, Chris Holdgraf <choldgraf at berkeley.edu>
> wrote:
>
>> I think we should clarify this is the docstring, add a check for the
>> input and raise an error, and maybe add an example. Wdyt? I can open a pr
>> if that sounds good.
>>
>>
>> On Fri, Sep 22, 2017, 12:43 PM Alexandre Gramfort <
>> alexandre.gramfort at inria.fr> wrote:
>>
>>> 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.
>>>>
>>>>
>>> _______________________________________________
>>> 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
>>
>>
>> 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
>
>
> 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/20170923/966698c1/attachment.html 


More information about the Mne_analysis mailing list