[SciPy-User] Old meaning of numpy mgrid command

Dav Clark dav at alum.mit.edu
Thu Sep 23 21:48:50 EDT 2010


Hi all,

I have some old code that implemented the equivalent of the make3dgabor matlab command. However, the usage of mgrid seems to have changed. The old way, with some variables subbed in for brevity (hence strange arithmetic with constants):

ix, iy, it = np.mgrid[0:1.00001:(1/(10-1.0)), 0:1.00001:(1/(10-1.0)), 0.5]

Those first two indices can be converted to the more straightforward complex-number approach, yielding:

ix, iy, it = np.mgrid[0:1:10*1j, 0:1:10*1j, 0.5]

But the float there gives an error, and it's unclear to me what was intended. Does anyone that knows the old behavior of mgrid know what the 0.5 in the third index position would have done?

Thanks!
Dav


More information about the SciPy-User mailing list