title: fill Numpy array with axisymmetric values
body: <p>I'm trying to find a fast way to fill a Numpy array with rotation symmetric values. Imagine an array of zeros containing a cone shaped area. I have a 1D array of values and want to rotate it 360° around the center of the array. There is no 2D function like z=f(x,y), so I can't calculate the 2D values explicitly. I have something that works, but the for-loop is too slow for big arrays. This should make a circle:</p>
  
  <pre><code>values = np.ones(100)
  x = np.arange(values.size)-values.size/2+0.5
  y = values.size/2-0.5-np.arange(values.size)
  x,y = np.meshgrid(x,y)
  grid = np.rint(np.sqrt(x**2+y**2))
  arr = np.zeros_like(grid)
  for i in np.arange(values.size/2):
      arr[grid==i] = values[i+values.size/2]
  </code></pre>
  
  <p>My 1D array is of course not as simple. Can someone think of a way to get rid of the for-loop?</p>
  
  <p>Update: I want to make a circular filter for convolutional blurring. Before I used <code>np.outer(values,values)</code> which gave me a rectangular filter. David's hint allows me to create a circular filter very fast. See below:</p>
  
  <p><a href="http://i.stack.imgur.com/Tm8Ba.png" rel="nofollow">square filter with np.outer()</a></p>
  
  <p><a href="http://i.stack.imgur.com/BF4mh.png" rel="nofollow">circular filter with David's answer</a></p>