Skip to content

Commit

Permalink
fix index for scaled
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Dec 20, 2024
1 parent 379633a commit b6601f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/sourmash/minhash.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ def __getstate__(self):
# note: we multiple ksize by 3 here so that
# pickle protocols that bypass __setstate__ <coff numpy coff>
# get a ksize that makes sense to the Rust layer. See #2262.
# CTB/NTP note: if you add things below, you might want to put
# them at the end, because we use internal indexes in a few places.
# see especially `_set_num_scaled()` in sig/__main__.my.
# My apologies.
return (
self.num,
self.ksize
Expand Down
2 changes: 1 addition & 1 deletion src/sourmash/sig/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _set_num_scaled(mh, num, scaled):
# Number of hashes is 0th parameter
mh_params[0] = num
# Scale is 8th parameter
mh_params[8] = _get_max_hash_for_scaled(scaled)
mh_params[10] = _get_max_hash_for_scaled(scaled)
mh.__setstate__(mh_params)
assert mh.num == num
assert mh.scaled == scaled
Expand Down

0 comments on commit b6601f6

Please sign in to comment.