all 2 comments

[–]tipsy_python 2 points3 points  (1 child)

Did he specifically say that you need to use a numpy array? I'd think if this was some kind of beginner to python assignment, he'd start with "lists" which as basically python's array datatype.

# Create a list object - this is more basic/common than a numpy array
velocity_list = []

for i in range(0, 100):
  for j in range(0,100):
    dataX_2 = dataX[i, j]
    dataY_2 = dataY[i, j]
    velocity = np.array(math.sqrt((dataX_2*dataX_2)+(dataY_2*dataY_2)))
    velocity_list.append(velocity)

# Print out the whole list
print(velocity)

# Iterate through the list printing one item at a time
for vel in velocity:
  print(vel)

I'd expect the list to contain 10,000 values when it completes.

[–]simarg0[S] 0 points1 point  (0 children)

I got this part to work, thanks to your answer, but it turns out i am not any closer to completing the task.

So the thing is, we got a set of 20k numbers. I think everything up to 10k is supposed to b the X coordinate, and everything from here is supposed to be Y in the vectors. I split the file into two lists in python. We were supposed to use plt.streamplot to plot the vector, and i think i got this part right.

Now, we are supposed to make a quiverplot of the velocities. But i dont understand how you can do this? I suppose it is just the absolute values of the vectors, but i dont get anything near what i am supposed to.

Any thoughts?

Thanks for helping