Skip to content

Commit

Permalink
fix(flagging,dayenu): change arPLS argument name. Add to error msg.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Siegel committed May 14, 2024
1 parent 639c99e commit 0108404
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
23 changes: 17 additions & 6 deletions draco/analysis/dayenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ def process(self, stream):
)

except np.linalg.LinAlgError as exc:
pc_good = (100.0 * flag.mean(axis=0)).astype(int)
self.log.error(
"Failed to converge while processing baseline "
f"{bb} [{bcut:0.3f} micro-sec]: {exc}"
f"Failed to converge while processing baseline {bb} "
f"[{bcut:0.3f} micro-sec]\n"
f"Percentage unmasked frequencies: {pc_good}\n"
f"Exception: {exc}"
)
weight[:, bb] = 0.0
continue
Expand Down Expand Up @@ -252,7 +255,7 @@ def process(self, stream):
baseline_mask = ~baseline_flag

if np.all(baseline_mask):
self.log.error("All data flaged as bad.")
self.log.error("All data flagged as bad.")
return None

if np.any(baseline_mask) and not self.single_mask:
Expand Down Expand Up @@ -288,7 +291,12 @@ def process(self, stream):
)

except np.linalg.LinAlgError as exc:
self.log.error(f"Failed to converge while processing time {tt}: {exc}")
pc_good = (100.0 * flag.mean(axis=0)).astype(int)
self.log.error(
f"Failed to converge while processing time {tt}.\n"
f"Percentage unmasked frequencies: {pc_good}\n"
f"Exception: {exc}"
)
weight[:, :, tt] = 0.0
continue

Expand Down Expand Up @@ -472,9 +480,12 @@ def process(self, ringmap):
)

except np.linalg.LinAlgError as exc:
pc_good = (100.0 * flag.mean(axis=0)).astype(int)
self.log.error(
"Failed to converge while processing el "
f"{el:0.3f} [{ecut:0.3f} micro-sec]: {exc}"
f"Failed to converge while processing el {el:0.3f} "
f"[{ecut:0.3f} micro-sec]\n"
f"Percentage unmasked frequencies: {pc_good}\n"
f"Exception: {exc}"
)
weight[wslc] = 0.0
continue
Expand Down
4 changes: 2 additions & 2 deletions draco/analysis/flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ class RFIMaskChisqHighDelay(task.SingleTask):
of freedom (i.e., number of baselines).
"""

reg_arpls = config.Property(proptype=float, default=100000.0)
reg_arpls = config.Property(proptype=float, default=1e5)
nsigma_1d = config.Property(proptype=float, default=5.0)

win_t = config.Property(proptype=int, default=601)
Expand Down Expand Up @@ -1170,7 +1170,7 @@ def mask_1d(self, y, m):
med_w = np.ascontiguousarray((~med_m).astype(np.float64))

# Estimate a baseline
baseline = tools.arPLS_1d(med_y, mask=med_m, scale=self.reg_arpls)
baseline = tools.arPLS_1d(med_y, mask=med_m, lam=self.reg_arpls)

# Subtract the baseline and estimate the noise
abs_dev = np.abs(med_y - baseline)
Expand Down

0 comments on commit 0108404

Please sign in to comment.