diff --git a/marcia/GPconfig.py b/marcia/GPconfig.py index ec4f009..11bca39 100644 --- a/marcia/GPconfig.py +++ b/marcia/GPconfig.py @@ -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: diff --git a/marcia/sampler.py b/marcia/sampler.py index 14047be..1b9dac7 100644 --- a/marcia/sampler.py +++ b/marcia/sampler.py @@ -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: @@ -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):