Beispiel #1
0
def test_average_control_phenotype_net(bowtie_network):
    net = bowtie_network
    probs, ents = get_average_control_phenotype(net)
    for p, e in zip(probs, ents):
        # We should never have more information than there is to explain!
        assert p <= e

    onz = OutputControlAnalyzer(net.factory.world)
    cy_info = onz.numpy_info_from_network(net)[0][:,:2]
    py_info = numpy.asarray([[p, e] for (p, e) in zip(probs, ents)])
    numpy.testing.assert_allclose(cy_info, py_info)
Beispiel #2
0
def test_weighted_control_phenotype(bowtie_database, bowtie_network):
    net = bowtie_network
    # net = bowtie_database.population[50]
    t = bowtie_database.targets[0]
    tset = t.calc_distinct_outputs()
    onz = OutputControlAnalyzer(net.factory.world, tset)
    cy_info = onz.numpy_info_from_network(net)[0]

    probs, cats = get_causal_specs_phenotype(net, tset)
    wc = get_weighted_control_phenotype(net, tset)
    ac, ent = get_average_control_phenotype(net)
    # Should always DECREASE
    assert (wc <= ac).all()
    numpy.testing.assert_allclose(wc, cy_info[:, 2])
Beispiel #3
0
def test_weighted_control_phenotype_pop(bowtie_database):
    pop = bowtie_database.population
    t = bowtie_database.targets[0]
    tset = t.calc_distinct_outputs()
    anz = OutputControlAnalyzer(pop.factory.world, tset)
    cy_info = numpy.asarray(anz.analyse_collection(pop))

    for i, net in enumerate(pop):
        wc = get_weighted_control_phenotype(net, tset)
        assert (cy_info[i][:, 0] >= cy_info[i][:, 2]).all()
        numpy.testing.assert_allclose(wc, cy_info[i][:, 2])

        # # Let's just do 50.
        if i > 50:
            break
Beispiel #4
0
def test_average_control_phenotype_pop(bowtie_database):
    pop = bowtie_database.population
    anz = OutputControlAnalyzer(pop.factory.world)
    cy_info = numpy.asarray(anz.analyse_collection(pop))

    for i, net in enumerate(pop):
        probs, ents = get_average_control_phenotype(net)
        py_info = numpy.asarray([[p, e] for (p, e) in zip(probs, ents)])
        numpy.testing.assert_allclose(py_info, cy_info[i][:, :2])

        assert not numpy.any(numpy.isnan(cy_info[1]))

        # # Let's just do 50.
        if i > 50:
            break