Perform accelerated shard hash computation for Neuroglancer Precomputed shards.
import shardcomputer
preshift_bits = 0
shard_bits = 11
minishard_bits = 8
label = 12949142
shard_no = shardcomputer.shard_number(label, preshift_bits, shard_bits, minishard_bits)
# let labels be a uint64 numpy array of labels
# e.g. set(['4d2'])
shard_no_set = shardcomputer.unique_shard_numbers(
labels, preshift_bits, shard_bits, minishard_bits
)
# Returns shard number -> label list dict
# e.g. {'4d2': [12949142]}
shard_no_to_labels = shardcomputer.assign_labels_to_shards(
label, preshift_bits, shard_bits, minishard_bits
)
pip install shard-computer
Thank you to Austin Appleby for placing MurMurhash3 into the public domain.