Commit 5ff41c53 by Uddeepta Deka

added script to generate lensed waveform

parent d411d37e
#!/home1/uddeepta.deka/softwares/miniconda3/envs/lensing/bin/python3.10 #!/home1/uddeepta.deka/softwares/miniconda3/envs/igwn-py39/bin/python
__author__ = "U.Deka" __author__ = "U.Deka"
""" """
This code is used to generate amplification factor in the time This code is used to generate amplification factor in the time
......
# We use this script to generate a .sub file for ht_condor
import os
import numpy as np
y_arr = [0.5, 1.0, 2.0]
q_arr = [-0.5, 0.1, 0.5]
t_max = 200
# y_arr = np.logspace(-1, np.log10(2.0), 3000)
dir_path = "/home1/uddeepta.deka/lensing/charged_lens_updated/data/condor_output/"
if not os.path.exists(dir_path+"outfiles/"):
os.makedirs(dir_path+"outfiles/")
if not os.path.exists(dir_path+"logs/"):
os.makedirs(dir_path+"logs/")
if not os.path.exists(dir_path+"errors/"):
os.makedirs(dir_path+"errors/")
if not os.path.exists(dir_path+"results/"):
os.makedirs(dir_path+"results/")
condor_filename = "condor_sub.sub"
vars = {
"Universe": "vanilla",
"Executable": "/home1/uddeepta.deka/lensing/charged_lens_updated/scripts/lensed_waveform_exec.py",
"Getenv": True,
"Output": dir_path+"outfiles/output.out.$(Cluster).$(Process).txt",
"Error": dir_path+"errors/error.out.$(Cluster).$(Process).txt",
"Log": dir_path+"logs/log.log.$(Cluster).$(Process).txt",
"notify_user": "uddeepta.deka@icts.res.in",
"Notification": "Never",
"request_cpus": 4,
"request_memory": 1024,
}
with open(dir_path + condor_filename, 'w') as fp:
for key, val in vars.items():
fp.write(f"{key}\t = {val}\n")
for y in y_arr:
for q in q_arr:
fp.write(f"\narguments = y {y} q {q} t_max {t_max} folder_path {dir_path}results/\nQueue\n")
\ No newline at end of file
#!/home1/uddeepta.deka/softwares/miniconda3/envs/lensing/bin/python3.10 #!/home1/uddeepta.deka/softwares/miniconda3/envs/igwn-py39/bin/python
__author__ = "U.Deka" __author__ = "U.Deka"
""" """
This HTCondor compatible code is used to generate microlensed waveforms This HTCondor compatible code is used to generate microlensed waveforms
...@@ -224,7 +224,7 @@ def usage(): ...@@ -224,7 +224,7 @@ def usage():
print("For example, to change the impact parameter to 0.5, run:") print("For example, to change the impact parameter to 0.5, run:")
print("python lensed_waveform_condor_exec.py y 0.5") print("python lensed_waveform_condor_exec.py y 0.5")
print(MicrolensedWaveform.__doc__) print(MicrolensedWaveform.__doc__)
print("\t folder_path: relative path to the output directory from cwd") print("\t folder_path: absolute path to the output directory")
def main(): def main():
print(" ---------------------------------------------------------------- ") print(" ---------------------------------------------------------------- ")
...@@ -241,7 +241,7 @@ def main(): ...@@ -241,7 +241,7 @@ def main():
usage() usage()
return return
if sys.argv[i] == "folder_path": if sys.argv[i] == "folder_path":
folder_path = os.getcwd() + "/" + str(sys.argv[i+1]) + "/" folder_path = str(sys.argv[i+1])
if sys.argv[i] in kwargs: if sys.argv[i] in kwargs:
if (sys.argv[i]=="dect") or (sys.argv[i]=="approx"): if (sys.argv[i]=="dect") or (sys.argv[i]=="approx"):
kwargs[sys.argv[i]] = str(sys.argv[i+1]) kwargs[sys.argv[i]] = str(sys.argv[i+1])
......
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