pyphi.convert#

Conversion functions.

See the documentation on PyPhi Transition probability matrix conventions for information on the different representations that these functions convert between.

Functions

b2l(i, n)

Convert between big-endian and little-endian for indices in range(n).

b2l_sbs(tpm)

Convert a state-by-state TPM from big-endian to little-endian or vice versa.

b2s(i, number_of_nodes)

Convert a decimal integer to a PyPhi state-tuple using the big-endian convention, in which the most-significant bit corresponds to the lowest-index node.

be2le(i, n)

Convert between big-endian and little-endian for indices in range(n).

be2le_state_by_state(tpm)

Convert a state-by-state TPM from big-endian to little-endian or vice versa.

be_index2state(i, number_of_nodes)

Convert a decimal integer to a PyPhi state-tuple using the big-endian convention, in which the most-significant bit corresponds to the lowest-index node.

l2b(i, n)

Convert between big-endian and little-endian for indices in range(n).

l2b_sbs(tpm)

Convert a state-by-state TPM from big-endian to little-endian or vice versa.

l2s(i, number_of_nodes)

Convert a decimal integer to a PyPhi state-tuple using the little-endian convention.

le2be(i, n)

Convert between big-endian and little-endian for indices in range(n).

le2be_state_by_state(tpm)

Convert a state-by-state TPM from big-endian to little-endian or vice versa.

le_index2state(i, number_of_nodes)

Convert a decimal integer to a PyPhi state-tuple using the little-endian convention.

nodes2indices(nodes)

Convert nodes to a tuple of their indices.

nodes2state(nodes)

Convert nodes to a tuple of their states.

reverse_bits(i, n)

Reverse the bits of the n-bit decimal number i.

s2b(state)

Convert a PyPhi state-tuple to a decimal index using the big-endian convention.

s2l(state)

Convert a PyPhi state-tuple to a decimal index using the little-endian convention.

sbn2sbs(sbn)

Convert a state-by-node TPM to a state-by-state TPM.

sbs2sbn(tpm)

Convert a state-by-state TPM to a state-by-node TPM.

sbs_to_multidimensional(tpm)

state2be_index(state)

Convert a PyPhi state-tuple to a decimal index using the big-endian convention.

state2le_index(state)

Convert a PyPhi state-tuple to a decimal index using the little-endian convention.

state_by_node2state_by_state(sbn)

Convert a state-by-node TPM to a state-by-state TPM.

state_by_state2state_by_node(tpm)

Convert a state-by-state TPM to a state-by-node TPM.

to_2d(tpm)

Reshape a state-by-node TPM to the 2-dimensional form.

to_2dimensional(tpm)

Reshape a state-by-node TPM to the 2-dimensional form.

to_md(tpm)

Reshape a state-by-node TPM to the multidimensional form.

to_multidimensional(tpm)

Reshape a state-by-node TPM to the multidimensional form.