Skip to content

Commit

Permalink
Fix #77 triggered for python3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
johnveitch committed Dec 7, 2020
1 parent 38d9870 commit 7fe5edd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cpnest/cpnest.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,19 @@ def get_posterior_samples(self, filename='posterior.dat'):
os.system('rm {0}'.format(os.path.join(self.NS.output_folder,file)))

# first deal with the prior samples
self.prior_samples = stack_arrays([p for p in prior_samples])
if filename:
np.savetxt(os.path.join(
if len(prior_samples)>0:
self.prior_samples = stack_arrays([p for p in prior_samples])
if filename:
np.savetxt(os.path.join(
self.NS.output_folder,'prior.dat'),
self.prior_samples.ravel(),
header=' '.join(self.prior_samples.dtype.names),
newline='\n',delimiter=' ')
# now stack all the mcmc chains
self.mcmc_samples = stack_arrays([p for p in mcmc_samples])
if filename:
np.savetxt(os.path.join(
if len(mcmc_samples)>0:
self.mcmc_samples = stack_arrays([p for p in mcmc_samples])
if filename:
np.savetxt(os.path.join(
self.NS.output_folder,'mcmc.dat'),
self.mcmc_samples.ravel(),
header=' '.join(self.mcmc_samples.dtype.names),
Expand Down

0 comments on commit 7fe5edd

Please sign in to comment.