Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: Anto Idicherian Lonappan <[email protected]>
  • Loading branch information
antolonappan committed Sep 3, 2023
1 parent e74db19 commit 53f6386
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions marcia/GPconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
config['INTRINSIC_SCATTER']['offset'] = '0.0001'

# Write the configparser object to a file
with open(filename, 'w') as configfile:
config.write(configfile)
#with open(filename, 'w') as configfile:
# config.write(configfile)

# Read the config file and create the GPparams class
class GPConfig:
Expand Down
15 changes: 11 additions & 4 deletions marcia/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def sampler(self,reset=False):
index += 1
converged = np.all(tau * 100 < sampler.iteration)
converged &= np.all(np.abs(old_tau - tau) / tau < 0.01)
print(f'I:{sampler.iteration}, A:{(tau*100)-sampler.iteration}, T:{np.abs(old_tau - tau) / tau}')
if converged:
print(f'Converged at iteration {sampler.iteration}')
print(f'I:{sampler.iteration}, A:{(tau*100)-sampler.iteration}, T:{np.abs(old_tau - tau) / tau}')
break
old_tau = tau
else:
Expand All @@ -82,9 +82,16 @@ def sampler(self,reset=False):
print(f'Already completed {last_iteration} iterations')

def get_burnin(self):
tau = self.HDFBackend.get_autocorr_time()
burnin = int(2 * np.max(tau))
thin = int(0.5 * np.min(tau))
try:
tau = self.HDFBackend.get_autocorr_time()
burnin = int(2 * np.max(tau))
thin = int(0.5 * np.min(tau))
print(f'Burn-in: {burnin} and thin: {thin}')
except:
print('Autocorrelation time could not be calculated, increase the number of iterations')
burnin = 0
thin = 1
print(f'Burn-in: {burnin} and thin: {thin}[DEFAULT VALUES]')
return burnin, thin

def get_chain(self, getdist=False):
Expand Down

0 comments on commit 53f6386

Please sign in to comment.