diff --git a/python/cosmotool/cl_cic.py b/python/cosmotool/cl_cic.py index bf16b0a..b53c96b 100644 --- a/python/cosmotool/cl_cic.py +++ b/python/cosmotool/cl_cic.py @@ -227,6 +227,13 @@ def cl_CIC_Density(particles, Ngrid, Lbox, context=None, periodic=True, centered if context is None: context = cl.create_some_context() - cic = CIC_CL(context, ndim=3, centered=centered) + ktype = particles.dtype + if ktype != np.float32 and ktype != np.float64: + raise ValueError("particles may only be float32 or float64") - return cic.run(particles, Ng, L) + if len(particles.shape) != 2 or particles.shape[1] != 3: + raise ValueError("particles may only be a Nx3 array") + + cic = CIC_CL(context, ndim=3, centered=centered, ktype=ktype) + + return cic.run(particles, Ngrid, Lbox)