# Path: phydmslib/constants.py
# N_AA = len(INDEX_TO_AA)
# 
# N_NT = len(INDEX_TO_NT)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}


import random
import unittest
import numpy
import scipy.optimize
import phydmslib.models
from phydmslib.constants import N_AA, N_NT, AA_TO_INDEX
    BASEMODEL = phydmslib.models.ExpCM

    def test_GammaDistributedBeta(self):
        """Initialize, test values, update, test again."""
        random.seed(1)
        numpy.random.seed(1)
        nsites = 10

        # create preference set
        prefs = []
        minpref = 0.01
        for _r in range(nsites):
            rprefs = numpy.random.dirichlet([0.5] * N_AA)
            rprefs[rprefs < minpref] = minpref
            rprefs /= rprefs.sum()
            prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs)))

        if self.BASEMODEL == phydmslib.models.ExpCM:
            paramvalues = {"eta": numpy.random.dirichlet([5] * (N_NT - 1)),
                           "omega": 0.7,
                           "kappa": 2.5,
                           "beta": 1.2,
                           "mu": 0.5}
            basemodel = self.BASEMODEL(prefs)
            assert set(paramvalues.keys()) == set(
                basemodel.freeparams
            ), "{0} vs {1}".format(set(paramvalues.keys()),
                                   set(basemodel.freeparams))
            basemodel.updateParams(paramvalues)
        elif self.BASEMODEL == phydmslib.models.ExpCM_empirical_phi:

# Path: phydmslib/constants.py
# N_AA = len(INDEX_TO_AA)
# 
# N_NT = len(INDEX_TO_NT)
# 
# AA_TO_INDEX = {aa: i for (i, aa) in INDEX_TO_AA.items()}


# Path: tests/test_gammadistributedbeta_model.py
import random
import unittest
import numpy
import scipy.optimize
import phydmslib.models
from phydmslib.constants import N_AA, N_NT, AA_TO_INDEX

    BASEMODEL = phydmslib.models.ExpCM

    def test_GammaDistributedBeta(self):
        """Initialize, test values, update, test again."""
        random.seed(1)
        numpy.random.seed(1)
        nsites = 10

        # create preference set
        prefs = []
        minpref = 0.01
        for _r in range(nsites):
            rprefs = numpy.random.dirichlet([0.5] * N_AA)
            rprefs[rprefs < minpref] = minpref
            rprefs /= rprefs.sum()
            prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs)))

        if self.BASEMODEL == phydmslib.models.ExpCM:
            paramvalues = {"eta": numpy.random.dirichlet([5] * (N_NT - 1)),
                           "omega": 0.7,
                           "kappa": 2.5,
                           "beta": 1.2,
                           "mu": 0.5}
            basemodel = self.BASEMODEL(prefs)
            assert set(paramvalues.keys()) == set(
                basemodel.freeparams
            ), "{0} vs {1}".format(set(paramvalues.keys()),
                                   set(basemodel.freeparams))
            basemodel.updateParams(paramvalues)
        elif self.BASEMODEL == phydmslib.models.ExpCM_empirical_phi:

            g = numpy.random.dirichlet([3] * N_NT)