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)
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])