From b062c0cca7d3128b2646486b93dc8eaac2176ae4 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Mon, 4 Mar 2024 15:46:38 -0500 Subject: [PATCH] Black 24 --- proseco/acq.py | 31 ++++++++++++++++++------------- proseco/core.py | 6 +++--- proseco/monitor.py | 6 +++--- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/proseco/acq.py b/proseco/acq.py index 9caaa2e5..60e98bb7 100644 --- a/proseco/acq.py +++ b/proseco/acq.py @@ -55,7 +55,6 @@ def box_overlap(y1, z1, halfw1, y2, z2, halfw2, overlap_pad=20): ) - def load_maxmags() -> dict: """ Load maxmags from disk. @@ -711,7 +710,7 @@ def select_best_p_acqs(self, cand_acqs, min_p_acq, acq_indices, box_sizes): # If this box size could overlap with the box of an already selected star # then skip it. - if (os.environ.get("PROSECO_ACQ_OVERLAP_PENALTY") == "True"): + if os.environ.get("PROSECO_ACQ_OVERLAP_PENALTY") == "True": has_overlap = False for other_idx, halfw2 in zip(acq_indices, box_sizes): other_acq = cand_acqs[other_idx] @@ -719,11 +718,14 @@ def select_best_p_acqs(self, cand_acqs, min_p_acq, acq_indices, box_sizes): y1, z1 = acq["yang"], acq["zang"] y2, z2 = other_acq["yang"], other_acq["zang"] if box_overlap(y1, z1, halfw1, y2, z2, halfw2): - self.log(f"Skipping Star {acq_idx:2d} box {box_size:3d}, " - "possible overlap with already selected star " - f"{other_acq['id']}", level=2) - has_overlap = True - break + self.log( + f"Skipping Star {acq_idx:2d} box {box_size:3d}, " + "possible overlap with already selected star " + f"{other_acq['id']}", + level=2, + ) + has_overlap = True + break if has_overlap: continue @@ -939,12 +941,15 @@ def calc_p_safe(self, verbose=False): # Check for overlapping boxes and if so, reduce the probability of # acquiring the star. - if (os.environ.get("PROSECO_ACQ_OVERLAP_PENALTY") == "True"): - penalties = self.get_overlap_penalties() - if np.count_nonzero(penalties): - self.log("Overlapping boxes detected, applying penalty", level=1) - self.log(f"{penalties}", level=1) - p_acqs = [p_acq * (1 - penalty) for p_acq, penalty in zip(p_acqs, penalties)] + if os.environ.get("PROSECO_ACQ_OVERLAP_PENALTY") == "True": + penalties = self.get_overlap_penalties() + if np.count_nonzero(penalties): + self.log("Overlapping boxes detected, applying penalty", level=1) + self.log(f"{penalties}", level=1) + p_acqs = [ + p_acq * (1 - penalty) + for p_acq, penalty in zip(p_acqs, penalties) + ] p_n_cum = prob_n_acq(p_acqs)[1] # This returns (p_n, p_n_cum) diff --git a/proseco/core.py b/proseco/core.py index 4cf69f41..d096a0f8 100644 --- a/proseco/core.py +++ b/proseco/core.py @@ -669,9 +669,9 @@ def dark(self, value): # Set pixel regions from ACA.bad_pixels to have acqs.dark=700000 (5.0 mag # star) per pixel. for r0, r1, c0, c1 in ACA.bad_pixels: - self._dark[ - r0 + 512 : r1 + 513, c0 + 512 : c1 + 513 - ] = ACA.bad_pixel_dark_current + self._dark[r0 + 512 : r1 + 513, c0 + 512 : c1 + 513] = ( + ACA.bad_pixel_dark_current + ) def set_attrs_from_kwargs(self, **kwargs): for name, val in kwargs.items(): diff --git a/proseco/monitor.py b/proseco/monitor.py index e58a914a..23f912d1 100644 --- a/proseco/monitor.py +++ b/proseco/monitor.py @@ -186,9 +186,9 @@ def process_monitors(self): "MFX" if monitor["function"] == MonFunc.MON_FIXED else "MTR" ) mon["sz"] = "8x8" - mon[ - "dim" - ] = -999 # Set an obviously bad value for DTS, gets fixed later. + mon["dim"] = ( + -999 + ) # Set an obviously bad value for DTS, gets fixed later. mon["res"] = 0 mon["halfw"] = 20 mon["maxmag"] = ACA.monitor_maxmag