wmayner / pyphi

A toolbox for integrated information theory.
https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006343
Other
368 stars 98 forks source link

Error import network.json file in the ipython or python #43

Closed 7beggars closed 2 years ago

7beggars commented 3 years ago

I'm trying to import network.json as described here Figure 7 (import network.json file) and I get the error below. Would anyone have any idea what I'm probably doing wrong?

>>> network = pyphi.network.from_json('/home/me/network.json')
>>> network.tpm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'tpm'
>>> 
wmayner commented 3 years ago

Where did you get the network.json file from?

Can you post the contents of that file?

7beggars commented 3 years ago

This happened immediately the first time I downloaded the default configuration when opening the http://integratedinformationtheory.org/calculate.html, then without changing the network I clicked 'export':

the contents of the file are below:

{"labels":["A","B","C"],"nodes":[{"index":0,"label":"A","on":0,"mechanism":"XOR","reflexive":false,"selected":false,"threshold":2,"weight":2,"x":424.6384301424528,"y":265.7031508223945,"px":423.974973581876,"py":265.59795363935393},{"index":1,"label":"B","on":0,"mechanism":"AND","reflexive":false,"selected":false,"threshold":2,"weight":2,"x":263.8230371563018,"y":327.1170316918664,"px":264.24688703477506,"py":326.59757954540163},{"index":2,"label":"C","on":1,"mechanism":"OR","reflexive":false,"selected":false,"threshold":2,"weight":2,"x":291.03853270124574,"y":157.17981748573777,"px":291.2781393833493,"py":157.80446681524307}],"tpm":[[0,0,0],[0,0,1],[1,0,1],[1,0,1],[1,0,0],[1,1,1],[0,0,1],[0,1,1]],"cm":[[0,1,1],[1,0,1],[1,1,0]],"state":[0,0,1],"version":"1.0.6"}