From 00e305061fd4064992dbd76421d7d745821e51a1 Mon Sep 17 00:00:00 2001 From: Yilun Guan Date: Thu, 19 Sep 2024 11:07:09 -0400 Subject: [PATCH] build_op: rewrap az when outside specified limits --- src/schedlib/policies/stages/build_op.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/schedlib/policies/stages/build_op.py b/src/schedlib/policies/stages/build_op.py index 5a08681..e4c1b81 100644 --- a/src/schedlib/policies/stages/build_op.py +++ b/src/schedlib/policies/stages/build_op.py @@ -688,6 +688,18 @@ def get_safe_gaps(block0, block1): az=block1.az, alt=block1.alt), ] + # go through the sequence and wrap az if falls outside limits + seq_ = [] + for b in seq: + if b.az < self.az_limits[0] or b.az > self.az_limits[1]: + logger.info(f"block az ({b.az}) outside limits, unwrapping...") + az_unwrap = find_unwrap(b.az, az_limits=self.az_limits)[0] + logger.info(f"-> unwrapping az: {b.az} -> {az_unwrap}") + seq_ += [b.replace(az=az_unwrap)] + else: + seq_ += [b] + seq = seq_ + seq_ = [seq[0]] for i in range(1, len(seq)): gaps = get_safe_gaps(seq[i-1], seq[i])