Skip to content

Commit

Permalink
fix(RFIStokesI): add initial threshold for sumthreshold
Browse files Browse the repository at this point in the history
  • Loading branch information
ljgray committed Jun 3, 2024
1 parent acd6b92 commit 29fa4c0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions draco/analysis/flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,13 @@ class RFIStokesIMask(task.SingleTask):
frac_samples : float, optional
Fraction of flagged samples in map space above which the entire
time sample will be flagged. Default is 0.01.
include_sumthreshold : bool, optional
If True, apply a sumthreshold mask over the output `power` metric.
Default is True.
max_m : int, optional
Maximum size of the SumThreshold window. Default is 16.
nsigma : float, optional
Initial threshold for SumThreshold. Default is 5.0.
lowpass_ang : float, optional
Angular cutoff of the ra lowpass filter. Default is 7.5, which
corresponds to about 30 minutes of observation time.
Expand All @@ -1048,7 +1053,9 @@ class RFIStokesIMask(task.SingleTask):
sigma_low = config.Property(proptype=float, default=2.0)
frac_samples = config.Property(proptype=float, default=0.01)

include_sumthreshold = config.Property(proptype=bool, default=True)
max_m = config.Property(proptype=int, default=16)
nsigma = config.Property(proptype=float, default=5.0)
lowpass_ang = config.Property(proptype=float, default=7.5)

def setup(self, telescope):
Expand Down Expand Up @@ -1117,7 +1124,10 @@ def process(self, stream):
power = mpiarray.MPIArray.wrap(power, axis=0).allgather()

# Mask high power across frequencies
summask = self.mask_multi_channel(power, mask, times)
if self.include_sumthreshold:
summask = self.mask_multi_channel(power, mask, times)
else:
summask = np.zeros_like(mask)

# Create the output containers
if "ra" in stream.index_map:
Expand Down Expand Up @@ -1214,7 +1224,9 @@ def mask_multi_channel(self, power, mask, times):
)

# Mask bright data with bright sources and daytime removed
summask = rfi.sumthreshold(power, start_flag=mask, max_m=self.max_m)
summask = rfi.sumthreshold(
power, start_flag=mask, max_m=self.max_m, threshold1=self.nsigma
)

# Expand the mask in time only. Expanding in frequency generally ends
# up being too aggressive, and the single-channel flagging does a fine
Expand Down

0 comments on commit 29fa4c0

Please sign in to comment.