title: Smoothing an array along an axis
body: <p>I've looked into smoothing of a signal and found the Cookbook page <a href="http://wiki.scipy.org/Cookbook/SignalSmooth" rel="nofollow noreferrer">http://wiki.scipy.org/Cookbook/SignalSmooth</a> which works fine for an array with only one dimension. Now I would really need a function that does the same thing but on an (TxNx3) array along the N axis.</p>
  
  <p>The context is, that I have a trajectory of N particles and T frames each with x,y,z and now I would like to implement some sort of low pass filter on their movements in time to make the wiggle less in a movie.</p>
  
  <p>So to illustarte the problem:</p>
  
  <pre><code>import numpy as np
  from MY_Cookbook_copy import smooth
  T = np.random.random((30,30,3)) # this is the trajectory
  imshow( T[:,:,0], interpolation='nearest' ) 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/A7DWu.png" alt="original trajectory"></p>
  
  <pre><code># this works but is too slow and only for the x data
  for i in range( T.shape[1] ):
      T[:,i,0] = smooth( T[:,i,0], 5 )
  imshow( T[:,:,1], interpolation='nearest' )
  </code></pre>
  
  <p>this gives 
  <img src="https://i.stack.imgur.com/FUMBf.png" alt="smoothed trajectory"></p>
  
  <p>so dimensions of my problem are on the order of something like 1000 particles over 5000 time frames</p>