[Numpy-discussion] Sine Distribution on a 2D Array
Ian Mallett
geometrian at gmail.com
Sun Jul 25 03:03:09 EDT 2010
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_gradient)
angles = np.radians( (distances_to_center/((resolution/2.0)-0.5)) * 90.0
)
lambert_weights = np.cos(angles)
This seems like it could be improved.
Ian
PS, I meant "Sinusoidal" in the title. I carried that over into my
description, which should have been "cosine", instead of "sine".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100725/e3913aa9/attachment.html>
More information about the NumPy-Discussion
mailing list