Skip to content
Snippets Groups Projects
Commit 8306bf3d authored by David Schäfer's avatar David Schäfer
Browse files

[FIX] PositionalTranslator flags and masking

parent 50af938d
No related branches found
No related tags found
No related merge requests found
...@@ -26,9 +26,16 @@ class PositionalTranslator(Translator): ...@@ -26,9 +26,16 @@ class PositionalTranslator(Translator):
Implements the translation from and to the flagging scheme implemented by CHS Implements the translation from and to the flagging scheme implemented by CHS
""" """
TO_MASK = DOUBTFUL TO_MASK = DOUBTFUL + 1
_FORWARD: ForwardMap = {0: UNFLAGGED, 1: DOUBTFUL, 2: BAD} _FORWARD: ForwardMap = {
-6: UNFLAGGED,
-5: UNFLAGGED,
-2: UNFLAGGED,
0: UNFLAGGED,
1: DOUBTFUL,
2: BAD,
}
_BACKWARD: BackwardMap = { _BACKWARD: BackwardMap = {
UNTOUCHED: 0, UNTOUCHED: 0,
UNFLAGGED: 0, UNFLAGGED: 0,
...@@ -88,9 +95,7 @@ class PositionalTranslator(Translator): ...@@ -88,9 +95,7 @@ class PositionalTranslator(Translator):
out = {} out = {}
for field in flags.columns: for field in flags.columns:
thist = flags.history[field].hist.replace(self._BACKWARD).astype(int) thist = flags.history[field].hist.replace(self._BACKWARD).astype(int)
# Concatenate the single flag values. There are faster and more # concatenate the single flag values
# complicated approaches (see former `PositionalFlagger`), but
# this method shouldn't be called that often
ncols = thist.shape[-1] ncols = thist.shape[-1]
init = 9 * 10 ** ncols init = 9 * 10 ** ncols
bases = 10 ** np.arange(ncols - 1, -1, -1) bases = 10 ** np.arange(ncols - 1, -1, -1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment