Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions sotodlib/coords/planets.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def get_horizon_P(tod, az, el, receiver_fixed=False, **kw):


def filter_for_sources(tod=None, signal=None, source_flags=None,
n_modes=10, low_pass=None, wrap=None,
pca_wrap=None, edge_guard=None):
n_modes=10, low_pass=None,
wrap=None, edge_guard=None):
"""Mask and gap-fill the signal at samples flagged by source_flags.
Then PCA the resulting time ordered data. Restore the flagged
signal, remove the strongest modes from PCA.
Expand All @@ -271,7 +271,6 @@ def filter_for_sources(tod=None, signal=None, source_flags=None,
subject to change.
wrap (str): If specified, the result will be stored at
tod[wrap].
pca_wrap (str): If specified, the PCA model modes and weights calculated for subtraction will be wrapped into tod[pca_wrap].
edge_guard (int): Number of samples at the beginning and end of the flags to change them False.
Default is None. (Nothing happens.)

Expand Down Expand Up @@ -340,7 +339,7 @@ def filter_for_sources(tod=None, signal=None, source_flags=None,

# Get PCA model and discard the source vectors.
pca = tod_ops.pca.get_pca_model(
tod, signal=signal_pca, n_modes=n_modes, wrap=pca_wrap)
tod, signal=signal_pca, n_modes=n_modes)
del signal_pca

# Remove the PCA model.
Expand Down
4 changes: 1 addition & 3 deletions sotodlib/preprocess/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,6 @@ class FilterForSources(_Preprocess):
source_flags: "source_flags"
edge_guard: 10 # Number of samples to make the first and last flags False
trim_samps: 100
pca_wrap: "pca_model" # optional, if provided, the PCA model is wrapped into proc_aman under this name

.. autofunction:: sotodlib.coords.planets.filter_for_sources
"""
Expand All @@ -2401,11 +2400,10 @@ def process(self, aman, proc_aman, sim=False, data_aman=None):
signal = aman.get(self.signal)
flags = aman.flags.get(self.process_cfgs.get('source_flags'))
edge_guard = self.process_cfgs.get('edge_guard')
pca_wrap = self.process_cfgs.get('pca_wrap',None)
if aman.dets.count < n_modes:
raise ValueError(f'The number of pca modes {n_modes} is '
f'larger than the number of detectors {aman.dets.count}.')
planets.filter_for_sources(aman, signal=signal, source_flags=flags, n_modes=n_modes, edge_guard=edge_guard, pca_wrap=pca_wrap)
planets.filter_for_sources(aman, signal=signal, source_flags=flags, n_modes=n_modes, edge_guard=edge_guard)
if self.process_cfgs.get("trim_samps"):
trim = self.process_cfgs["trim_samps"]
proc_aman.restrict('samps', (aman.samps.offset + trim,
Expand Down
Loading