Slicing matrices


In [1]:
import numpy as np
from inet import utils

In [2]:
nPV = 2 
matrix = np.loadtxt('../data/2_170411_01.syn', dtype=int)# load an example matrix
ncells = matrix.shape[0]
matrix


Out[2]:
array([[0, 1, 0, 0, 1, 0, 0],
       [0, 0, 1, 0, 0, 0, 1],
       [0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0],
       [0, 1, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0]])

Select only reciprocal inhibition (II)

Reciprocal connections are bidirectional connections between PV interneurons


In [3]:
matrix[:2][:,(0,1)] # II = matrix[ :nPV][ :,range(nPV)]


Out[3]:
array([[0, 1],
       [0, 0]])

In [4]:
utils.II_slice(matrix,2)


Out[4]:
array([[0, 1],
       [0, 0]])

Select connections from inhibitory to excitatory neurons (IE)


In [5]:
utils.IE_slice(matrix,2)


Out[5]:
array([[0, 0, 1, 0, 0],
       [1, 0, 0, 0, 1]])

In [6]:
matrix[:2][:,(2,3,4,5,6)] # IE = matrix[ :nPV][ :,range(nPV,ncells)]


Out[6]:
array([[0, 0, 1, 0, 0],
       [1, 0, 0, 0, 1]])

Select connections from excitatory to inhibitory neurons (EI)


In [7]:
utils.EI_slice(matrix,2)


Out[7]:
array([[0, 0],
       [0, 0],
       [0, 1],
       [0, 0],
       [0, 0]])

In [8]:
matrix[2:][:,(0,1)] # EI = matrix[nPV:][,:range(nPV)]


Out[8]:
array([[0, 0],
       [0, 0],
       [0, 1],
       [0, 0],
       [0, 0]])

In [ ]: