How to use the emcee.__version__ function in emcee

To help you get started, we’ve selected a few emcee examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PhasesResearchLab / ESPEI / espei / espei_script.py View on Github external
def log_version_info():
    """Print version info to the log"""
    logging.info('espei version       ' + str(espei.__version__))
    logging.debug('pycalphad version   ' + str(pycalphad.__version__))
    logging.debug('dask version        ' + str(dask.__version__))
    logging.debug('distributed version ' + str(distributed.__version__))
    logging.debug('sympy version       ' + str(sympy.__version__))
    logging.debug('symengine version   ' + str(symengine.__version__))
    logging.debug('emcee version       ' + str(emcee.__version__))
    logging.info("If you use ESPEI for work presented in a publication, we ask that you cite the following paper:\n    {}".format(espei.__citation__))
github cosmo-ethz / CosmoHammer / cosmoHammer / CosmoHammerSampler.py View on Github external
def createEmceeSampler(self, callable, **kwargs):
        """
        Factory method to create the emcee sampler
        """
        if self.isMaster(): self.log("Using emcee "+str(emcee.__version__))
        return emcee.EnsembleSampler(self.nwalkers, 
                                     self.paramCount, 
                                     callable, 
                                     threads=self.threadCount, 
                                     **kwargs)
github phoebe-project / phoebe2 / phoebe / solverbackends / solverbackends.py View on Github external
def run_checks(self, b, solver, compute, **kwargs):
        # check whether emcee is installed

        if not _use_emcee:
            raise ImportError("could not import emcee")

        if LooseVersion(emcee.__version__) < LooseVersion("3.0.0"):
            raise ImportError("emcee backend requires emcee 3.0+, {} found".format(emcee.__version__))

        solver_ps = b.get_solver(solver=solver, **_skip_filter_checks)
        if not len(solver_ps.get_value(qualifier='init_from', init_from=kwargs.get('init_from', None))):
            raise ValueError("cannot run emcee without any distributions in init_from")

        # require sigmas for all enabled datasets
        datasets = b.filter(compute=compute, qualifier='enabled', value=True).datasets
        for sigma_param in b.filter(qualifier='sigmas', dataset=datasets, check_visible=True, check_default=True).to_list():
            if not len(sigma_param.get_value()):
                times = b.get_value(qualifier='times', dataset=sigma_param.dataset, component=sigma_param.component, **_skip_filter_checks)
                if len(times):
                    raise ValueError("emcee requires sigmas for all datasets where times exist (not found for {})".format(sigma_param.twig))
github lmfit / lmfit-py / lmfit / minimizer.py View on Github external
from scipy.sparse import issparse
from scipy.sparse.linalg import LinearOperator
from scipy.stats import cauchy as cauchy_dist
from scipy.stats import norm as norm_dist
from scipy.version import version as scipy_version
import uncertainties

from ._ampgo import ampgo
from .parameter import Parameter, Parameters
from .printfuncs import fitreport_html_table

# check for EMCEE
try:
    import emcee
    from emcee.autocorr import AutocorrError
    HAS_EMCEE = int(emcee.__version__[0]) >= 3
except ImportError:
    HAS_EMCEE = False

# check for pandas
try:
    import pandas as pd
    from pandas import isnull
    HAS_PANDAS = True
except ImportError:
    HAS_PANDAS = False
    isnull = np.isnan

# check for numdifftools
try:
    import numdifftools as ndt
    HAS_NUMDIFFTOOLS = True
github phoebe-project / phoebe2 / phoebe / solverbackends / solverbackends.py View on Github external
def run_checks(self, b, solver, compute, **kwargs):
        # check whether emcee is installed

        if not _use_emcee:
            raise ImportError("could not import emcee")

        if LooseVersion(emcee.__version__) < LooseVersion("3.0.0"):
            raise ImportError("emcee backend requires emcee 3.0+, {} found".format(emcee.__version__))

        solver_ps = b.get_solver(solver=solver, **_skip_filter_checks)
        if not len(solver_ps.get_value(qualifier='init_from', init_from=kwargs.get('init_from', None))):
            raise ValueError("cannot run emcee without any distributions in init_from")

        # require sigmas for all enabled datasets
        datasets = b.filter(compute=compute, qualifier='enabled', value=True).datasets
        for sigma_param in b.filter(qualifier='sigmas', dataset=datasets, check_visible=True, check_default=True).to_list():
            if not len(sigma_param.get_value()):
                times = b.get_value(qualifier='times', dataset=sigma_param.dataset, component=sigma_param.component, **_skip_filter_checks)
                if len(times):
                    raise ValueError("emcee requires sigmas for all datasets where times exist (not found for {})".format(sigma_param.twig))
github dfm / emcee / emcee / backends / fits.py View on Github external
def reset(self, nwalkers, ndim):
        """Clear the state of the chain and empty the backend

        Args:
            nwalkers (int): The size of the ensemble
            ndim (int): The number of dimensions

        """
        with self.open("rw", clobber=True) as f:
            header = dict(
                version=__version__,
                init=1,
                nwalkers=nwalkers,
                ndim=ndim,
                blobs=0,
                iterat=0,
            )
            f.write(None, header=header)
github waqasbhatti / astrobase / astrobase / lcfit / __init__.py View on Github external
from .sinusoidal import fourier_fit_magseries
from .nonphysical import (
    spline_fit_magseries,
    savgol_fit_magseries,
    legendre_fit_magseries
)

from .eclipses import gaussianeb_fit_magseries

try:
    import batman
    import emcee
    import corner
    import h5py

    if int(emcee.__version__[0]) >= 3:
        from .transits import (
            mandelagol_fit_magseries,
            mandelagol_and_line_fit_magseries,
            traptransit_fit_magseries
        )
    else:
        from .transits import (
            traptransit_fit_magseries
        )

except Exception as e:
        from .transits import (
            traptransit_fit_magseries
github phoebe-project / phoebe2 / phoebe / solverbackends / solverbackends.py View on Github external
def run_checks(self, b, solver, compute, **kwargs):
        # check whether emcee is installed

        if not _use_emcee:
            raise ImportError("could not import emcee, schwimmbad")

        if LooseVersion(emcee.__version__) < LooseVersion("3.0.0"):
            raise ImportError("emcee backend requires emcee 3.0+, {} found".format(emcee.__version__))

        solver_ps = b.get_solver(solver)
        if not len(solver_ps.get_value(qualifier='init_from', init_from=kwargs.get('init_from', None))):
            raise ValueError("cannot run emcee without any distributions in init_from")

        # require sigmas for all enabled datasets
        computes = solver_ps.get_value(qualifier='compute', compute=kwargs.get('compute', None), **_skip_filter_checks)
        datasets = b.filter(compute=computes, qualifier='enabled', value=True).datasets
        for sigma_param in b.filter(qualifier='sigmas', dataset=datasets, check_visible=True).to_list():
            if not len(sigma_param.get_value()):
                raise ValueError("emcee requires sigmas for all datasets (not found for {})".format(sigma_param.twig))
github waqasbhatti / astrobase / astrobase / lcfit / transits.py View on Github external
from scipy.optimize import minimize as spminimize, curve_fit

from astropy import units as units
from numpy.polynomial.legendre import Legendre

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

try:
    import batman
    import emcee
    import corner
    import h5py

    if int(emcee.__version__[0]) >= 3:
        mandel_agol_dependencies = True
    else:
        mandel_agol_dependencies = False

except Exception:
    mandel_agol_dependencies = False

try:
    from astroquery.vizier import Vizier
    vizier_dependency = True
    from astrobase.services.limbdarkening import get_tess_limb_darkening_guesses
except Exception:
    vizier_dependency = False

from ..lcmodels import transits
from ..lcmath import sigclip_magseries
github waqasbhatti / astrobase / astrobase / varbase / lcfit.py View on Github external
from astrobase.lcfit.sinusoidal import fourier_fit_magseries
from astrobase.lcfit.nonphysical import (
    spline_fit_magseries,
    savgol_fit_magseries,
    legendre_fit_magseries
)

from astrobase.lcfit.eclipses import gaussianeb_fit_magseries

try:
    import batman
    import emcee
    import corner

    if int(emcee.__version__[0]) >= 3:
        from astrobase.lcfit.transits import (
            mandelagol_fit_magseries,
            mandelagol_and_line_fit_magseries,
            traptransit_fit_magseries
        )
    else:
        from astrobase.lcfit.transits import (
            traptransit_fit_magseries
        )

except Exception as e:
        from astrobase.lcfit.transits import (
            traptransit_fit_magseries