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

Minor fixes #62

Closed isacdaavid closed 2 years ago

isacdaavid commented 2 years ago

a5171af updates test_phi() inside test/test_subsystem_small_phi.py to use the new eq() directly.

Upon closer inspection, I don't think the rest of the tests I had already touched need similar updating. E.g.:

test/test_utils.py needs to build borderline values before calling eq() itself, and it needs to define something like EPSILON for this:

   def test_eq():
    phi = 0.5
    epsilon = 10**(-config.PRECISION)
    close_enough = phi - epsilon / 2
    not_quite = phi - epsilon * 2
    assert utils.eq(phi, close_enough)
    assert not utils.eq(phi, not_quite)
    assert not utils.eq(phi, (phi - phi))

Similar reasoning applies to the rest (testing models.cpm.general_eq(), ria(), mice(), concept()). Calling eq() directly would defeat the purpose, afaict.