Commit 2cd96f30 authored by Marc Arene's avatar Marc Arene
Browse files

Saving `accepted` boolean in chain_metrics

parent e5a13967
......@@ -643,7 +643,7 @@ if __name__ == '__main__':
else:
mf_snr = sampler.likelihood.snr_dict['network']['matched_filter_snr']
logL2 = sampler.likelihood.snr_dict['network']['log_l_ratio'] # equal to logL?
sampler.chain_metrics.append([mf_snr, logL2, Acc])
sampler.chain_metrics.append([mf_snr, logL2, Acc, Accept])
idx_Mc = sampler.search_parameter_keys.index('chirp_mass')
idx_mu = sampler.search_parameter_keys.index('reduced_mass')
eta = paru.Mc_mu_to_eta(q_pos[idx_Mc], q_pos[idx_mu])
......@@ -1393,9 +1393,12 @@ if __name__ == '__main__':
# Record the position of the chain
sampler.samples.append(q_pos.tolist())
# import IPython; IPython.embed();sys.exit()
mf_snr = sampler.likelihood.snr_dict['network']['matched_filter_snr_phasemarg']
if config_dict['analysis']['phase_marginalization']:
mf_snr = sampler.likelihood.snr_dict['network']['matched_filter_snr_phasemarg']
else:
mf_snr = sampler.likelihood.snr_dict['network']['matched_filter_snr']
logL2 = sampler.likelihood.snr_dict['network']['log_l_ratio'] # equal to logL
sampler.chain_metrics.append([mf_snr, logL2, Acc_phase3])
sampler.chain_metrics.append([mf_snr, logL2, Acc_phase3, Accept])
# Print position of the chain
# if traj_index%int(sampler.n_traj_for_this_run/20000)==0:
......
......@@ -640,7 +640,7 @@ class GWHMCSampler(object):
np.savetxt(state_dir + "qpos_traj_phase1.dat", qpos_traj_phase1, fmt='%.25e')
np.savetxt(state_dir + "dlogL_traj_phase1.dat", dlogL_traj_phase1, fmt='%.25e')
np.savetxt(state_dir + "samples.dat", np.asarray(self.samples), header=' | '.join(self.search_parameter_keys))
np.savetxt(state_dir + "chain_metrics.dat", np.asarray(self.chain_metrics), header=' | '.join(['mf_snr', 'logL', 'Acc']))
np.savetxt(state_dir + "chain_metrics.dat", np.asarray(self.chain_metrics), header=' | '.join(['mf_snr', 'log_l', 'acc', 'accepted']))
if stuck_seq_and_traj_list is None:
stuck_seq_and_traj_list = []
np.savetxt(state_dir + "rejection_sequences.dat", np.asarray(stuck_seq_and_traj_list), fmt='%d', header='traj_nb | rejection_count')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment