Skip to content
Snippets Groups Projects
Commit e89f2c1b authored by Patrick Godwin's avatar Patrick Godwin
Browse files

gstlal_fake_frames_workflow: fix issues with padding, frame naming scheme

parent 85756f22
No related branches found
No related tags found
1 merge request!41DAG Workflow Overhaul + OSG DAG support
......@@ -30,6 +30,7 @@ parser.add_argument("-c", "--config", help="Sets the path to read configuration
# load config
args = parser.parse_args()
config = Config.load(args.config)
config.create_time_bins(start_pad=0, overlap=0, one_ifo_only=True)
# create dag
dag = DAG(config)
......
......@@ -150,29 +150,31 @@ class Config:
start_pad = 512,
overlap = 512,
min_instruments = 1,
one_ifo_only = False,
one_ifo_length = (3600 * 8)
):
self.time_boundaries = segutil.split_segments_by_lock(self.ifos, self.segments, self.span)
self.time_bins = segmentlistdict()
for span in self.time_boundaries:
analysis_segs = segutil.analysis_segments(
self.ifos,
self.segments,
span,
start_pad=start_pad,
overlap=overlap,
min_instruments=min_instruments,
one_ifo_length=one_ifo_length,
)
self.time_bins.extend(analysis_segs)
self.one_ifo_time_bins = segmentlistdict()
for span in self.time_boundaries:
time_bin = segmentlistdict()
for ifo, segs in self.segments.items():
segs = segs & segmentlist([span])
time_bin[ifo] = segutil.split_segments(segs, one_ifo_length, start_pad)
self.one_ifo_time_bins.extend(time_bin)
if not one_ifo_only:
for span in self.time_boundaries:
analysis_segs = segutil.analysis_segments(
self.ifos,
self.segments,
span,
start_pad=start_pad,
overlap=overlap,
min_instruments=min_instruments,
one_ifo_length=one_ifo_length,
)
self.time_bins.extend(analysis_segs)
else:
for span in self.time_boundaries:
time_bin = segmentlistdict()
for ifo, segs in self.segments.items():
ifo_key = frozenset([ifo])
segs = segs & segmentlist([span])
time_bin[ifo_key] = segutil.split_segments(segs, one_ifo_length, start_pad)
self.time_bins.extend(time_bin)
@staticmethod
def to_ifo_list(ifos):
......
......@@ -28,19 +28,18 @@ def create_frames_layer(config, dag, psd_cache):
requirements = {"request_cpus": 2, "request_memory": 2000, **config.condor.submit}
layer = Layer("gstlal_fake_frames", requirements=requirements)
frame_cache = DataCache.generate(DataType.FRAMES, config.ifos, config.one_ifo_time_bins)
frame_cache = DataCache.generate(DataType.FRAMES, config.ifo_combos, config.time_bins, create_dirs=False)
# if given a single PSD, assign this to all times
if len(psd_cache) == 1:
psds = {span: psd_cache for span in config.time_bins}
psds = {key: psd_cache for key in frame_cache.groupby("ifo", "time").keys()}
else:
psds = psd_cache.groupby("time")
psds = psd_cache.groupby("ifo", "time")
# set options
common_opts = [
Option("data-source", "frames"),
Option("frame-segments-name", config.source.frame_segments_name),
Option("frame-segments-file", config.source.frame_segments_file),
Option("data-find-server", config.source.data_find_server),
]
if config.frames.injections:
......@@ -56,24 +55,29 @@ def create_frames_layer(config, dag, psd_cache):
if config.frames.frames_per_file:
common_opts.append(Option("output-frames-per-file", config.frames.frames_per_file))
for (ifo, span), frames in frame_cache.groupby("ifo", "time").items():
for (ifo_combo, span), frames in frame_cache.groupby("ifo", "time").items():
ifos = config.to_ifo_list(ifo_combo)
start, end = span
frame_opts = [
Option("gps-start-time", int(start)),
Option("gps-end-time", int(end)),
Option("channel-name", f"{ifo}={config.source.channel_name[ifo]}"),
Option("frame-type", f"{ifo}={config.source.frame_type[ifo]}"),
Option("output-frame-type", f"{ifo}={config.frames.output_frame_type[ifo]}"),
Option("output-channel-name", f"{ifo}={config.frames.output_channel_name[ifo]}")
]
frame_opts.extend(common_opts)
for ifo in ifos:
frame_opts = [
Option("gps-start-time", int(start)),
Option("gps-end-time", int(end)),
Option("channel-name", f"{ifo}={config.source.channel_name[ifo]}"),
Option("frame-type", f"{ifo}={config.source.frame_type[ifo]}"),
Option("output-channel-name", f"{ifo}={config.frames.output_channel_name[ifo]}"),
Option("output-frame-type", f"{ifo}_{config.frames.output_frame_type[ifo]}"),
]
frame_opts.extend(common_opts)
layer += Node(
arguments = frame_opts,
inputs = Option("whiten-reference-psd", psds[span].files),
outputs = Option("output-path", config.frames.get("output_path", os.getcwd()))
)
layer += Node(
arguments = frame_opts,
inputs = [
Option("whiten-reference-psd", psds[(ifo_combo, span)].files),
Option("frame-segments-file", config.source.frame_segments_file),
],
outputs = Option("output-path", config.frames.get("output_path", "frames"))
)
dag.attach(layer)
return frame_cache
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment