Skip to content

Commit

Permalink
Fix trailed source test to use the bit map
Browse files Browse the repository at this point in the history
We should never assume a flag maps to a specific bit.
Fix incorrect test docstring.
  • Loading branch information
parejkoj committed Mar 25, 2024
1 parent fe3314c commit 029b4b8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_trailedSourceFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ def setUp(self):
"flags": 0}
for idx in range(self.nSources)])

self.edgeDiaSources.loc[[1, 4], 'flags'] = np.power(2, 27)
flagMap = os.path.join(utils.getPackageDir("ap_association"), "data/association-flag-map.yaml")
unpacker = UnpackApdbFlags(flagMap, "DiaSource")
bitMask = unpacker.makeFlagBitMask(["ext_trailedSources_Naive_flag_edge"])
# Flag two sources as "trailed on the edge".
self.edgeDiaSources.loc[[1, 4], "flags"] |= bitMask

def test_run(self):
"""Run trailedSourceFilterTask with the default max distance.
Expand Down Expand Up @@ -111,8 +115,7 @@ def test_run_no_trails(self):
np.testing.assert_array_equal(results.longTrailedDiaSources["diaSourceId"].values, [])

def test_run_edge(self):
"""Run trailedSourceFilterTask with the default max distance.
filtered out of the final results and put into results.trailedSources.
"""Run trailedSourceFilterTask on a source on the edge.
"""
trailedSourceFilterTask = TrailedSourceFilterTask()

Expand Down

0 comments on commit 029b4b8

Please sign in to comment.