# Path: bmlingam/utils/usr_distrib.py
# def usr_distrib(dist_name, query, param=None, rng=None):
# def _pdf_dblexp(mu, cov, xs):
# def _rnd_dblexp(mu, cov, rng, n_samples):
# def _krt_dblexp(mu, cov):
# def _pdf_mixdblexp(props, mus, covs, xs):
# def _rnd_mixdblexp(props, mus, covs, rng, n_samples):
# def _krt_mixdblexp(props, mus, covs):
# def _pdf_mixnorm(props, mus, covs, xs):
# def _rnd_mixnorm(props, mus, covs, rng, n_samples):
# def _krt_mixnorm(props, mus, covs):
# def rnd_discrete(props, rng, n_samples):
# def wrap_array(x):


import collections
import numpy as np
from itertools import chain
from parse import parse
from bmlingam.utils import dist_names, usr_distrib
    s = s.replace(' ', '')
    p = parse('uniform({},{})', s)

    if p is None:
        return None
    else:
        l = float(p[0])
        u = float(p[1])
        return (l, u)

_dist_name_table = {
    'gmm4_symm_mul': ['m'], # mixture of 4 Gaussians, symmetric and multimodal
    'gmm4_symm_trn': ['n'], # mixture of 4 Gaussians, symmetric and transitional
    'gmm4_symm_uni': ['o'], # mixture of 4 Gaussians, symmetric and unimodal
    'gmm4_asym_mul': ['p'], # mixture of 4 Gaussians, nonsymmetric and multimodal
    'gmm4_asym_trn': ['q'], # mixture of 4 Gaussians, nonsymmetric and transitional
    'gmm4_asym_uni': ['r'], # mixture of 4 Gaussians, nonsymmetric and unimodal
    't5df': ['a'], # Student T with 3 degrees of freedom
    't5df': ['d'], # Student T with 5 degrees of freedom
    'exp': ['e'], # Simple exponential
    'laplace': ['b'], # Double exponential (Laplace)
    'uniform': ['c'], # Uniform
    'dexp2': ['f'], # mixtures of 2 double exponential
    'gmm2_symm_mul': ['g'], # mixture of 2 Gaussians, symmetric and multimodal
    'gmm2_symm_trn': ['h'], # mixture of 2 Gaussians, symmetric and transitional
    'gmm2_symm_uni': ['i'], # mixture of 2 Gaussians, symmetric and unimodal
    'gmm2_asym_mul': ['j'], # mixture of 2 Gaussians, nonsymmetric and multimodal
    'gmm2_asym_trn': ['k'], # mixture of 2 Gaussians, nonsymmetric and transitional
    'gmm2_asym_uni': ['l'], # mixture of 2 Gaussians, nonsymmetric and unimodal
    'gauss': ['s'], # Gaussian distribution

# Path: bmlingam/utils/usr_distrib.py
# def usr_distrib(dist_name, query, param=None, rng=None):
# def _pdf_dblexp(mu, cov, xs):
# def _rnd_dblexp(mu, cov, rng, n_samples):
# def _krt_dblexp(mu, cov):
# def _pdf_mixdblexp(props, mus, covs, xs):
# def _rnd_mixdblexp(props, mus, covs, rng, n_samples):
# def _krt_mixdblexp(props, mus, covs):
# def _pdf_mixnorm(props, mus, covs, xs):
# def _rnd_mixnorm(props, mus, covs, rng, n_samples):
# def _krt_mixnorm(props, mus, covs):
# def rnd_discrete(props, rng, n_samples):
# def wrap_array(x):


# Path: bmlingam/utils/gendata.py
import collections
import numpy as np
from itertools import chain
from parse import parse
from bmlingam.utils import dist_names, usr_distrib

    s = s.replace(' ', '')
    p = parse('uniform({},{})', s)

    if p is None:
        return None
    else:
        l = float(p[0])
        u = float(p[1])
        return (l, u)

_dist_name_table = {
    'gmm4_symm_mul': ['m'], # mixture of 4 Gaussians, symmetric and multimodal
    'gmm4_symm_trn': ['n'], # mixture of 4 Gaussians, symmetric and transitional
    'gmm4_symm_uni': ['o'], # mixture of 4 Gaussians, symmetric and unimodal
    'gmm4_asym_mul': ['p'], # mixture of 4 Gaussians, nonsymmetric and multimodal
    'gmm4_asym_trn': ['q'], # mixture of 4 Gaussians, nonsymmetric and transitional
    'gmm4_asym_uni': ['r'], # mixture of 4 Gaussians, nonsymmetric and unimodal
    't5df': ['a'], # Student T with 3 degrees of freedom
    't5df': ['d'], # Student T with 5 degrees of freedom
    'exp': ['e'], # Simple exponential
    'laplace': ['b'], # Double exponential (Laplace)
    'uniform': ['c'], # Uniform
    'dexp2': ['f'], # mixtures of 2 double exponential
    'gmm2_symm_mul': ['g'], # mixture of 2 Gaussians, symmetric and multimodal
    'gmm2_symm_trn': ['h'], # mixture of 2 Gaussians, symmetric and transitional
    'gmm2_symm_uni': ['i'], # mixture of 2 Gaussians, symmetric and unimodal
    'gmm2_asym_mul': ['j'], # mixture of 2 Gaussians, nonsymmetric and multimodal
    'gmm2_asym_trn': ['k'], # mixture of 2 Gaussians, nonsymmetric and transitional
    'gmm2_asym_uni': ['l'], # mixture of 2 Gaussians, nonsymmetric and unimodal
    'gauss': ['s'], # Gaussian distribution

    'all': dist_names