neurolib-dev/neurolib

Cmat is the same in two model instances, but models themselves are not

kuffmode opened this issue · 1 comments

Hi there,
First of all, love your work here. I just have a quick question. So I'm instantiating a model object as one of your examples:

model = WCModel(Cmat = connectivity, Dmat = distances,seed=SEED)
model.params['exc_ext'] = 0.65

model.params['signalV'] = 0
model.params['duration'] = 100
model.params['sigma_ou'] = 0.14
model.params['K_gl'] = 3.15

model.run()

Where connectivity and distances are from a connectome I have. So far so good. I then tried to artificially cut some connections and instantiated a new object with the perturbed connectivity:

connectivity[:,1:50]=0.
connectivity[1:50,:]=0.
distances[:,1:50]=0.
distances[1:50,:]=0.

model2 = WCModel(Cmat = connectivity, Dmat = distances,seed=SEED)

Intuitively, this should creat a new instance with the new connectivity where 50 connections are cut. What I get instead is the same exact dynamics, which means the connectivity is the same. So I checked it with model.Cmat == model2.Cmat and:

array([[ True,  True,  True, ...,  True,  True,  True],
       [ True,  True,  True, ...,  True,  True,  True],
       [ True,  True,  True, ...,  True,  True,  True],
       ...,
       [ True,  True,  True, ...,  True,  True,  True],
       [ True,  True,  True, ...,  True,  True,  True],
       [ True,  True,  True, ...,  True,  True,  True]])

But then model == model2 is False. So I was wondering how can I modify the connectivity or instantiate different models with different connectivity matrices? I tried model2.Cmat = connectivity or model.clearModelState() but yeah, still the same. I feel this has a very trivial solution but I couldn't figure it out!

Thanks.

Ok I did a bit more digging here and found the bug. It was me! All this time it was me!
image