()
| 673 | |
| 674 | def test_custom_model_ans(): |
| 675 | def fixed_model_params(): |
| 676 | model_scipy = scipy.stats.cauchy(loc=10.3, scale=5.8) |
| 677 | # Wrap the scipy-model in a `CustomModel`, which will implicitly |
| 678 | # quantize it to integers in the given range from -100 to 100 (both |
| 679 | # ends inclusively). |
| 680 | model = constriction.stream.model.CustomModel( |
| 681 | model_scipy.cdf, model_scipy.ppf, -100, 100) |
| 682 | |
| 683 | symbols = np.array([5, 14, -1, 21], dtype=np.int32) |
| 684 | coder = constriction.stream.stack.AnsCoder() |
| 685 | coder.encode_reverse(symbols, model) |
| 686 | assert np.all(coder.decode(model, 4) == symbols) |
| 687 | |
| 688 | def variable_model_params(): |
| 689 | # The optional argument `params` will receive a 1-d python array when |
no test coverage detected