Exemple #1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from pyphi.compute import big_mip
from pyphi import Subsystem
import numpy as np
import example_networks
from pyphi.constants import EPSILON

micro = example_networks.micro()
micro.current_state = (0, 0, 0, 0)
micro.past_state = (0, 0, 0, 0)
micro_subsystem = Subsystem(range(micro.size), micro)
mip = big_mip(micro_subsystem)

CD = micro_subsystem.nodes[2:4]
BCD = micro_subsystem.nodes[1:4]
ABCD = micro_subsystem.nodes[0:4]

A = mip.unpartitioned_constellation[0]

cause = A.cause.mip.unpartitioned_repertoire
effect = A.effect.mip.unpartitioned_repertoire


def test_expand_cause_repertoire():
    assert np.all(abs(A.expand_cause_repertoire(CD) - cause) < EPSILON)
    assert np.all(
        abs(
            A.expand_cause_repertoire(BCD).flatten(order='F') -
            np.array([1 / 6 if i < 6 else 0 for i in range(8)])) < EPSILON)
Exemple #2
0
def micro():
    return example_networks.micro()
Exemple #3
0
def micro():
    return example_networks.micro()
Exemple #4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from pyphi.compute import big_mip
from pyphi import Subsystem
import numpy as np
import example_networks
from pyphi.constants import EPSILON

micro = example_networks.micro()
micro.current_state = (0, 0, 0, 0)
micro.past_state = (0, 0, 0, 0)
micro_subsystem = Subsystem(range(micro.size), micro)
mip = big_mip(micro_subsystem)

CD = micro_subsystem.nodes[2:4]
BCD = micro_subsystem.nodes[1:4]
ABCD = micro_subsystem.nodes[0:4]

A = mip.unpartitioned_constellation[0]

cause = A.cause.mip.unpartitioned_repertoire
effect = A.effect.mip.unpartitioned_repertoire


def test_expand_cause_repertoire():
    assert np.all(abs(A.expand_cause_repertoire(CD) - cause) < EPSILON)
    assert np.all(abs(
        A.expand_cause_repertoire(BCD).flatten(order='F') -
        np.array([1/6 if i < 6 else 0 for i in range(8)])) < EPSILON)
    assert np.all(abs(