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

set duration to next power of two sec

parent 4a49f752
......@@ -135,6 +135,7 @@ def compute_extended_analysis_dict(mass_1, mass_2, geocent_time, chirp_mass, **a
f_ISCO = Compute_fISCO(R_isco, mass_1, mass_2)
f_ISCO_run = Compute_fISCO(R_isco, m1_min, m2_min)
duration = None
t_end_minus_tc = 2
# f_ISCO = Compute_LAL_fISCO(mass_1 * LAL_MSUN_SI, mass_2 * LAL_MSUN_SI)
# f_ISCO_run = Compute_LAL_fISCO(m1_min * LAL_MSUN_SI, m2_min * LAL_MSUN_SI)
if approximant == 'TaylorF2':
......@@ -153,7 +154,7 @@ def compute_extended_analysis_dict(mass_1, mass_2, geocent_time, chirp_mass, **a
sampling_frequency = 2 * maximum_frequency_ifo
# duration = 64
duration = int(tc_3p5PN) + 1 + 2
duration = int(tc_3p5PN) + 1 + t_end_minus_tc
elif approximant == 'IMRPhenomPv2' and roq:
# cf:
# - https://lscsoft.docs.ligo.org/lalsuite/lalsimulation/group___l_a_l_sim_i_m_r_phenom__c.html#gad3f98acfe9527259a7f73a8ef69a2f7b
......@@ -222,11 +223,14 @@ def compute_extended_analysis_dict(mass_1, mass_2, geocent_time, chirp_mass, **a
sampling_frequency = 2 * maximum_frequency_ifo
# duration = 64
duration = int(tc_3p5PN) + 1 + 2
# duration = int(tc_3p5PN) + 1 + t_end_minus_tc
duration = next_power_of_two(tc_3p5PN + t_end_minus_tc)
# Use an integer because frame files have an integer start_time
# hence when extracting a subpart of it, the index will be exact
start_time = geocent_time - tc_3p5PN
start_time = geocent_time + t_end_minus_tc - duration
# start_time = geocent_time - tc_3p5PN
# start_time = int(geocent_time - tc_3p5PN)
# if duration is None:
# duration = int(geocent_time - start_time) + 1 + 2
......@@ -249,6 +253,9 @@ def compute_extended_analysis_dict(mass_1, mass_2, geocent_time, chirp_mass, **a
return ext_analysis_dict
def next_power_of_two(val):
return 2**int(np.log(val)/np.log(2) + 1)
def get_inj_parameters_and_analysis_dict(inj_file_path='../examples/injection_files/GW170817.ini', **analysis_kwargs):
injection_parameters = ini_file_to_dict(inj_file_path)
......
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