# 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

        # 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")
        self.assertTrue(numpy.allclose(0, numpy.sum(self.YNGKP_M0.Pxy[0],
                                       axis=1)))
        self.assertTrue(numpy.allclose(0, self.YNGKP_M0.Pxy[0].sum()))
        self.assertTrue((self.YNGKP_M0.Pxy[0][diag] <= 0).all())
        self.assertTrue((self.YNGKP_M0.Pxy[0][~diag] >= 0).all())
        assert self.YNGKP_M0.Pxy.shape == (1, N_CODON, N_CODON)
        for param in self.YNGKP_M0.dPxy:
            assert self.YNGKP_M0.dPxy[param].shape == (1, N_CODON, N_CODON)
            assert self.YNGKP_M0.B[param].shape == (1, N_CODON, N_CODON)
        assert self.YNGKP_M0.Ainv.shape == (1, N_CODON, N_CODON)

# 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


        # 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")
        self.assertTrue(numpy.allclose(0, numpy.sum(self.YNGKP_M0.Pxy[0],
                                       axis=1)))
        self.assertTrue(numpy.allclose(0, self.YNGKP_M0.Pxy[0].sum()))
        self.assertTrue((self.YNGKP_M0.Pxy[0][diag] <= 0).all())
        self.assertTrue((self.YNGKP_M0.Pxy[0][~diag] >= 0).all())
        assert self.YNGKP_M0.Pxy.shape == (1, N_CODON, N_CODON)
        for param in self.YNGKP_M0.dPxy:
            assert self.YNGKP_M0.dPxy[param].shape == (1, N_CODON, N_CODON)
            assert self.YNGKP_M0.B[param].shape == (1, N_CODON, N_CODON)
        assert self.YNGKP_M0.Ainv.shape == (1, N_CODON, N_CODON)

        assert self.YNGKP_M0.A.shape == (1, N_CODON, N_CODON)