Beispiel #1
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 #2
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