# Path: pyphi/distance.py
# @measures.register("EMD")
# def hamming_emd(d1, d2):
#     """Return the Earth Mover's Distance between two distributions (indexed
#     by state, one dimension per node) using the Hamming distance between states
#     as the transportation cost function.
# 
#     Singleton dimensions are sqeezed out.
#     """
#     N = d1.squeeze().ndim
#     d1, d2 = flatten(d1), flatten(d2)
#     return emd(d1, d2, _hamming_matrix(N))


from pyphi.distance import hamming_emd
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test_subsystem_cause_effect_info.py



def test_cause_info(s):
    mechanism = (0, 1)
    purview = (0, 2)
    answer = hamming_emd(
        s.cause_repertoire(mechanism, purview),
        s.unconstrained_cause_repertoire(purview),
    )
    assert s.cause_info(mechanism, purview) == answer


def test_effect_info(s):
    mechanism = (0, 1)
    purview = (0, 2)

# Path: pyphi/distance.py
# @measures.register("EMD")
# def hamming_emd(d1, d2):
#     """Return the Earth Mover's Distance between two distributions (indexed
#     by state, one dimension per node) using the Hamming distance between states
#     as the transportation cost function.
# 
#     Singleton dimensions are sqeezed out.
#     """
#     N = d1.squeeze().ndim
#     d1, d2 = flatten(d1), flatten(d2)
#     return emd(d1, d2, _hamming_matrix(N))


# Path: test/test_subsystem_cause_effect_info.py
from pyphi.distance import hamming_emd

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test_subsystem_cause_effect_info.py



def test_cause_info(s):
    mechanism = (0, 1)
    purview = (0, 2)
    answer = hamming_emd(
        s.cause_repertoire(mechanism, purview),
        s.unconstrained_cause_repertoire(purview),
    )
    assert s.cause_info(mechanism, purview) == answer


def test_effect_info(s):
    mechanism = (0, 1)
    purview = (0, 2)

    answer = hamming_emd(