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

maximum_frequency_of_analysis => maximum_frequency_ifo

parent 932464db
......@@ -173,7 +173,7 @@ if __name__=='__main__':
print("\nInjection parameters dictionary:")
pu.print_dict(injection_parameters)
minimum_frequency = injection_parameters['meta']['minimum_frequency']
maximum_frequency_of_analysis = injection_parameters['meta']['maximum_frequency_of_analysis']
maximum_frequency_ifo = injection_parameters['meta']['maximum_frequency_ifo']
duration = injection_parameters['meta']['duration']
sampling_frequency = injection_parameters['meta']['sampling_frequency']
f_high = injection_parameters['meta']['f_high']
......@@ -190,7 +190,7 @@ if __name__=='__main__':
# The minimun frequency for each interferometer needs to be set if we want the strain derived from the psd to start being non zero at that frequency and not at the default one which is 20Hz
for ifo in interferometers:
ifo.minimum_frequency = minimum_frequency
ifo.maximum_frequency = maximum_frequency_of_analysis
ifo.maximum_frequency = maximum_frequency_ifo
# The following line is called automatically when setting the PSDs, which we donnot do here hence the line.
# Stangely however, in bilby, the `Interferometer` class does not have `duration` and `sampling_frequency` arguments when the `InterferometerStrainData` and the `InterferometerList` classes do. Hence one needs to set those arguments for the list of `InterferometerStrainData` so that the `InterferometerList` inherits from them. The values will be inherited from the first one in the list...
# Why do `interferometers.duration` and `interferometers.sampling_frequency` need to be set ? => Because I use them when creating my waveform_generator in bilby_wavefor
......@@ -221,7 +221,7 @@ if __name__=='__main__':
interferometers[i].fd_strain = interferometers[i].strain_data.frequency_domain_strain
# COMPUTE AND PRINT SNR
injection_parameters['meta']['maximum_frequency_of_generated_waveform'] = injection_parameters['meta']['maximum_frequency_of_analysis']
injection_parameters['meta']['maximum_frequency_of_generated_waveform'] = injection_parameters['meta']['maximum_frequency_ifo']
template_ifos = bilby_wv.WaveForm_ThreeDetectors(injection_parameters, minimum_frequency, interferometers)
logL, Snr, opt_snr_Best = logL_snr.main(template_ifos, interferometers, True)
......
......@@ -71,7 +71,7 @@ if __name__=='__main__':
pu.print_dict(injection_parameters)
minimum_frequency = injection_parameters['meta']['minimum_frequency']
maximum_frequency = 2048
# maximum_frequency_of_analysis = injection_parameters['meta']['maximum_frequency_of_analysis']
# maximum_frequency_ifo = injection_parameters['meta']['maximum_frequency_ifo']
duration = injection_parameters['meta']['duration']
sampling_frequency = injection_parameters['meta']['sampling_frequency']
f_high = injection_parameters['meta']['f_high']
......@@ -86,7 +86,7 @@ if __name__=='__main__':
for ifo in interferometers:
# ifo.__class__ = bilby_detector.Interferometer
ifo.minimum_frequency = minimum_frequency
ifo.maximum_frequency = maximum_frequency_of_analysis
ifo.maximum_frequency = maximum_frequency_ifo
# The following line is called automatically when setting the PSDs, which we donnot do here hence the line.
# Stangely however, in bilby, the `Interferometer` class does not have `duration` and `sampling_frequency` arguments when the `InterferometerStrainData` and the `InterferometerList` classes do. Hence one needs to set those arguments for the list of `InterferometerStrainData` so that the `InterferometerList` inherits from them. The values will be inherited from the first one in the list...
# Why do `interferometers.duration` and `interferometers.sampling_frequency` need to be set ? => Because I use them when creating my waveform_generator in bilby_wavefor
......
......@@ -49,7 +49,7 @@ if __name__=='__main__':
injection_parameters = set_inj.ini_file_to_dict()
pu.print_dict(injection_parameters)
minimum_frequency = injection_parameters['meta']['minimum_frequency']
maximum_frequency_of_analysis = injection_parameters['meta']['maximum_frequency_of_analysis']
maximum_frequency_ifo = injection_parameters['meta']['maximum_frequency_ifo']
duration = injection_parameters['meta']['duration']
sampling_frequency = injection_parameters['meta']['sampling_frequency']
f_high = injection_parameters['meta']['f_high']
......@@ -63,7 +63,7 @@ if __name__=='__main__':
interferometers = bilby.gw.detector.InterferometerList(ifos_chosen)
for ifo in interferometers:
ifo.minimum_frequency = minimum_frequency
ifo.maximum_frequency = maximum_frequency_of_analysis
ifo.maximum_frequency = maximum_frequency_ifo
# The following line is called automatically when setting the PSDs, which we donnot do here hence the line.
# Stangely however, in bilby, the `Interferometer` class does not have `duration` and `sampling_frequency` arguments when the `InterferometerStrainData` and the `InterferometerList` classes do. Hence one needs to set those arguments for the list of `InterferometerStrainData` so that the `InterferometerList` inherits from them. The values will be inherited from the first one in the list...
# Why do `interferometers.duration` and `interferometers.sampling_frequency` need to be set ? => Because I use them when creating my waveform_generator in bilby_wavefor
......@@ -94,6 +94,6 @@ if __name__=='__main__':
# COMPUTE AND PRINT SNR
# Generate a template up to frequency of analysis
injection_parameters['meta']['maximum_frequency_of_generated_waveform'] = injection_parameters['meta']['maximum_frequency_of_analysis']
injection_parameters['meta']['maximum_frequency_of_generated_waveform'] = injection_parameters['meta']['maximum_frequency_ifo']
template_ifos = bilby_wv.WaveForm_ThreeDetectors(injection_parameters, minimum_frequency, interferometers)
logLBest, mf_snr_best, opt_snr_Best = main(template_ifos, interferometers, True)
......@@ -129,8 +129,8 @@ def ini_file_to_dict(file_path='../examples/GW170817.ini'):
f_high = f_ISCO
f_high_run = f_ISCO_run
maximum_frequency_injected_waveform = 0
# maximum_frequency_of_analysis = min(4096 * 4, f_high_run)
maximum_frequency_of_analysis = f_high_run
# maximum_frequency_ifo = min(4096 * 4, f_high_run)
maximum_frequency_ifo = f_high_run
maximum_frequency_of_generated_waveform = 0
sampling_frequency = 2 * f_high_run
duration = tc_3p5PN + 2
......@@ -152,9 +152,9 @@ def ini_file_to_dict(file_path='../examples/GW170817.ini'):
minimum_frequency = rescaled_params['flow']
# maximum_frequency_injected_waveform = rescaled_params['fhigh']
maximum_frequency_injected_waveform = min(2048, rescaled_params['fhigh'])
maximum_frequency_of_analysis = min(2048, rescaled_params['fhigh'])
maximum_frequency_ifo = min(2048, rescaled_params['fhigh'])
maximum_frequency_of_generated_waveform = None
# maximum_frequency_of_analysis = rescaled_params['fhigh']
# maximum_frequency_ifo = rescaled_params['fhigh']
sampling_frequency = 2 * max(2048, rescaled_params['fhigh'])
duration = rescaled_params['seglen']
reference_frequency = 20 * scale_factor
......@@ -182,16 +182,16 @@ def ini_file_to_dict(file_path='../examples/GW170817.ini'):
M_min_sec = (m1_min + m2_min) * LAL_MTSUN_SI
f_high = f_CUT / M_sec
f_high_run = f_CUT / M_min_sec
maximum_frequency_of_analysis = min(2048, f_high_run)
# maximum_frequency_of_analysis = min(4 * 4096, f_high_run)
maximum_frequency_injected_waveform = maximum_frequency_of_analysis
maximum_frequency_ifo = min(2048, f_high_run)
# maximum_frequency_ifo = min(4 * 4096, f_high_run)
maximum_frequency_injected_waveform = maximum_frequency_ifo
maximum_frequency_of_generated_waveform = None
sampling_frequency = 2 * maximum_frequency_of_analysis
sampling_frequency = 2 * maximum_frequency_ifo
duration = 64
reference_frequency = 20
# import IPython; IPython.embed();
# maximum_frequency_of_analysis = min(4096 * 4, f_high_run)
# maximum_frequency_of_analysis = max(4096, f_high)
# maximum_frequency_ifo = min(4096 * 4, f_high_run)
# maximum_frequency_ifo = max(4096, f_high)
# sampling_frequency = 4096
# sampling_frequency = 4397
start_time = injection_parameters['geocent_time'] - tc_3p5PN
......@@ -199,7 +199,7 @@ def ini_file_to_dict(file_path='../examples/GW170817.ini'):
meta_params = dict(
minimum_frequency = minimum_frequency,
maximum_frequency_injected_waveform = maximum_frequency_injected_waveform,
maximum_frequency_of_analysis = maximum_frequency_of_analysis,
maximum_frequency_ifo = maximum_frequency_ifo,
maximum_frequency_of_generated_waveform = maximum_frequency_of_generated_waveform,
sampling_frequency = sampling_frequency,
duration = duration,
......@@ -215,7 +215,7 @@ def ini_file_to_dict(file_path='../examples/GW170817.ini'):
conf.minimum_frequency = minimum_frequency
conf.approximant = approximant
conf.maximum_frequency_of_analysis = maximum_frequency_of_analysis
conf.maximum_frequency_ifo = maximum_frequency_ifo
conf.reference_frequency = reference_frequency
# These two lines have been added to be able to plot the injected value on phi_c on the corner plots. Otherwise the `phi_c` and `tc_3p5PN` keys are not used in the code.
......
......@@ -14,9 +14,10 @@ def get_source_frame_polarizations(parameters, minimum_frequency, interferometer
# breakpoint()
# Fixed arguments passed into the source model. The analysis starts at 40 Hz.
if 'meta' in parameters.keys():
# waveform_arguments = dict(waveform_approximant=parameters['meta']['approximant'], reference_frequency=parameters['meta']['reference_frequency'], minimum_frequency=minimum_frequency, maximum_frequency=0)
waveform_arguments = dict(waveform_approximant=parameters['meta']['approximant'], reference_frequency=parameters['meta']['reference_frequency'], minimum_frequency=minimum_frequency, maximum_frequency=parameters['meta']['maximum_frequency_of_generated_waveform'])
else:
waveform_arguments = dict(waveform_approximant=conf.approximant, reference_frequency=conf.reference_frequency, minimum_frequency=conf.minimum_frequency, maximum_frequency=conf.maximum_frequency_of_analysis)
waveform_arguments = dict(waveform_approximant=conf.approximant, reference_frequency=conf.reference_frequency, minimum_frequency=conf.minimum_frequency, maximum_frequency=conf.maximum_frequency_ifo)
# Create the waveform_generator using a LAL Binary Neutron Star source function
waveform_generator = bilby.gw.WaveformGenerator(
......@@ -764,7 +765,7 @@ if __name__=='__main__':
injection_parameters = set_inj.ini_file_to_dict()
pu.print_dict(injection_parameters)
minimum_frequency = injection_parameters['meta']['minimum_frequency']
maximum_frequency_of_analysis = injection_parameters['meta']['maximum_frequency_of_analysis']
maximum_frequency_ifo = injection_parameters['meta']['maximum_frequency_ifo']
duration = injection_parameters['meta']['duration']
sampling_frequency = injection_parameters['meta']['sampling_frequency']
f_high = injection_parameters['meta']['f_high']
......@@ -778,7 +779,7 @@ if __name__=='__main__':
interferometers = bilby.gw.detector.InterferometerList(ifos_chosen)
for ifo in interferometers:
ifo.minimum_frequency = minimum_frequency
ifo.maximum_frequency = maximum_frequency_of_analysis
ifo.maximum_frequency = maximum_frequency_ifo
# The following line is called automatically when setting the PSDs, which we donnot do here hence the line.
# Stangely however, in bilby, the `Interferometer` class does not have `duration` and `sampling_frequency` arguments when the `InterferometerStrainData` and the `InterferometerList` classes do. Hence one needs to set those arguments for the list of `InterferometerStrainData` so that the `InterferometerList` inherits from them. The values will be inherited from the first one in the list...
# Why do `interferometers.duration` and `interferometers.sampling_frequency` need to be set ? => Because I use them when creating my waveform_generator in bilby_wavefor
......@@ -835,7 +836,7 @@ if __name__=='__main__':
# plt.plot(time[idx_start:idx_stop], h_wave_td[ifo_index][idx_start:idx_stop], linewidth=1, color=ifo_colors[ifo_index], label=interferometers[ifo_index].name)
plt.axvline(x=time_until_fISCO, linewidth=1, color='blue', label='time to reach fISCO')
plt.axvline(x=injection_parameters['meta']['tc_3p5PN'], color='black', linewidth=1, label='tc')
text = 'f_low = {:.2f}Hz\nf_ISCO = {:.2f}Hz\nmax_freq = {:.2f}Hz\nsamp_freq= {:.2f}Hz\ntc_3p5PN = {:.4f}s'.format(minimum_frequency, fISCO, injection_parameters['meta']['maximum_frequency_of_analysis'], sampling_frequency, injection_parameters['meta']['tc_3p5PN'])
text = 'f_low = {:.2f}Hz\nf_ISCO = {:.2f}Hz\nmax_freq = {:.2f}Hz\nsamp_freq= {:.2f}Hz\ntc_3p5PN = {:.4f}s'.format(minimum_frequency, fISCO, injection_parameters['meta']['maximum_frequency_ifo'], sampling_frequency, injection_parameters['meta']['tc_3p5PN'])
plt.text(duration-7, h_wave_td[0].max()*2/3, text, fontsize=10)
# import IPython; IPython.embed()
plt.xlabel("Time (sec)")
......
......@@ -38,7 +38,7 @@ dlogL = 'dlogL1'
minimum_frequency = 30
approximant = 'TaylorF2'
maximum_frequency_injected_waveform = 0
maximum_frequency_of_analysis = 0
maximum_frequency_ifo = 0
reference_frequency = 0
debug = False
......
......@@ -68,7 +68,7 @@ if __name__=='__main__':
injection_parameters = set_inj.ini_file_to_dict(opts.inj_file)
pu.print_dict(injection_parameters)
minimum_frequency = injection_parameters['meta']['minimum_frequency']
maximum_frequency_of_analysis = injection_parameters['meta']['maximum_frequency_of_analysis']
maximum_frequency_ifo = injection_parameters['meta']['maximum_frequency_ifo']
duration = injection_parameters['meta']['duration']
sampling_frequency = injection_parameters['meta']['sampling_frequency']
f_high = injection_parameters['meta']['f_high']
......@@ -84,7 +84,7 @@ if __name__=='__main__':
for ifo in interferometers:
# ifo.__class__ = bilby_detector.Interferometer
ifo.minimum_frequency = minimum_frequency
ifo.maximum_frequency = maximum_frequency_of_analysis
ifo.maximum_frequency = maximum_frequency_ifo
# The following line is called automatically when setting the PSDs, which we donnot do here hence the line.
# Stangely however, in bilby, the `Interferometer` class does not have `duration` and `sampling_frequency` arguments when the `InterferometerStrainData` and the `InterferometerList` classes do. Hence one needs to set those arguments for the list of `InterferometerStrainData` so that the `InterferometerList` inherits from them. The values will be inherited from the first one in the list...
# Why do `interferometers.duration` and `interferometers.sampling_frequency` need to be set ? => Because I use them when creating my waveform_generator in bilby_wavefor
......@@ -136,7 +136,7 @@ if __name__=='__main__':
# Load the parameters describing the valid parameters for the basis.
params = injection_parameters['roq']['rescaled_params'].copy()
weights_file_path = outdir + '{:.0f}Hz_{:.0f}Hz_{:.0f}Hz_{:.0f}s_weights.json'.format(params['flow'], injection_parameters['meta']['maximum_frequency_of_analysis'], injection_parameters['meta']['maximum_frequency_injected_waveform'], params['seglen'])
weights_file_path = outdir + '{:.0f}Hz_{:.0f}Hz_{:.0f}Hz_{:.0f}s_weights.json'.format(params['flow'], injection_parameters['meta']['maximum_frequency_ifo'], injection_parameters['meta']['maximum_frequency_injected_waveform'], params['seglen'])
# injection_parameters = dict(
# mass_1=36.0, mass_2=29.0, a_1=0.4, a_2=0.3, tilt_1=0.0, tilt_2=0.0,
......
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