Skip to content

Commit

Permalink
outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mabitbol committed Feb 20, 2019
1 parent c1e6a88 commit bb8556d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions bbpower/compsep.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ def lnprob(self, params):
lnprob = self.h_and_l_lnlike(params)
else:
lnprob = self.chi_sq_lnlike(params)
#print( (lnprob+prior)*2. )
return prior + lnprob

def emcee_sampler(self):
Expand All @@ -325,9 +324,12 @@ def emcee_sampler(self):
"""
zmask = self.parameters.param_init == 0
self.parameters.param_init[zmask] += 1.e-3 * np.ones_like(zmask)


nwalkers = self.config['nwalkers']
n_iters = self.config['n_iters']
ndim = len(self.parameters.param_init)
pos = [self.parameters.param_init * (1. + 1.e-3*np.random.randn(ndim)) for i in range(nwalkers)]

sampler = emcee.EnsembleSampler(nwalkers, ndim, self.lnprob)
sampler.run_mcmc(pos, n_iters);
return sampler
Expand All @@ -351,8 +353,11 @@ def make_output_dir(self):
def run(self):
self.setup_compsep()
sampler = self.emcee_sampler()

output_dir = self.make_output_dir()
np.save(output_dir + 'chains', sampler.chain)
np.save(self.get_output('param_chains'), sampler.chain)
return

if __name__ == '__main__':
cls = PipelineStage.main()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
entry_points={
'console_scripts':['bbpipe=bbpipe.main:main']
},
install_requires=['pyyaml','parsl<0.6.0','cwlgen']
install_requires=['pyyaml','parsl<0.6.0']
)

0 comments on commit bb8556d

Please sign in to comment.