Re: [Numpy-discussion] assigning ma.masked. Strange behavior

2009-07-05 Thread Scott Sinclair
> 2009/7/4 Ben Park : > > import numpy as np > import numpy.ma as ma > > # There is no effect on the following assignment of ma.masked. > a1 = ma.arange(10).reshape((2,5)) > a1.ravel()[np.array([0,2,2])] = ma.masked In some situations ravel has to return a copy of the data instead of a view. You'r

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Gökhan SEVER
On Sun, Jul 5, 2009 at 11:52 PM, Gael Varoquaux < gael.varoqu...@normalesup.org> wrote: > On Sun, Jul 05, 2009 at 07:08:37PM -0500, Gökhan SEVER wrote: > >Do you have any idea, why spheres have rough edges on Mayavi? > > If you are using 'mlab.points3d', you want to increase the 'resolution' >

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Gael Varoquaux
On Sun, Jul 05, 2009 at 07:08:37PM -0500, Gökhan SEVER wrote: >Do you have any idea, why spheres have rough edges on Mayavi? If you are using 'mlab.points3d', you want to increase the 'resolution' keyword argument. It is kept quite low so that you can plot gazzilions of points. Gaël _

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Ian Mallett
Thanks for the example, Stéfan! I'm trying to work this into a position texture, and the arrays need interleaving. I tried a couple times. Here's what I have: az = numpy.random.uniform(0, numpy.pi * 2, size*size) el = numpy.random.uniform(0, numpy.pi, size*size) r = numpy.random.uniform(size*si

[Numpy-discussion] The baffling behavior that just won't die

2009-07-05 Thread d_l_goldsmith
Sorry for the cross post, but almost immediately after hitting send (to scipy-user) I realized this is the more appropriate list for the below. :-( DG Hi, folks.  I'm having a problem using numpy.lookfor() that is very reminiscent of this thread: http://mail.scipy.org/pipermail/scipy-user/200

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Gökhan SEVER
2009/7/5 Stéfan van der Walt > 2009/7/5 Ian Mallett : > > @Stéfan: I thought of the first method. Let's hear the second approach. > > Please see the attached example. > > I start off by drawing random azimuth and elevation angles, as well as a > radii: > > N = 1000 > max_radius = 5 > > az = np.r

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Stéfan van der Walt
2009/7/5 Ian Mallett : > @Stéfan: I thought of the first method.  Let's hear the second approach. Please see the attached example. I start off by drawing random azimuth and elevation angles, as well as a radii: N = 1000 max_radius = 5 az = np.random.uniform(low=0, high=np.pi * 2, size=N) el = n

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Ian Mallett
@Stéfan: I thought of the first method. Let's hear the second approach. @Gökhan: Yes. Toolbox is my metaphor for being able to do effects in OpenGL. Point sprites are images mapped onto vertices, VBOs are *v*ertex *b *uffer *o*bjects, that make stuff faster. _

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Gökhan SEVER
On Sun, Jul 5, 2009 at 3:48 PM, Ian Mallett wrote: > Presently, it's being rendered using point sprites/VBOs. It's supposed to > be for a game I'm working on, but it's a good effect to have in the toolbox > too :D > > ___ > Numpy-discussion mailing lis

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Stéfan van der Walt
2009/7/5 Ian Mallett : > I'm trying to get a cloud particle system working.  As part of determining > the depth of every point (to get the light that can pass through), it makes > sense that the volume should be of even density.  The volume is a sphere. > Currently, I'm using: > > vecs = numpy.rand

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Ian Mallett
Presently, it's being rendered using point sprites/VBOs. It's supposed to be for a game I'm working on, but it's a good effect to have in the toolbox too :D ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listin

Re: [Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Gökhan SEVER
On Sun, Jul 5, 2009 at 3:30 PM, Ian Mallett wrote: > Hello, > > I'm trying to get a cloud particle system working. As part of determining > the depth of every point (to get the light that can pass through), it makes > sense that the volume should be of even density. The volume is a sphere. > Cu

[Numpy-discussion] Even Sphere Volume

2009-07-05 Thread Ian Mallett
Hello, I'm trying to get a cloud particle system working. As part of determining the depth of every point (to get the light that can pass through), it makes sense that the volume should be of even density. The volume is a sphere. Currently, I'm using: vecs = numpy.random.standard_normal(size=(s

Re: [Numpy-discussion] Add/multiply reduction confusion

2009-07-05 Thread Gael Varoquaux
On Sun, Jul 05, 2009 at 02:47:18PM -0400, Andrew Friedley wrote: > Stéfan van der Walt wrote: > > 2009/7/5 Andrew Friedley : > >> I found the check that does the type 'upcasting' in > >> umath_ufunc_object.inc around line 3072 (NumPy 1.3.0). Turns out all I > >> need to do is make sure my add and

Re: [Numpy-discussion] Add/multiply reduction confusion

2009-07-05 Thread Andrew Friedley
Stéfan van der Walt wrote: > 2009/7/5 Andrew Friedley : >> I found the check that does the type 'upcasting' in >> umath_ufunc_object.inc around line 3072 (NumPy 1.3.0). Turns out all I >> need to do is make sure my add and multiply ufuncs are actually named >> 'add' and 'multiply' and arrays will

Re: [Numpy-discussion] Add/multiply reduction confusion

2009-07-05 Thread Stéfan van der Walt
Hi Andrew 2009/7/5 Andrew Friedley : > I figured this out in case anyone is interested. > > I found the check that does the type 'upcasting' in > umath_ufunc_object.inc around line 3072 (NumPy 1.3.0).  Turns out all I > need to do is make sure my add and multiply ufuncs are actually named > 'add'

Re: [Numpy-discussion] Add/multiply reduction confusion

2009-07-05 Thread Andrew Friedley
I figured this out in case anyone is interested. I found the check that does the type 'upcasting' in umath_ufunc_object.inc around line 3072 (NumPy 1.3.0). Turns out all I need to do is make sure my add and multiply ufuncs are actually named 'add' and 'multiply' and arrays will be upcasted app