diff --git a/src/powerbox/tools.py b/src/powerbox/tools.py index cbc7b80..d03d500 100644 --- a/src/powerbox/tools.py +++ b/src/powerbox/tools.py @@ -1120,7 +1120,9 @@ def get_power( dim = len(deltax.shape) if not np.iterable(boxlength): - boxlength = [boxlength] * dim + boxlength = [float(boxlength)] * dim + else: + boxlength = [float(val) for val in boxlength] if deltax2 is not None and deltax.shape != deltax2.shape: raise ValueError("deltax and deltax2 must have the same shape!") diff --git a/tests/test_tools.py b/tests/test_tools.py index 4041def..47c5ee8 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -459,6 +459,9 @@ def test_cross_power_identity(): p, k = get_power(dx, pb.boxlength, b=1) p_cross, k = get_power(dx, pb.boxlength, b=1, deltax2=dx) assert np.all(np.isclose(p, p_cross)) + p, k = get_power(dx, [1, 1], b=1) + p_cross, k = get_power(dx, [1, 1], b=1, deltax2=dx) + assert np.all(np.isclose(p, p_cross)) @pytest.mark.skip()