Skip to content
Open
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
11 changes: 7 additions & 4 deletions dr2lite_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def filter_psr(psr, bw=1.1, dt=7, filter_dict=None, min_toas=10,
:param dt:
DM bin width (days)
:param filter_dict:
dictionary of filters to apply
dictionary of filters to apply based on TOA flags
The dictionary has keys that correspond to TOA flags. The values are
a single or list of acceptable flagvals, e.g.

Expand Down Expand Up @@ -209,8 +209,8 @@ def filter_psr(psr, bw=1.1, dt=7, filter_dict=None, min_toas=10,
print('Working on PSR {}'.format(psr.name))

# Flag filtering
flag_keep = []
if filter_dict:
flag_keep = []
for key, val in filter_dict.items():
if verbose: print('Keeping TOAs corresponding to {} {}'
.format(key, val))
Expand All @@ -220,8 +220,11 @@ def filter_psr(psr, bw=1.1, dt=7, filter_dict=None, min_toas=10,
# if TOA has ANY acceptable value for this flag
flag_keep.append(np.any(flag_conds, axis=0))

# if TOA satisfies all flags
idx_flag = np.flatnonzero(np.alltrue(flag_keep, axis=0))
# if TOA satisfies all flags
idx_flag = np.flatnonzero(np.alltrue(flag_keep, axis=0))
else:
# keep all TOAs
idx_flag = np.arange(psr.nobs)

# filter for frequency coverage
if frequency_filter:
Expand Down