nullpol 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nullpol/.gitignore +1 -0
- nullpol/__init__.py +43 -0
- nullpol/asimov/__init__.py +0 -0
- nullpol/asimov/analysis_defaults.yaml +56 -0
- nullpol/asimov/asimov.py +195 -0
- nullpol/asimov/nullpol.ini +246 -0
- nullpol/asimov/nullpol_analysis.yaml +4 -0
- nullpol/asimov/pesummary.py +191 -0
- nullpol/asimov/tgrflow.py +566 -0
- nullpol/asimov/utility.py +281 -0
- nullpol/calibration/__init__.py +3 -0
- nullpol/calibration/antenna_pattern.py +32 -0
- nullpol/clustering/__init__.py +7 -0
- nullpol/clustering/clustering.py +60 -0
- nullpol/clustering/plot.ipynb +120 -0
- nullpol/clustering/plot.py +43 -0
- nullpol/clustering/single.py +77 -0
- nullpol/clustering/sky_maximized_spectrogram.py +70 -0
- nullpol/clustering/test.png +0 -0
- nullpol/clustering/threshold_filter.py +29 -0
- nullpol/detector/__init__.py +4 -0
- nullpol/detector/networks.py +103 -0
- nullpol/detector/whiten.py +51 -0
- nullpol/injection/__init__.py +3 -0
- nullpol/injection/injection.py +68 -0
- nullpol/job_creation/__init__.py +5 -0
- nullpol/job_creation/analysis_node.py +136 -0
- nullpol/job_creation/generation_node.py +17 -0
- nullpol/job_creation/nullpol_pipe_dag_creator.py +121 -0
- nullpol/likelihood/__init__.py +6 -0
- nullpol/likelihood/chi2_time_frequency_likelihood.py +80 -0
- nullpol/likelihood/fractional_projection_time_frequency_likelihood.py +78 -0
- nullpol/likelihood/gaussian_time_frequency_likelihood.py +72 -0
- nullpol/likelihood/time_frequency_likelihood.py +516 -0
- nullpol/null_stream/__init__.py +7 -0
- nullpol/null_stream/antenna_pattern.py +130 -0
- nullpol/null_stream/encoding.py +23 -0
- nullpol/null_stream/null_stream.py +94 -0
- nullpol/null_stream/projector.py +61 -0
- nullpol/null_stream/signal_estimator.py +37 -0
- nullpol/null_stream/time_shift.py +52 -0
- nullpol/prior/__init__.py +3 -0
- nullpol/prior/default.py +24 -0
- nullpol/prior/prior_files/polarization.prior +3 -0
- nullpol/result/__init__.py +3 -0
- nullpol/result/result.py +257 -0
- nullpol/source/__init__.py +3 -0
- nullpol/source/simple_map.py +30 -0
- nullpol/time_frequency_transform/__init__.py +5 -0
- nullpol/time_frequency_transform/helper.py +34 -0
- nullpol/time_frequency_transform/inverse_wavelet_freq_funcs.py +136 -0
- nullpol/time_frequency_transform/inverse_wavelet_time_funcs.py +231 -0
- nullpol/time_frequency_transform/stft.py +21 -0
- nullpol/time_frequency_transform/transform_freq_funcs.py +268 -0
- nullpol/time_frequency_transform/transform_time_funcs.py +168 -0
- nullpol/time_frequency_transform/wavelet_transforms.py +206 -0
- nullpol/tools/__init__.py +0 -0
- nullpol/tools/config.ini +363 -0
- nullpol/tools/create_injection.py +180 -0
- nullpol/tools/create_time_frequency_filter_from_sample.py +187 -0
- nullpol/tools/data_analysis.py +283 -0
- nullpol/tools/data_generation.py +443 -0
- nullpol/tools/default_config_create_injection.ini +13 -0
- nullpol/tools/default_config_create_time_frequency_filter_from_sample.ini +14 -0
- nullpol/tools/example_signal_parameters_create_injection.json +17 -0
- nullpol/tools/get_asimov_yaml.py +42 -0
- nullpol/tools/input.py +218 -0
- nullpol/tools/main.py +228 -0
- nullpol/tools/parser.py +238 -0
- nullpol/utils/__init__.py +9 -0
- nullpol/utils/config.py +22 -0
- nullpol/utils/convert_type.py +45 -0
- nullpol/utils/error.py +11 -0
- nullpol/utils/filesystem.py +39 -0
- nullpol/utils/log.py +58 -0
- nullpol-0.1.1.dist-info/METADATA +72 -0
- nullpol-0.1.1.dist-info/RECORD +80 -0
- nullpol-0.1.1.dist-info/WHEEL +4 -0
- nullpol-0.1.1.dist-info/entry_points.txt +18 -0
- nullpol-0.1.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
import htcondor
|
|
6
|
+
from asimov import config, utils
|
|
7
|
+
from asimov.pipeline import PostPipeline
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PESummaryPipeline(PostPipeline):
|
|
11
|
+
"""
|
|
12
|
+
A postprocessing pipeline add-in using PESummary.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
name = "PESummary"
|
|
16
|
+
def submit_dag(self, dryrun=False):
|
|
17
|
+
"""
|
|
18
|
+
Run PESummary on the results of this job.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
psds = {ifo: os.path.abspath(psd) for ifo, psd in self.production.psds.items()}
|
|
22
|
+
|
|
23
|
+
polarization_modes = self.production.meta['likelihood']['polarization modes']
|
|
24
|
+
polarization_basis = self.production.meta['likelihood']['polarization basis']
|
|
25
|
+
number_of_subruns = len(polarization_modes)
|
|
26
|
+
|
|
27
|
+
if "calibration" in self.production.meta["data"]:
|
|
28
|
+
calibration = [
|
|
29
|
+
(
|
|
30
|
+
os.path.abspath(
|
|
31
|
+
os.path.join(self.production.repository.directory, cal)
|
|
32
|
+
)
|
|
33
|
+
if not cal[0] == "/"
|
|
34
|
+
else cal
|
|
35
|
+
)
|
|
36
|
+
for cal in self.production.meta["data"]["calibration"].values()
|
|
37
|
+
]
|
|
38
|
+
else:
|
|
39
|
+
calibration = None
|
|
40
|
+
|
|
41
|
+
configfile = self.production.event.repository.find_prods(
|
|
42
|
+
self.production.name, self.category
|
|
43
|
+
)[0]
|
|
44
|
+
command = [
|
|
45
|
+
"--webdir",
|
|
46
|
+
os.path.join(
|
|
47
|
+
config.get("project", "root"),
|
|
48
|
+
config.get("general", "webroot"),
|
|
49
|
+
self.production.event.name,
|
|
50
|
+
self.production.name,
|
|
51
|
+
"pesummary",
|
|
52
|
+
),
|
|
53
|
+
"--labels",
|
|
54
|
+
]
|
|
55
|
+
for i in range(number_of_subruns):
|
|
56
|
+
command += [f'{self.production.name}_{polarization_modes[i]}_{polarization_basis[i]}']
|
|
57
|
+
command += ["--gw",
|
|
58
|
+
"--f_low",
|
|
59
|
+
str(min(self.production.meta["quality"]["minimum frequency"].values())),
|
|
60
|
+
]
|
|
61
|
+
command = [
|
|
62
|
+
"--webdir",
|
|
63
|
+
os.path.join(
|
|
64
|
+
config.get("project", "root"),
|
|
65
|
+
config.get("general", "webroot"),
|
|
66
|
+
self.production.event.name,
|
|
67
|
+
self.production.name,
|
|
68
|
+
"pesummary",
|
|
69
|
+
),
|
|
70
|
+
"--labels",
|
|
71
|
+
self.production.name,
|
|
72
|
+
"--gw",
|
|
73
|
+
"--f_low",
|
|
74
|
+
str(min(self.production.meta["quality"]["minimum frequency"].values())),
|
|
75
|
+
]
|
|
76
|
+
if "skymap samples" in self.meta:
|
|
77
|
+
command += [
|
|
78
|
+
"--nsamples_for_skymap",
|
|
79
|
+
str(
|
|
80
|
+
self.meta["skymap samples"]
|
|
81
|
+
), # config.get('pesummary', 'skymap_samples'),
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
if "multiprocess" in self.meta:
|
|
85
|
+
command += ["--multi_process", str(self.meta["multiprocess"])]
|
|
86
|
+
|
|
87
|
+
if "regenerate" in self.meta:
|
|
88
|
+
command += ["--regenerate", " ".join(self.meta["regenerate posteriors"])]
|
|
89
|
+
|
|
90
|
+
# Config file
|
|
91
|
+
command += ["--config"]
|
|
92
|
+
config_filename = os.path.join(
|
|
93
|
+
self.production.event.repository.directory, self.category, configfile
|
|
94
|
+
)
|
|
95
|
+
for i in range(number_of_subruns):
|
|
96
|
+
command += [config_filename]
|
|
97
|
+
# Samples
|
|
98
|
+
command += ["--samples"]
|
|
99
|
+
for i in range(number_of_subruns):
|
|
100
|
+
command += self.production.pipeline.subrun_samples(subrun_label=f'{polarization_modes[i]}_{polarization_basis[i]}',
|
|
101
|
+
absolute=True)
|
|
102
|
+
# Calibration information
|
|
103
|
+
if calibration:
|
|
104
|
+
command += ["--calibration"]
|
|
105
|
+
for i in range(number_of_subruns):
|
|
106
|
+
command += calibration
|
|
107
|
+
# PSDs
|
|
108
|
+
command += ["--psd"]
|
|
109
|
+
for i in range(number_of_subruns):
|
|
110
|
+
for key, value in psds.items():
|
|
111
|
+
command += [f"{key}:{value}"]
|
|
112
|
+
|
|
113
|
+
if "keywords" in self.meta:
|
|
114
|
+
for key, argument in self.meta["keywords"]:
|
|
115
|
+
if argument is not None and len(key) > 1:
|
|
116
|
+
command += [f"--{key}", f"{argument}"]
|
|
117
|
+
elif argument is not None and len(key) == 1:
|
|
118
|
+
command += [f"-{key}", f"{argument}"]
|
|
119
|
+
else:
|
|
120
|
+
command += [f"{key}"]
|
|
121
|
+
|
|
122
|
+
with utils.set_directory(self.production.rundir):
|
|
123
|
+
with open(f"{self.production.name}_pesummary.sh", "w") as bash_file:
|
|
124
|
+
bash_file.write(
|
|
125
|
+
f"{config.get('pesummary', 'executable')} " + " ".join(command)
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
self.logger.info(
|
|
129
|
+
f"PE summary command: {config.get('pesummary', 'executable')} {' '.join(command)}"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if dryrun:
|
|
133
|
+
print("PESUMMARY COMMAND")
|
|
134
|
+
print("-----------------")
|
|
135
|
+
print(" ".join(command))
|
|
136
|
+
|
|
137
|
+
submit_description = {
|
|
138
|
+
"executable": config.get("pesummary", "executable"),
|
|
139
|
+
"arguments": " ".join(command),
|
|
140
|
+
"output": f"{self.production.rundir}/pesummary.out",
|
|
141
|
+
"error": f"{self.production.rundir}/pesummary.err",
|
|
142
|
+
"log": f"{self.production.rundir}/pesummary.log",
|
|
143
|
+
"request_cpus": self.meta["multiprocess"],
|
|
144
|
+
"environment": "HDF5_USE_FILE_LOCKING=FAlSE OMP_NUM_THREADS=1 OMP_PROC_BIND=false",
|
|
145
|
+
"getenv": "CONDA_EXE,USER,LAL*,PATH",
|
|
146
|
+
"batch_name": f"PESummary/{self.production.event.name}/{self.production.name}",
|
|
147
|
+
"request_memory": "8192MB",
|
|
148
|
+
# "should_transfer_files": "YES",
|
|
149
|
+
"request_disk": "8192MB",
|
|
150
|
+
"+flock_local": "True",
|
|
151
|
+
"+DESIRED_Sites": htcondor.classad.quote("nogrid"),
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if "accounting group" in self.meta:
|
|
155
|
+
submit_description["accounting_group_user"] = config.get("condor", "user")
|
|
156
|
+
submit_description["accounting_group"] = self.meta["accounting group"]
|
|
157
|
+
else:
|
|
158
|
+
self.logger.warning(
|
|
159
|
+
"This PESummary Job does not supply any accounting"
|
|
160
|
+
" information, which may prevent it running on"
|
|
161
|
+
" some clusters."
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
if dryrun:
|
|
165
|
+
print("SUBMIT DESCRIPTION")
|
|
166
|
+
print("------------------")
|
|
167
|
+
print(submit_description)
|
|
168
|
+
|
|
169
|
+
if not dryrun:
|
|
170
|
+
hostname_job = htcondor.Submit(submit_description)
|
|
171
|
+
|
|
172
|
+
with utils.set_directory(self.production.rundir):
|
|
173
|
+
with open("pesummary.sub", "w") as subfile:
|
|
174
|
+
subfile.write(hostname_job.__str__())
|
|
175
|
+
|
|
176
|
+
try:
|
|
177
|
+
# There should really be a specified submit node, and if there is, use it.
|
|
178
|
+
schedulers = htcondor.Collector().locate(
|
|
179
|
+
htcondor.DaemonTypes.Schedd, config.get("condor", "scheduler")
|
|
180
|
+
)
|
|
181
|
+
schedd = htcondor.Schedd(schedulers)
|
|
182
|
+
except:
|
|
183
|
+
# If you can't find a specified scheduler, use the first one you find
|
|
184
|
+
schedd = htcondor.Schedd()
|
|
185
|
+
with schedd.transaction() as txn:
|
|
186
|
+
cluster_id = hostname_job.queue(txn)
|
|
187
|
+
|
|
188
|
+
else:
|
|
189
|
+
cluster_id = 0
|
|
190
|
+
|
|
191
|
+
return cluster_id
|