Commit d534f0fd by Uddeepta Deka

added notebook to compute 1d likelihood

parent 0fef33e6
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,13 +5,13 @@ runtag_template = 'y_%.3f_q_%.1e_Ml_%.1f_zl_%.1f_dect_%s_fhi_%.1f_zs_%.1f_m1_%.1 ...@@ -5,13 +5,13 @@ runtag_template = 'y_%.3f_q_%.1e_Ml_%.1f_zl_%.1f_dect_%s_fhi_%.1f_zs_%.1f_m1_%.1
# Values for fixed parameters (adjust as necessary) # Values for fixed parameters (adjust as necessary)
kwargs = { kwargs = {
"Ml":100.0, "zl":0.5, "dect":"ET", "zl":0.5, "dect":"Aplus",
"f_hi":1024.0, "zs":2.0, "m1":20.0, "m2":20.0, "f_hi":1024.0, "zs":2.0, "m1":20.0, "m2":20.0,
"approx":"IMRPhenomXP", "delta_f":1./32, "t_max":200., "dt_fac":7.5 "approx":"IMRPhenomXP", "delta_f":1./32, "t_max":200., "dt_fac":7.5
} }
# File containing all the parameter combinations # File containing all the parameter combinations
param_file = "params.txt" param_file = "params_pos.txt"
# Directory where the jobs are stored # Directory where the jobs are stored
job_directory = "/home1/uddeepta.deka/lensing/charged_lens_updated/data/lensed_waveform_data/results" job_directory = "/home1/uddeepta.deka/lensing/charged_lens_updated/data/lensed_waveform_data/results"
...@@ -26,9 +26,9 @@ unfinished_jobs = [] ...@@ -26,9 +26,9 @@ unfinished_jobs = []
with open(param_file, 'r') as f: with open(param_file, 'r') as f:
for line in f: for line in f:
# Parse the y, q values from the line # Parse the y, q values from the line
y, q = map(float, line.split()) Ml, y, q = map(float, line.split())
# Generate the expected runtag folder name # Generate the expected runtag folder name
runtag = runtag_template % (y, q, kwargs['Ml'], kwargs['zl'], kwargs['dect'], runtag = runtag_template % (y, q, Ml, kwargs['zl'], kwargs['dect'],
kwargs['f_hi'], kwargs['zs'], kwargs['m1'], kwargs['m2'], kwargs['f_hi'], kwargs['zs'], kwargs['m1'], kwargs['m2'],
kwargs['approx'], kwargs['delta_f'], kwargs['t_max'], kwargs['dt_fac']) kwargs['approx'], kwargs['delta_f'], kwargs['t_max'], kwargs['dt_fac'])
...@@ -38,11 +38,11 @@ with open(param_file, 'r') as f: ...@@ -38,11 +38,11 @@ with open(param_file, 'r') as f:
if not os.path.exists(job_folder) or not os.listdir(job_folder): if not os.path.exists(job_folder) or not os.listdir(job_folder):
# If the folder doesn't exist, store the y, q values # If the folder doesn't exist, store the y, q values
#print(job_folder) #print(job_folder)
unfinished_jobs.append((y, q)) unfinished_jobs.append((Ml, y, q))
# Save the unfinished jobs to the output file # Save the unfinished jobs to the output file
with open(output_file, 'w') as f: with open(output_file, 'w') as f:
for y, q in unfinished_jobs: for Ml, y, q in unfinished_jobs:
f.write(f"{y} {q} \n") f.write(f"{Ml} {y} {q} \n")
print(f"Unfinished jobs have been saved to {output_file}") print(f"Unfinished jobs have been saved to {output_file}")
...@@ -6,12 +6,21 @@ lensed_waveform_exec.py on a cluster for different parameter values. ...@@ -6,12 +6,21 @@ lensed_waveform_exec.py on a cluster for different parameter values.
import numpy as np import numpy as np
# Define your range for y_value and Ml_value # Define your range for y_values, q_values and Ml_value
y_values = [0.1, 0.5, 1.0]
q_values = [0.1, 1e-3, 1e-6, 1e-9, 1e-11, 0] ## The following parameters are used for negative q values
# y_values = [0.1, 0.5, 1.0, 2.0, 3.0]
# q_values = np.linspace(-1, 0, 51)
# Ml_values = [50, 100, 250, 500, 1000]
## The following parameters are used for positive q values
y_values = [0.1, 0.5, 1.0, 2.0, 3.0]
q_values = np.linspace(0, 0.35, 36)
Ml_values = [50, 100, 250, 500, 1000]
# Write to a parameter file # Write to a parameter file
with open('params.txt', 'w') as f: with open('params_pos.txt', 'w') as f:
for Ml in Ml_values:
for y in y_values: for y in y_values:
for qeff in q_values: for qeff in q_values:
f.write(f"{y} {qeff}\n") f.write(f"{Ml} {y} {qeff}\n")
...@@ -82,7 +82,7 @@ def lensed_fd_waveform(**params): ...@@ -82,7 +82,7 @@ def lensed_fd_waveform(**params):
lensed_hc = lensed_hc.cyclic_time_shift(3) lensed_hc = lensed_hc.cyclic_time_shift(3)
return f, lensed_hp, lensed_hc return f, lensed_hp, lensed_hc
def CalcLogMisMatch(xf1, xf2, Sh, f_min, f_max, optimized_match=False): def CalcLogMisMatch(xf1, xf2, Sh, f_min, f_max, optimized_match=True):
if optimized_match: if optimized_match:
match, shift_idx = pycbc.filter.matchedfilter.optimized_match( match, shift_idx = pycbc.filter.matchedfilter.optimized_match(
xf1, xf2, psd=Sh, low_frequency_cutoff=f_min, high_frequency_cutoff=f_max, xf1, xf2, psd=Sh, low_frequency_cutoff=f_min, high_frequency_cutoff=f_max,
......
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 sign in to comment