Commit ada2453a authored by Pavel KORSHUNOV's avatar Pavel KORSHUNOV

Fix crash of get_shape and add test

parent 3f422732
Pipeline #7710 passed with stages
in 6 minutes and 31 seconds
......@@ -468,7 +468,7 @@ static PyObject* PyBobApFrameExtractor_GetShapeArray
PyBlitzArrayObject* input = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kwlist,
&input, &PyBlitzArray_Converter)) return 0;
&PyBlitzArray_Converter, &input)) return 0;
auto input_ = make_safe(input);
if (input->ndim != 1 || input->type_num != NPY_FLOAT64) {
......
......@@ -61,10 +61,13 @@ def energy_computation(rate_wavsample, win_length_ms, win_shift_ms, normalize_me
def energy_comparison_run(rate_wavsample, win_length_ms, win_shift_ms, normalize_mean):
c = Energy(rate_wavsample[0], win_length_ms, win_shift_ms, normalize_mean)
shape_a = c.get_shape(rate_wavsample[1])
A = c(rate_wavsample[1])
B = energy_computation(rate_wavsample, win_length_ms, win_shift_ms, normalize_mean)
shape_b = B.shape
assert shape_a != shape_b
diff=numpy.sum(numpy.sum((A-B)*(A-B)))
assert numpy.allclose(diff, 0., rtol=1e-07, atol=1e-05)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment