From be9f6b6e8e39a711dcfa7806f894b8ec3ff49ca9 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Sun, 27 Apr 2025 21:38:29 +0200 Subject: bindings: Example of using pybind11 with numpy --- bindings/test_galearn_pdm.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bindings/test_galearn_pdm.py (limited to 'bindings/test_galearn_pdm.py') diff --git a/bindings/test_galearn_pdm.py b/bindings/test_galearn_pdm.py new file mode 100644 index 0000000..43cb58e --- /dev/null +++ b/bindings/test_galearn_pdm.py @@ -0,0 +1,16 @@ + +import galearn_pdm +import numpy + +def test_one(): + + inp = numpy.ones(shape=10, dtype=numpy.uint8) + out = numpy.zeros(shape=10, dtype=numpy.int16) + + galearn_pdm.process(inp, out) + print(out) + assert out[0] == 2 + assert out[-1] == 2 + +if __name__ == '__main__': + test_one() -- cgit v1.2.3