[SciPy-User] Old meaning of numpy mgrid command

Travis Oliphant oliphant@enthought....
Thu Sep 23 23:45:11 CDT 2010

On Sep 23, 2010, at 9:48 PM, Dav Clark wrote:

> 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?

How old is this code?   I don't recall any old behavior of mgrid.     What version of NumPy did the previous code used to work with? 

Note, you can also just write 10j for your endpoints:  mgrid[0:1:10j, 0:1:10j]

> Thanks!
> Dav
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

Travis Oliphant
Enthought, Inc.

More information about the SciPy-User mailing list