I've created a dtype for my np.ndarrays:
particle_t = np.dtype([
('position', float, 2),
('momentum', float, 2),
('velocity', float, 2),
('force', float, 2),
('charge', int, 1),
])
According to the official examples one can call:
def my_func(np.ndarray[dtype, dim] particles):
but when I try to compile:
def tester(np.ndarray[particle_t, ndim = 1] particles):
I get the Invalid type
error. Another possibility of usage I've seen is with the memory view like int[:]
. Trying def tester(particle_t[:] particles):
results in:
'particle_t' is not a type identifier
.
How can I fix this?