# Path: phydmslib/constants.py
# N_NT = len(INDEX_TO_NT)
# 
# N_CODON = len(CODON_TO_INDEX)


import random
import unittest
import numpy
import scipy.linalg
import scipy.optimize
import phydmslib.models
from phydmslib.constants import N_NT, N_CODON
        omega = 0.4
        kappa = 2.5
        self.YNGKP_M0 = phydmslib.models.YNGKP_M0(
            self.e_pa, self.nsites, omega=omega, kappa=kappa)
        self.assertTrue(numpy.allclose(omega, self.YNGKP_M0.omega))
        self.assertTrue(numpy.allclose(kappa, self.YNGKP_M0.kappa))

        self.assertTrue(
            numpy.allclose(
                numpy.repeat(1.0, self.nsites),
                self.YNGKP_M0.stationarystate.sum(axis=1)))

        # now check YNGKP_M0 attributes / derivates, updating several times
        for _update in range(2):
            self.params = {
                "omega": random.uniform(0.1, 2),
                "kappa": random.uniform(0.5, 10),
                "mu": random.uniform(0.05, 5.0)}
            self.YNGKP_M0.updateParams(self.params)
            self.check_YNGKP_M0_attributes()
            self.check_YNGKP_M0_derivatives()
            self.check_YNGKP_M0_matrix_exponentials()

    def check_YNGKP_M0_attributes(self):
        """Make sure `YNGKP_M0` has the expected attribute values."""
        self.assertEqual(self.nsites, self.YNGKP_M0.nsites)

        # make sure Prxy has rows summing to zero
        self.assertFalse(numpy.isnan(self.YNGKP_M0.Pxy).any())
        self.assertFalse(numpy.isinf(self.YNGKP_M0.Pxy).any())

# Path: phydmslib/constants.py
# N_NT = len(INDEX_TO_NT)
# 
# N_CODON = len(CODON_TO_INDEX)


# Path: tests/test_YNGKPM0.py
import random
import unittest
import numpy
import scipy.linalg
import scipy.optimize
import phydmslib.models
from phydmslib.constants import N_NT, N_CODON

        omega = 0.4
        kappa = 2.5
        self.YNGKP_M0 = phydmslib.models.YNGKP_M0(
            self.e_pa, self.nsites, omega=omega, kappa=kappa)
        self.assertTrue(numpy.allclose(omega, self.YNGKP_M0.omega))
        self.assertTrue(numpy.allclose(kappa, self.YNGKP_M0.kappa))

        self.assertTrue(
            numpy.allclose(
                numpy.repeat(1.0, self.nsites),
                self.YNGKP_M0.stationarystate.sum(axis=1)))

        # now check YNGKP_M0 attributes / derivates, updating several times
        for _update in range(2):
            self.params = {
                "omega": random.uniform(0.1, 2),
                "kappa": random.uniform(0.5, 10),
                "mu": random.uniform(0.05, 5.0)}
            self.YNGKP_M0.updateParams(self.params)
            self.check_YNGKP_M0_attributes()
            self.check_YNGKP_M0_derivatives()
            self.check_YNGKP_M0_matrix_exponentials()

    def check_YNGKP_M0_attributes(self):
        """Make sure `YNGKP_M0` has the expected attribute values."""
        self.assertEqual(self.nsites, self.YNGKP_M0.nsites)

        # make sure Prxy has rows summing to zero
        self.assertFalse(numpy.isnan(self.YNGKP_M0.Pxy).any())
        self.assertFalse(numpy.isinf(self.YNGKP_M0.Pxy).any())

        diag = numpy.eye(N_CODON, dtype="bool")