# 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
                                            (piy2 / pix2 > piy / pix))
                        else:
                            self.assertTrue((origbeta > 1) ==
                                            (piy2 / pix2 < piy / pix))

    def test_zeta_updates(self):
        """Test updating `zeta`."""
        random.seed(1)
        numpy.random.seed(1)

        expcm_fitprefs = copy.deepcopy(self.expcm_fitprefs)

        self.assertTrue(numpy.allclose(expcm_fitprefs.pi,
                                       expcm_fitprefs.origpi))
        k = 0
        for r in range(expcm_fitprefs.nsites):
            for i in range(N_AA - 1):
                oldzeta = expcm_fitprefs.zeta.copy()
                oldpi = expcm_fitprefs.pi.copy()
                zeta = oldzeta.copy()
                zeta[k] *= 0.9
                expcm_fitprefs.updateParams({'zeta': zeta})
                self.assertFalse(numpy.allclose(oldzeta, expcm_fitprefs.zeta))
                self.assertFalse(numpy.allclose(oldpi[r],
                                 expcm_fitprefs.pi[r]))
                self.assertFalse(numpy.allclose(expcm_fitprefs.pi,
                                                expcm_fitprefs.origpi))
                if self.MODEL == phydmslib.models.ExpCM_fitprefs:
                    self.assertTrue(expcm_fitprefs.pi[r][i] > oldpi[r][i])
                    self.assertTrue(all((expcm_fitprefs.pi[r][j] <

# 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

                                            (piy2 / pix2 > piy / pix))
                        else:
                            self.assertTrue((origbeta > 1) ==
                                            (piy2 / pix2 < piy / pix))

    def test_zeta_updates(self):
        """Test updating `zeta`."""
        random.seed(1)
        numpy.random.seed(1)

        expcm_fitprefs = copy.deepcopy(self.expcm_fitprefs)

        self.assertTrue(numpy.allclose(expcm_fitprefs.pi,
                                       expcm_fitprefs.origpi))
        k = 0
        for r in range(expcm_fitprefs.nsites):
            for i in range(N_AA - 1):
                oldzeta = expcm_fitprefs.zeta.copy()
                oldpi = expcm_fitprefs.pi.copy()
                zeta = oldzeta.copy()
                zeta[k] *= 0.9
                expcm_fitprefs.updateParams({'zeta': zeta})
                self.assertFalse(numpy.allclose(oldzeta, expcm_fitprefs.zeta))
                self.assertFalse(numpy.allclose(oldpi[r],
                                 expcm_fitprefs.pi[r]))
                self.assertFalse(numpy.allclose(expcm_fitprefs.pi,
                                                expcm_fitprefs.origpi))
                if self.MODEL == phydmslib.models.ExpCM_fitprefs:
                    self.assertTrue(expcm_fitprefs.pi[r][i] > oldpi[r][i])
                    self.assertTrue(all((expcm_fitprefs.pi[r][j] <

                                    oldpi[r][j] for j in range(i + 1, N_AA))))