From 63bcfc6d1caf47b7f2b34419fcabe57ef6ba4e12 Mon Sep 17 00:00:00 2001 From: Sergio Pascual Date: Mar 29 2016 08:02:53 +0000 Subject: Provide python2 package - Fix problem with numpy 1.11 --- diff --git a/python-emcee-ptsampler-int-div.patch b/python-emcee-ptsampler-int-div.patch new file mode 100644 index 0000000..3622891 --- /dev/null +++ b/python-emcee-ptsampler-int-div.patch @@ -0,0 +1,78 @@ +--- emcee-2.1.0/emcee/ptsampler.py 2014-05-22 17:07:35.000000000 +0200 ++++ ptsampler.py 2016-03-29 09:46:41.299369618 +0200 +@@ -56,14 +56,14 @@ + 1.26579, 1.26424, 1.26271, 1.26121, + 1.25973]) + dmax = tstep.shape[0] +- ++ + if ndim > dmax: + # An approximation to the temperature step at large + # dimension + tstep = 1.0 + 2.0*np.sqrt(np.log(4.0))/np.sqrt(ndim) + else: + tstep = tstep[ndim-1] +- ++ + if ntemps is None and Tmax is None: + raise ValueError('must specify one of ``ntemps`` and ``Tmax``') + elif ntemps is None: +@@ -164,7 +164,7 @@ + + self.nwalkers = nwalkers + self.dim = dim +- ++ + if betas is None: + self._betas = default_beta_ladder(self.dim, ntemps=ntemps, Tmax=Tmax) + else: +@@ -305,14 +305,14 @@ + pupdate = p[:, jupdate::2, :] + psample = p[:, jsample::2, :] + +- zs = np.exp(np.random.uniform(low=-np.log(self.a), high=np.log(self.a), size=(self.ntemps, self.nwalkers/2))) ++ zs = np.exp(np.random.uniform(low=-np.log(self.a), high=np.log(self.a), size=(self.ntemps, self.nwalkers//2))) + +- qs = np.zeros((self.ntemps, self.nwalkers/2, self.dim)) ++ qs = np.zeros((self.ntemps, self.nwalkers//2, self.dim)) + for k in range(self.ntemps): +- js = np.random.randint(0, high=self.nwalkers / 2, +- size=self.nwalkers / 2) ++ js = np.random.randint(0, high=self.nwalkers // 2, ++ size=self.nwalkers // 2) + qs[k, :, :] = psample[k, js, :] + zs[k, :].reshape( +- (self.nwalkers / 2, 1)) * (pupdate[k, :, :] - ++ (self.nwalkers // 2, 1)) * (pupdate[k, :, :] - + psample[k, js, :]) + + fn = PTLikePrior(self.logl, self.logp, self.loglargs, +@@ -325,9 +325,9 @@ + self.dim)))) + + qslogls = np.array([r[0] for r in results]).reshape( +- (self.ntemps, self.nwalkers/2)) ++ (self.ntemps, self.nwalkers//2)) + qslogps = np.array([r[1] for r in results]).reshape( +- (self.ntemps, self.nwalkers/2)) ++ (self.ntemps, self.nwalkers//2)) + qslnprob = qslogls * self.betas.reshape((self.ntemps, 1)) \ + + qslogps + +@@ -335,7 +335,7 @@ + - lnprob[:, jupdate::2] + logrs = np.log(np.random.uniform(low=0.0, high=1.0, + size=(self.ntemps, +- self.nwalkers/2))) ++ self.nwalkers//2))) + + accepts = logrs < logpaccept + accepts = accepts.flatten() +@@ -347,7 +347,7 @@ + logl[:, jupdate::2].reshape((-1,))[accepts] = \ + qslogls.reshape((-1,))[accepts] + +- accepts = accepts.reshape((self.ntemps, self.nwalkers/2)) ++ accepts = accepts.reshape((self.ntemps, self.nwalkers//2)) + + self.nprop[:, jupdate::2] += 1.0 + self.nprop_accepted[:, jupdate::2] += accepts diff --git a/python-emcee.spec b/python-emcee.spec index c7334d8..20373f9 100644 --- a/python-emcee.spec +++ b/python-emcee.spec @@ -1,5 +1,5 @@ %global with_python3 1 -%global upname emcee +%global srcname emcee %global common_description \ emcee is a stable, well tested Python implementation of the affine-invariant \ @@ -7,36 +7,41 @@ ensemble sampler for Markov chain Monte Carlo (MCMC) proposed by \ Goodman & Weare (2010). The code is open source and has already been \ used in several published projects in the Astrophysics literature. -Name: python-%{upname} +Name: python-%{srcname} Version: 2.1.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: The Python ensemble sampling toolkit for affine-invariant MCMC License: MIT URL: http://dan.iel.fm/emcee/current/ Source0: https://pypi.python.org/packages/source/e/emcee/emcee-2.1.0.tar.gz +Patch0: python-emcee-ptsampler-int-div.patch BuildRequires: python2-devel BuildRequires: python-nose numpy BuildArch: noarch Requires: numpy +%{?python_provide:%python_provide python-%{srcname}} + + %description %{common_description} %if 0%{?with_python3} -%package -n python3-%{upname} +%package -n python3-%{srcname} Summary: The Python ensemble sampling toolkit for affine-invariant MCMC BuildRequires: python3-devel BuildRequires: python3-nose python3-numpy Requires: python3-numpy -%description -n python3-%{upname} +%description -n python3-%{srcname} %{common_description} %endif # with_python3 %prep -%setup -qn %{upname}-%{version} +%setup -qn %{srcname}-%{version} +%patch0 -p1 # Delete first line if it starts with shebang pushd emcee @@ -81,16 +86,22 @@ popd %files -%doc AUTHORS.rst HISTORY.rst README.rst LICENSE +%doc AUTHORS.rst HISTORY.rst README.rst +%license LICENSE %{python2_sitelib}/* %if 0%{?with_python3} -%files -n python3-%{upname} -%doc AUTHORS.rst HISTORY.rst README.rst LICENSE +%files -n python3-%{srcname} +%doc AUTHORS.rst HISTORY.rst README.rst +%license LICENSE %{python3_sitelib}/* %endif # with_python3 %changelog +* Tue Mar 29 2016 Sergio Pascual - 2.1.0-5 +- Provide python2 package +- Fix problem with numpy 1.11 + * Thu Feb 04 2016 Fedora Release Engineering - 2.1.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild