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

first comments on phase 1

parent d7bd2587
......@@ -649,13 +649,13 @@ if __name__ == '__main__':
cut.logger.info(f'Continuing phase 1 from traj nb {n_traj_already_run} for {l_end - l_start} more trajectories.')
try:
for traj_index in range(l_start, l_end):
# generation of epsilon according to a Gaussian law with limitations between 0.001 and 0.01
# I import Yann's random numbers generated here since I can't use the same random number generator as his. This way I should be able to reproduce exactly the same chain and compare my results with his precisely.
# Generation of epsilon according to a Gaussian law with limitations between 0.001 and 0.01
rannum = randGen.normal(loc=0, scale=1.5)
epsilon = sampler.epsilon0 + rannum * 1.0e-3
if epsilon <= 0.001: epsilon = 0.001
if epsilon >= 0.01: epsilon = 0.01
# Run a numerical trajectory and retrieve the data.
q_pos, logL, dlogL, qpos_from_traj, dlogL_from_traj, Accept, a, proba_acc = bht.NumericalGradientLeapfrog_ThreeDetectors(q_pos, logL, dlogL, randGen, epsilon, sampler.length_num_traj, traj_index, sampler)
# Evaluation of acceptante rate
......@@ -663,9 +663,13 @@ if __name__ == '__main__':
if Accept == 1:
count += 1
traj_status = "** ACCEPTED **"
# Update the training set with the new data points.
fnr.update_train_data(qpos_traj_phase1, dlogL_traj_phase1, qpos_from_traj, dlogL_from_traj)
# Very circonvoluted way of setting the matched filter snr value of the new point in the chain. If trajectory was accepted as here, we use the last value computed of the trajectory and otherwise don't modify mf_snr which will keep the previous value.
# Update the `mf_snr` variable with the value that was computed at the end of the trajectory.
# Otherwise (ie `if Accept == 0`), `mf_snr` keeps the same value as before.
# However this assumes that the network_snr is indeed updated at the end of each trajectory
# which I can't find in the code at the moment...
if sampler.likelihood.phase_marginalization:
mf_snr = sampler.likelihood.snr_dict['network']['matched_filter_snr_phasemarg']
else:
......
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