Obtaining the local connectivity matrix

94 views
Skip to first unread message

Asad Malik

unread,
Nov 9, 2018, 8:43:13 AM11/9/18
to TVB Users
Hi,

I would like to obtain the local connectivity matrix for various coupling strengths. What is the correct way to do this? The following code returns exactly the same matrices:

default_cortex = cortex.Cortex(load_default=True)
for coupling_strength in [0, 10, 20]:
    default_cortex.coupling_strength = np.array([coupling_strength])
    default_cortex.compute_local_connectivity()
    sio.savemat('coupling_' + str(coupling_strength) + '.mat', {'local_connectivity': default_cortex.local_connectivity.matrix.toarray()})

Thanks!

Best,
Asad

WOODMAN Michael

unread,
Nov 9, 2018, 9:08:18 AM11/9/18
to tvb-...@googlegroups.com

hi Asad,


The code does not recompute the matrix if it exists (and isn't smart enough to know you updated the paramers), you can set the matrix to None,


default_cortex.local_connectivity.matrix = None


and then call the compute_local_connectivity method.  You should be aware that the toarray method on a sparse matrix returns a dense version, and the default local connectivity is relatively sparse.  If you change the kernel, you may run into out of memory errors.  You should be able to save the sparse matrix directly to MATLAB format, just drop the toarray() call.


cheers,

Marmaduke


From: tvb-...@googlegroups.com <tvb-...@googlegroups.com> on behalf of Asad Malik <asadm...@gmail.com>
Sent: Friday, November 9, 2018 2:43:13 PM
To: TVB Users
Subject: [TVB] Obtaining the local connectivity matrix
 
--
You received this message because you are subscribed to the Google Groups "TVB Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To post to this group, send email to tvb-...@googlegroups.com.
Visit this group at https://groups.google.com/group/tvb-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/5ecd1d46-4d44-4a85-a73a-6845d7f33815%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Asad Malik

unread,
Nov 9, 2018, 12:31:03 PM11/9/18
to TVB Users
Hi Marmaduke,

Thanks for your reply and the advice. Adding the line to set the max to None hasn't helped - the matrices are still exactly the same. Do you think there's something else I'm overlooking?

Thanks,
Asad

Asad Malik

unread,
Nov 9, 2018, 12:37:04 PM11/9/18
to TVB Users
*matrix, not max - sorry.

WOODMAN Michael

unread,
Nov 9, 2018, 5:08:20 PM11/9/18
to tvb-...@googlegroups.com

hi Asad


In fact, the coupling strength is a scaling factor applied to the local connectivity matrix during simulation, and it doesn't affect the local_connectivity.matrix, which is just hte kernel evaluated over geodesic distance.


In other words, you can evaluate local connectivity once and simply multiply its values by the scaling factor, and then continue whatever it is you are doing.


hope that helps,

Marmaduke


Sent: Friday, November 9, 2018 6:37:04 PM
To: TVB Users
Subject: Re: [TVB] Obtaining the local connectivity matrix
 

Asad Malik

unread,
Nov 13, 2018, 6:43:22 AM11/13/18
to TVB Users
Hi Marmaduke,

Many thanks for clarifying this. Am I correct in interpreting that the element (i,j) in the local connectivity matrix (where i is row and j is column) is the weight of the activity of vertex j on vertex i, and not the other way round?

Thanks,
Asad

WOODMAN Michael

unread,
Nov 13, 2018, 7:23:08 AM11/13/18
to tvb-...@googlegroups.com
Yes

Marmaduke Woodman, TVB Engineer, INS AMU; +33 7 67 77 84 72



Reply all
Reply to author
Forward
0 new messages