Vectors in Programmable Filter

Hello,
I am trying to use the first component of a vector via Programmable Filter.
I tried follwing:
input = inputs[0]
pointData = input.GetPointData()
vector = pointData.GetVectors(‘vector’)

Now this creates a double array. The ‘vector’ has three components and I’d like to only work with the x-coordinate.
I tried working on the coordinates directly, without using the full vector, but this always returned the value None.
Since I am working on Particles, I could use their ID: coordinates = vector.GetTuple(-ParticleID-), but this gives back all three coordinates. Also, is there a way to extract the components without having to use the ID of the Particle? I’d like to print out the x-coordinates of each Particle.

I’d be thankful for any advice.

1 Like

By extracting the array as a numpy array, it would be possible to extract only the x-components.

input = inputs[0]
vector = input.PointData['vector']
print(vector[:,0])
1 Like

That worked. Thank you very much!!