# Path: phydmslib/constants.py
# N_CODON = len(CODON_TO_INDEX)
# 
# N_NT = len(INDEX_TO_NT)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}
# 
# N_AA = len(INDEX_TO_AA)
# 
# CODON_NT_COUNT = numpy.zeros((N_NT, N_CODON), dtype='int')


import random
import unittest
import scipy.linalg
import scipy.optimize
import numpy
import phydmslib.models
from phydmslib.constants import (N_CODON, N_NT, AA_TO_INDEX, N_AA,
                                 CODON_NT_COUNT)
            beta=beta,
            omega2=omega2)
        # now check ExpCM attributes / derivates, updating several times
        for _update in range(2):
            self.params = {
                "omega": random.uniform(0.1, 2),
                "kappa": random.uniform(0.5, 10),
                "beta": random.uniform(0.5, 3),
                "mu": random.uniform(0.05, 5.0),
                "omega2": random.uniform(0.1, 0.3),
            }
            self.model.updateParams(self.params)
            self.assertTrue(numpy.allclose(g, self.model.g))

            self.check_empirical_phi()

            self.check_dQxy_dbeta()

            self.check_dprx_dbeta()

            self.check_ExpCM_attributes()

            self.check_ExpCM_derivatives()

            self.check_ExpCM_matrix_exponentials()

    def check_empirical_phi(self):
        """Check that `phi` gives right `g`, and has right derivative."""
        nt_freqs = [0] * N_NT
        for r in range(self.nsites):

# Path: phydmslib/constants.py
# N_CODON = len(CODON_TO_INDEX)
# 
# N_NT = len(INDEX_TO_NT)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}
# 
# N_AA = len(INDEX_TO_AA)
# 
# CODON_NT_COUNT = numpy.zeros((N_NT, N_CODON), dtype='int')


# Path: tests/test_expcm_divpressure.py
import random
import unittest
import scipy.linalg
import scipy.optimize
import numpy
import phydmslib.models
from phydmslib.constants import (N_CODON, N_NT, AA_TO_INDEX, N_AA,
                                 CODON_NT_COUNT)

            beta=beta,
            omega2=omega2)
        # now check ExpCM attributes / derivates, updating several times
        for _update in range(2):
            self.params = {
                "omega": random.uniform(0.1, 2),
                "kappa": random.uniform(0.5, 10),
                "beta": random.uniform(0.5, 3),
                "mu": random.uniform(0.05, 5.0),
                "omega2": random.uniform(0.1, 0.3),
            }
            self.model.updateParams(self.params)
            self.assertTrue(numpy.allclose(g, self.model.g))

            self.check_empirical_phi()

            self.check_dQxy_dbeta()

            self.check_dprx_dbeta()

            self.check_ExpCM_attributes()

            self.check_ExpCM_derivatives()

            self.check_ExpCM_matrix_exponentials()

    def check_empirical_phi(self):
        """Check that `phi` gives right `g`, and has right derivative."""
        nt_freqs = [0] * N_NT
        for r in range(self.nsites):

            for x in range(N_CODON):