# 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
                      [pirAy, random.uniform(0.01, 0.5)],
                      [omega, random.uniform(0.1, 2.0)]]
            self.assertTrue(abs(values[1][1] - values[2][1]) > diffpref,
                            "choose another random number seed as pirAx and "
                            "pirAy are too close.")
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAx.subs(values)),
                            float(sympy.diff(Frxy, pirAx).subs(values))))
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAy.subs(values)),
                            float(sympy.diff(Frxy, pirAy).subs(values))))
            values[2][1] = values[1][1] * (1 + diffpref)
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAx_equal.subs(
                    values)), float(sympy.diff(Frxy, pirAx).subs(values))))
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAy_equal.subs(
                    values)), float(sympy.diff(Frxy, pirAy).subs(values))))

        expcm_fitprefs = copy.deepcopy(self.expcm_fitprefs)
        for r in range(expcm_fitprefs.nsites):
            for x in range(N_CODON):
                for y in range(N_CODON):
                    if x == y:
                        continue
                    values = {}
                    values[beta] = expcm_fitprefs.beta
                    values[omega] = expcm_fitprefs.omega
                    values[pirAx] = expcm_fitprefs.pi_codon[r][x]
                    values[pirAy] = expcm_fitprefs.pi_codon[r][y]
                    Qxy = expcm_fitprefs.Qxy[x][y]

                    # check Prxy values
                    if values[pirAx] == values[pirAy]:

# 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

                      [pirAy, random.uniform(0.01, 0.5)],
                      [omega, random.uniform(0.1, 2.0)]]
            self.assertTrue(abs(values[1][1] - values[2][1]) > diffpref,
                            "choose another random number seed as pirAx and "
                            "pirAy are too close.")
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAx.subs(values)),
                            float(sympy.diff(Frxy, pirAx).subs(values))))
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAy.subs(values)),
                            float(sympy.diff(Frxy, pirAy).subs(values))))
            values[2][1] = values[1][1] * (1 + diffpref)
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAx_equal.subs(
                    values)), float(sympy.diff(Frxy, pirAx).subs(values))))
            self.assertTrue(numpy.allclose(float(dFrxy_dpirAy_equal.subs(
                    values)), float(sympy.diff(Frxy, pirAy).subs(values))))

        expcm_fitprefs = copy.deepcopy(self.expcm_fitprefs)
        for r in range(expcm_fitprefs.nsites):
            for x in range(N_CODON):
                for y in range(N_CODON):
                    if x == y:
                        continue
                    values = {}
                    values[beta] = expcm_fitprefs.beta
                    values[omega] = expcm_fitprefs.omega
                    values[pirAx] = expcm_fitprefs.pi_codon[r][x]
                    values[pirAy] = expcm_fitprefs.pi_codon[r][y]
                    Qxy = expcm_fitprefs.Qxy[x][y]

                    # check Prxy values
                    if values[pirAx] == values[pirAy]:

                        if CODON_TO_AA[x] == CODON_TO_AA[y]: