Extracting interactions between only 3-4 nodes with SJ3D dynamics in Python

13 views
Skip to first unread message

Borjan Milinkovic

unread,
May 10, 2021, 9:39:47 PM5/10/21
to TVB Users
Hi all,

I am interested in extracting 3 or 4 nodes uncoupled from the rest of the network in a scripting interface (ipython, python). I have been successful in doing it through the GUI, as its straight forward to save a connectivity with no in-weights and out-weights to the 4 specified nodes of interest. However, I am having trouble doing it in python as it is easier to implement in a total workflow for analysis. 

So, specifically, I would like to extract 3 or 4 nodes (Xi variable for the SJ3D models) from the default connectivity matrix in TVB without any interactions to and from the set of all other nodes. 

An example to go from for something like this would be of great help! I can't find much on this topic in the documentation/github.

Best wishes,
Boki

WOODMAN Michael

unread,
May 11, 2021, 4:21:58 AM5/11/21
to tvb-...@googlegroups.com
Hi

You can create a new connectivity based on the default one, e..g 
import numpy as np
from tvb.datatypes.connectivity import Connectivity

default = Connectivity.from_file()
default.configure()

idx = np.r_[2, 3, 5, 9, 12]
subset = Connectivity(
weights=default.weights[idx][:,idx],
tract_lengths=default.tract_lengths[idx][:,idx],
centres=default.centres[idx],
region_labels=default.region_labels[idx]
)
subset.configure()
print(subset)

cheers,
Marmaduke

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/cf98d751-a071-4c4e-9e7a-6118fb131dcdn%40googlegroups.com.

Borjan Milinkovic

unread,
May 11, 2021, 8:12:39 PM5/11/21
to TVB Users
Thanks Marmaduke,

This is incredibly helpful!

Cheers,
Boki

Reply all
Reply to author
Forward
0 new messages