# Path: phydmslib/constants.py
# CODON_TO_AA = []
# 
# N_CODON = len(CODON_TO_INDEX)
# 
# N_AA = len(INDEX_TO_AA)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}
# 
# N_NT = len(INDEX_TO_NT)


import random
import unittest
import copy
import numpy
import scipy.optimize
import sympy
import phydmslib.models
from phydmslib.constants import CODON_TO_AA, N_CODON, N_AA, AA_TO_INDEX, N_NT
                    self.assertTrue(expcm_fitprefs.pi[r][i] < oldpi[r][i])
                    zeta[k] *= 2
                    expcm_fitprefs.updateParams({'zeta': zeta})
                    self.assertTrue(expcm_fitprefs.pi[r][i] > oldpi[r][i])
                k += 1

    def test_dprx_dzeta(self):
        """Test `dprx['zeta']`."""
        random.seed(1)

        expcm_fitprefs = copy.deepcopy(self.expcm_fitprefs)
        nsites = expcm_fitprefs.nsites

        def func(zetari, i, r, x):
            zeta = expcm_fitprefs.zeta.copy()
            zeta.reshape(nsites, N_AA - 1)[r][i] = zetari
            expcm_fitprefs.updateParams({'zeta': zeta})
            return expcm_fitprefs.prx[r][x]

        def dfunc(zetari, i, r, x):
            zeta = expcm_fitprefs.zeta.copy()
            zeta.reshape(nsites, N_AA - 1)[r][i] = zetari
            expcm_fitprefs.updateParams({'zeta': zeta})
            return expcm_fitprefs.dprx['zeta'][i + r * (N_AA - 1)][r][x]

        j = 0
        for r in range(nsites):
            for i in range(N_AA - 1):
                zetari = numpy.array([expcm_fitprefs.zeta.reshape(
                        nsites, N_AA - 1)[r][i]])

# Path: phydmslib/constants.py
# CODON_TO_AA = []
# 
# N_CODON = len(CODON_TO_INDEX)
# 
# N_AA = len(INDEX_TO_AA)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}
# 
# N_NT = len(INDEX_TO_NT)


# Path: tests/test_expcm_fitprefs.py
import random
import unittest
import copy
import numpy
import scipy.optimize
import sympy
import phydmslib.models
from phydmslib.constants import CODON_TO_AA, N_CODON, N_AA, AA_TO_INDEX, N_NT

                    self.assertTrue(expcm_fitprefs.pi[r][i] < oldpi[r][i])
                    zeta[k] *= 2
                    expcm_fitprefs.updateParams({'zeta': zeta})
                    self.assertTrue(expcm_fitprefs.pi[r][i] > oldpi[r][i])
                k += 1

    def test_dprx_dzeta(self):
        """Test `dprx['zeta']`."""
        random.seed(1)

        expcm_fitprefs = copy.deepcopy(self.expcm_fitprefs)
        nsites = expcm_fitprefs.nsites

        def func(zetari, i, r, x):
            zeta = expcm_fitprefs.zeta.copy()
            zeta.reshape(nsites, N_AA - 1)[r][i] = zetari
            expcm_fitprefs.updateParams({'zeta': zeta})
            return expcm_fitprefs.prx[r][x]

        def dfunc(zetari, i, r, x):
            zeta = expcm_fitprefs.zeta.copy()
            zeta.reshape(nsites, N_AA - 1)[r][i] = zetari
            expcm_fitprefs.updateParams({'zeta': zeta})
            return expcm_fitprefs.dprx['zeta'][i + r * (N_AA - 1)][r][x]

        j = 0
        for r in range(nsites):
            for i in range(N_AA - 1):
                zetari = numpy.array([expcm_fitprefs.zeta.reshape(
                        nsites, N_AA - 1)[r][i]])

                for x in range(N_CODON):