Skip to content

Commit 745fcbb

Browse files
authored
Merge pull request #599 from MannLabs/fix_tests
fix a test failing on windows runners
2 parents c0359ec + 2cf9eb6 commit 745fcbb

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

alphadia/fragcomp/utils.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
import logging
44

5-
import numba as nb
65
import numpy as np
76
import pandas as pd
87

9-
from alphadia.utils import USE_NUMBA_CACHING
10-
118
logger = logging.getLogger(__name__)
129

1310

@@ -48,11 +45,16 @@ def add_frag_start_stop_idx(
4845
return psm_df.merge(index_df, "inner", on="_candidate_idx")
4946

5047

51-
@nb.njit(cache=USE_NUMBA_CACHING)
52-
def candidate_hash(precursor_idx: int, rank: int) -> int:
53-
"""Create a 64 bit hash from the precursor_idx, and rank.
48+
def candidate_hash(precursor_idx: np.ndarray, rank: np.ndarray) -> np.ndarray:
49+
"""Create a 64 bit hash from the precursor_idx and rank.
5450
5551
The precursor_idx is the lower 32 bits.
5652
The rank is the next 8 bits.
53+
54+
Returns
55+
-------
56+
np.ndarray (np.uint64)
57+
A 64 bit hash of the precursor_idx and rank.
58+
5759
"""
58-
return precursor_idx + (rank << 32)
60+
return (precursor_idx + (rank << 32)).astype(np.uint64)

tests/unit_tests/test_fragcomp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_fragment_competition():
9393
"mz_observed": np.array([100, 100, 200, 200]),
9494
"proba": np.array([0.1, 0.2, 0.4, 0.6]),
9595
"rank": np.array([0, 0, 0, 0], dtype=np.uint8),
96-
"_candidate_idx": np.array([0, 1, 3, 5]),
96+
"_candidate_idx": np.array([0, 1, 3, 5], dtype=np.uint64),
9797
}
9898
),
9999
)

0 commit comments

Comments
 (0)