Esempio n. 1
0
    def fit_polychord(self,
                      n_live_points=1000,
                      n_chords=None,
                      basename='polychains/1-',
                      **kwargs):
        import pypolychord
        self._pchord_basename = basename

        if hasattr(self, 'which'): self.n_dim = 9 + 6 * self.lc.n_planets
        else: self.n_dim = 5 + 6 * self.lc.n_planets

        if n_chords is not None:
            self.n_chords = n_chords
        else:
            self.n_chords = 3 * self.n_dim

        pypolychord.run(self.pchord_loglike,
                        self.pchord_prior,
                        self.n_dim,
                        n_live=n_live_points,
                        n_chords=self.n_chords,
                        output_basename=self._pchord_basename,
                        **kwargs)
Esempio n. 2
0
    def fit_polychord(self, n_live_points=1000, n_chords=None, basename="polychains/1-", **kwargs):
        import pypolychord

        self._pchord_basename = basename

        if hasattr(self, "which"):
            self.n_dim = 9 + 6 * self.lc.n_planets
        else:
            self.n_dim = 5 + 6 * self.lc.n_planets

        if n_chords is not None:
            self.n_chords = n_chords
        else:
            self.n_chords = 3 * self.n_dim

        pypolychord.run(
            self.pchord_loglike,
            self.pchord_prior,
            self.n_dim,
            n_live=n_live_points,
            n_chords=self.n_chords,
            output_basename=self._pchord_basename,
            **kwargs
        )
Esempio n. 3
0
        prior_array = np.append(model.pmin, model.pmax)

        def chord_like(ndim, theta, phi):

            # check prior
            if model.mark3LogPrior(theta) != -np.inf:
                return loglike(theta, **loglkwargs)
            else:
                #print 'WARNING: Prior returns -np.inf!!'
                return -np.inf

        n_live = 1000
        ndim = len(p0)

        pypolychord.run(chord_like, ndim, prior_array, n_live=n_live, n_chords=5, \
                       output_basename=args.outDir+"/pcord-")



    if args.sampler == 'multinest':
        print('WARNING: Using MultiNest, will use uniform priors on all parameters')
        import pymultinest

        p0 = model.initParameters(startEfacAtOne=True, fixpstart=False)

        # mark2 loglike
        if args.incJitterEquad:

            ndim = len(p0)

            def myloglike(cube, ndim, nparams):
Esempio n. 4
0
from __future__ import print_function
import numpy
from numpy import cos, pi


import pypolychord

def loglikelihood(params):
	return (numpy.prod(cos(params / 2)) + 2)**5

def prior(pars):
	return (4 + 1) * pi * pars

if __name__ == "__main__":
	ndim = 2
	import os
	if not os.path.exists('chains'): os.mkdir('chains')
	if not os.path.exists('chains/clusters'): os.mkdir('chains/clusters')
	pypolychord.run(loglikelihood, prior, ndim, n_live=500, n_chords=1, output_basename='chains/eggbox-')


from __future__ import print_function
import numpy
from numpy import cos, pi

import pypolychord


def loglikelihood(params):
    return (numpy.prod(cos(params / 2)) + 2)**5


def prior(pars):
    return (4 + 1) * pi * pars


if __name__ == "__main__":
    ndim = 2
    import os
    if not os.path.exists('chains'): os.mkdir('chains')
    if not os.path.exists('chains/clusters'): os.mkdir('chains/clusters')
    pypolychord.run(loglikelihood,
                    prior,
                    ndim,
                    n_live=500,
                    n_chords=1,
                    output_basename='chains/eggbox-')
Esempio n. 6
0
        prior_array = np.append(model.pmin, model.pmax)

        def chord_like(ndim, theta, phi):
            
            # check prior
            if model.mark3LogPrior(theta) != -np.inf:
                return loglike(theta, **loglkwargs)
            else:
                #print 'WARNING: Prior returns -np.inf!!'
                return -np.inf

        n_live = 1000
        ndim = len(p0)

        pypolychord.run(chord_like, ndim, prior_array, n_live=n_live, n_chords=5, \
                       output_basename=args.outDir+"/pcord-")



    if args.sampler == 'multinest':
        print 'WARNING: Using MultiNest, will use uniform priors on all parameters' 
        import pymultinest

        p0 = model.initParameters(startEfacAtOne=True, fixpstart=False)

        # mark2 loglike
        if args.incJitterEquad:

            ndim = len(p0)

            def myloglike(cube, ndim, nparams):