()
| 556 | |
| 557 | |
| 558 | def test_range_coder_encode3(): |
| 559 | # Define a generic quantized Gaussian distribution for all integers |
| 560 | # in the range from -100 to 100 (both ends inclusive): |
| 561 | model_family = constriction.stream.model.QuantizedGaussian(-100, 100) |
| 562 | |
| 563 | # Specify the model parameters for each symbol: |
| 564 | means = np.array([10.3, -4.7, 20.5], dtype=np.float64) |
| 565 | stds = np.array([5.2, 24.2, 3.1], dtype=np.float64) |
| 566 | |
| 567 | # Encode an example message: |
| 568 | # (needs `len(symbols) == len(means) == len(stds)`) |
| 569 | symbols = np.array([12, -13, 25], dtype=np.int32) |
| 570 | encoder = constriction.stream.queue.RangeEncoder() |
| 571 | encoder.encode(symbols, model_family, means, stds) |
| 572 | assert np.all(encoder.get_compressed() == |
| 573 | np.array([2655472005], dtype=np.uint32)) |
| 574 | |
| 575 | |
| 576 | def test_range_coder_encode4(): |
nothing calls this directly
no test coverage detected