MCPcopy Create free account
hub / github.com/bamler-lab/constriction / test_range_coding_decode3

Function test_range_coding_decode3

tests/python/test_docexamples.py:643–656  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

641
642
643def test_range_coding_decode3():
644 # Define a generic quantized Gaussian distribution for all integers
645 # in the range from -100 to 100 (both ends inclusive):
646 model_family = constriction.stream.model.QuantizedGaussian(-100, 100)
647
648 # Specify the model parameters for each symbol:
649 means = np.array([10.3, -4.7, 20.5], dtype=np.float64)
650 stds = np.array([5.2, 24.2, 3.1], dtype=np.float64)
651
652 # Decode a message from some example compressed data:
653 compressed = np.array([2655472005], dtype=np.uint32)
654 decoder = constriction.stream.queue.RangeDecoder(compressed)
655 symbols = decoder.decode(model_family, means, stds)
656 assert np.all(symbols == np.array([12, -13, 25], dtype=np.int32))
657
658
659def test_range_coding_decode4():

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.95

Tested by

no test coverage detected