35 Hold configuration used for analyzes.
39 kwargs = replace_keys(kwargs)
42 self.
tag = kwargs.get(
"tag",
"test")
46 if isinstance(kwargs[
"instruments"], list):
47 self.
ifos = kwargs[
"instruments"]
50 self.
min_ifos = kwargs.get(
"min_instruments", 1)
56 for combo
in itertools.combinations(self.
ifos, n_ifos):
63 if not "start" in kwargs:
64 self.
span = segment(0, 0)
66 self.
start = LIGOTimeGPS(kwargs[
"start"])
68 self.
stop = LIGOTimeGPS(kwargs[
"stop"])
77 self.
psd =
dotdict(replace_keys(kwargs[
"psd"]))
80 if "frames" in kwargs:
82 if "segments" in kwargs:
84 if "injections" in kwargs:
91 if self.
condor.transfer_files
is None:
92 self.
condor.transfer_files =
True
96 x509_proxy=self.
source.x509_proxy,
102 def create_time_bins(
107 one_ifo_only = False,
108 one_ifo_length = (3600 * 8)
114 analysis_segs = segments.analysis_segments(
120 min_instruments=min_instruments,
121 one_ifo_length=one_ifo_length,
126 time_bin = segmentlistdict()
127 for ifo, segs
in self.
segments.items():
128 ifo_key = frozenset([ifo])
129 segs = segs & segmentlist([span])
130 time_bin[ifo_key] = segments.split_segments(segs, one_ifo_length, start_pad)
133 def create_condor_submit_options(self, condor_config, x509_proxy=False):
134 if "accounting_group_user" in condor_config:
135 accounting_group_user = condor_config[
"accounting_group_user"]
137 accounting_group_user = getpass.getuser()
140 "want_graceful_removal":
"True",
142 "accounting_group": condor_config[
"accounting_group"],
143 "accounting_group_user": accounting_group_user,
149 profile = profiles.load_profile(condor_config[
"profile"])
150 assert profile[
"scheduler"] ==
"condor",
"only scheduler=condor is allowed currently"
153 if "directives" in profile:
154 submit_opts.update(profile[
"directives"])
155 if "requirements" in profile:
156 requirements.extend(profile[
"requirements"])
157 if "environment" in profile:
158 environment.update(profile[
"environment"])
161 if "singularity_image" in condor_config:
162 singularity_image = condor_config[
"singularity_image"]
163 submit_opts[
'+SingularityImage'] = f
'"{singularity_image}"'
164 submit_opts[
'transfer_executable'] =
False
168 submit_opts[
'x509userproxy'] = x509_proxy
169 submit_opts[
'use_x509userproxy'] =
True
172 if not self.
condor.transfer_files:
174 submit_opts[
'initialdir'] = self.
rootdir
177 if "directives" in condor_config:
178 submit_opts.update(condor_config[
"directives"])
179 if "requirements" in condor_config:
180 requirements.extend(condor_config[
"requirements"])
181 if "environment" in condor_config:
182 environment.update(condor_config[
"environment"])
185 submit_opts[
'requirements'] =
" && ".join(requirements)
188 env_opts = [f
"{key}={val}" for (key,val)
in environment.items()]
189 if "environment" in submit_opts:
190 env_opts.append(submit_opts[
"environment"].strip(
'"'))
191 submit_opts[
"environment"] = f
'"{" ".join(env_opts)}"'
197 Validate configuration settings.
203 Load segments and create time bins.
205 if "frame_segments_file" in self.source:
206 xmldoc = ligolw_utils.load_filename(
207 self.source.frame_segments_file,
208 contenthandler=ligolw_segments.LIGOLWContentHandler
210 self.segments = ligolw_segments.segmenttable_get_by_name(xmldoc,
"datasegments").coalesce()
212 self.segments = segmentlistdict((ifo, segmentlist([self.span]))
for ifo
in self.ifos)
214 if self.span != segment(0, 0):
215 self.create_time_bins(start_pad=512, min_instruments=self.min_ifos)
220 Given a string of IFO pairs (e.g. H1L1), return a list of IFOs.
222 return [ifos[2*n:2*n+2]
for n
in range(len(ifos) // 2)]
227 Load configuration from a file given a file path.
229 with open(path,
"r")
as f:
230 return cls(**yaml.safe_load(f))