Commit d0073b78 authored by Marc Arene's avatar Marc Arene
Browse files

Merge branch 'logl_dhmc_vs_bilby' into dev

parents bf547960 0442f4cd
......@@ -554,7 +554,7 @@ if __name__ == '__main__':
sampler.dict_of_trajectories = dict(
H_p_logL_logP=[],
pmom_trajs=[],
qpos=[],
qpos_traj=[],
dlogL=[],
dlogTrajPi_traj=[],
lengths=[]
......@@ -1147,7 +1147,7 @@ if __name__ == '__main__':
# an empty file will be saved and the future load will see
# sampler.samples = [] which will bug the derivations of scales
# from the covariance matrix
if n_traj_already_run == sampler.n_traj_fit:
if sampler.n_traj_hmc_tot == sampler.n_traj_fit:
cut.logger.info(f"Only Phase I and II were asked to be run as n_traj_fit = {sampler.n_traj_fit}. Quitting here.")
sys.exit()
cut.logger.info("----------------------------------------------------------------------------")
......@@ -1448,7 +1448,7 @@ if __name__ == '__main__':
if RUN_CONST.plot_traj:
np.savetxt(sampler.plot_traj_dir + 'H_p_logL_logP.dat', sampler.dict_of_trajectories['H_p_logL_logP'])
np.savetxt(sampler.plot_traj_dir + 'pmom_trajs.dat', sampler.dict_of_trajectories['pmom_trajs'])
np.savetxt(sampler.plot_traj_dir + 'qpos.dat', sampler.dict_of_trajectories['qpos'])
np.savetxt(sampler.plot_traj_dir + 'qpos_traj.dat', sampler.dict_of_trajectories['qpos_traj'])
np.savetxt(sampler.plot_traj_dir + 'dlogL.dat', sampler.dict_of_trajectories['dlogL'])
np.savetxt(sampler.plot_traj_dir + 'dlogTrajPi_traj.dat', sampler.dict_of_trajectories['dlogTrajPi_traj'])
np.savetxt(sampler.plot_traj_dir + 'lengths.dat', sampler.dict_of_trajectories['lengths'], fmt='%.0f')
......
......@@ -66,7 +66,7 @@ if os.path.isfile(outdir + 'config.ini'):
config_parser = ConfigParser()
config_parser.read(config_file_path)
config_dict = pu.config_parser_to_dict(config_parser)
lengthT = config_dict['hmc']['length_num_traj']
# lengthT = config_dict['hmc']['length_num_traj']
else:
print("ERROR: COULD NOT FIND ANY SORT OF CONFIGURATION FILE")
sys.exit()
......@@ -88,6 +88,7 @@ dlogL_file = outdir_plot_traj + 'dlogL.dat'
H_p_logL_logP_file = outdir_plot_traj + 'H_p_logL_logP.dat'
pmom_trajs_file = outdir_plot_traj + 'pmom_trajs.dat'
dlogTrajPi_trajs_file = outdir_plot_traj + 'dlogTrajPi_traj.dat'
lengths_file = outdir_plot_traj + 'lengths.dat'
# # Pb with np.loadtxt(): when there is only one index in the file, the resulting array has a shape = (), but size still equal to 1. Reshaping it puts it with shape = (1,) and hence it can be normally manipulated then
# if search_parameter_indices.size == 1:
......@@ -99,6 +100,7 @@ dlogL = np.loadtxt(dlogL_file).T
H_p_logL_logP = np.loadtxt(H_p_logL_logP_file).T
pmom_trajs = np.loadtxt(pmom_trajs_file).T
dlogTrajPi_trajs = np.loadtxt(dlogTrajPi_trajs_file).T
lengths = np.loadtxt(lengths_file).T
if os.path.exists(outdir + 'sampler_state/phase1/scales.dat'):
scale = np.loadtxt(outdir + 'sampler_state/phase1/scales.dat').T
elif os.path.exists(outdir + 'sampler_state/scales.dat'):
......@@ -109,6 +111,7 @@ else:
# q_pos = pt_fit_traj[search_parameter_indices]
# dlogL = dlogL_all[search_parameter_indices]
# import IPython; IPython.embed();
lengthT = int(lengths[trajectory_index])
idx_start = trajectory_index * (lengthT + 1)
idx_end = (trajectory_index +1) * (lengthT + 1)
pt_fit_traj = pt_fit_traj[:, idx_start: idx_end]
......
......@@ -2,13 +2,15 @@
# Interferometers to run the analysis on.
ifos = H1,L1,V1
approximant = IMRPhenomD_NRTidal
minimum_frequency = 30
minimum_frequency_ifos = {H1: 30.0, L1: 30.0, V1: 30.0}
; minimum_frequency = 30
maximum_frequency = 2048.0
reference_frequency = 20
roq = False
roq_b_matrix_directory = /Users/marcarene/roq/ROQ_data/IMRPhenomPv2/
# 1: sets the PSDs from official GWTC-1 open PSD data; 2: computes PSDs using Welch methods from gwosc open strain data; 3: uses bilby's analytical pre-stored PSD files.
psd = 1
psds_single_file = /Users/marcarene/projects/python/gwhmc/__input_data/GWTC1_PSDs/GWTC1_GW170817_PSDs.dat
phase_marginalization = True
......
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