-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flagging functions for power spectra #157
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of in-progress PR.
hera_pspec/flags.py
Outdated
greedy : bool | ||
greedy flagging is used if true (default is False) | ||
|
||
axis : int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better off as a string, and maybe with a name change, e.g. first='row'
.
hera_pspec/flags.py
Outdated
integer array with number of samples available for each frequency channel at a given LST angle | ||
|
||
flags : numpy.ndarray | ||
binary array with 1 representing flagged, 0 representing unflagged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same as the output of UVData.get_flags()
, or does that need to be modified in some way before passing it to this function?
hera_pspec/flags.py
Outdated
|
||
mask_generator(nsamples, flags, n_threshold, greedy=False, axis, greedy_threshold, retain_flags=True): | ||
""" | ||
Generates a greedy flags mask from input flags and nsamples arrays |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth briefly explaining how the algorithm works here.
hera_pspec/flags.py
Outdated
n_threshold : int | ||
minimum number of samples needed for a point to remain unflagged | ||
|
||
greedy : bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it's False?
hera_pspec/flags.py
Outdated
@@ -0,0 +1,83 @@ | |||
import numpy as np | |||
|
|||
mask_generator(nsamples, flags, n_threshold, greedy=False, axis, greedy_threshold, retain_flags=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a more descriptive function name, e.g. construct_factorizable_mask
?
hera_pspec/flags.py
Outdated
if greedy=True, the threshold used to flag rows or columns if axis=1 or 0, respectively | ||
|
||
retain_flags : bool | ||
LST-Bin Flags are left flagged even if thresholds are not met (default is True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data going into this are not necessarily LST binned.
hera_pspec/flags.py
Outdated
|
||
# comparing the number of samples to the threshold | ||
|
||
for i in range(shape[0]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this nested for
loop perhaps be replaced by a couple of strategic calls to np.where
? We can discuss this.
Have either of you seen the development in |
I've moved most of the code from this PR into This code could have lived in |
Functions for generating greedy flagging masks, consolidating LST binned NSamples & Flag data into numpy arrays, and plotting visualizations of the flagging.