Re: [Numpy-discussion] Sine Distribution on a 2D Array

2010-07-25 Thread Ian Mallett
Hi, After much deliberation, I found a passable solution: distances = np.abs(np.arange(0,resolution,1)+0.5-(resolution/2.0)) x_gradient = np.tile(distances,(resolution,1)) y_gradient = np.copy(x_gradient) y_gradient = np.swapaxes(y_gradient,0,1) distances_to_center = np.hypot(x_gradient,y_gradien

Re: [Numpy-discussion] Sine Distribution on a 2D Array

2010-07-25 Thread Christian K.
Am 25.07.10 06:38, schrieb Ian Mallett: > Hi, > > So I have a square 2D array, and I want to fill the array with sine > values. The values need to be generated by their coordinates within the > array. > > The center of the array should be treated as the angle 90 degrees. Each > of the four edges

[Numpy-discussion] Sine Distribution on a 2D Array

2010-07-24 Thread Ian Mallett
Hi, So I have a square 2D array, and I want to fill the array with sine values. The values need to be generated by their coordinates within the array. The center of the array should be treated as the angle 90 degrees. Each of the four edges should be 0 degrees. The corners, therefore, ought to