On 4/29/11 1:27 PM, Sebastian Haase wrote: > Just for completeness, note this paragraph from the mgrid docs: > > However, if the step length is a *complex number* (e.g. 5j), then the > integer part of its magnitude is interpreted as specifying the number > of points to create between the start and stop values, where the stop > value *is inclusive*.
OK -- for a kluge, I figure you could do complex, then take the real part, but I can't seem to get a complex grid to work at all: In [37]: np.mgrid[(0+0j):(1+0j):(0.1+0j)] Out[37]: array([], dtype=complex128) What am I doing wrong? Go it -- the docs could use some clarification here -- Actually, passing in a complex nubmer is a FLAG, indicating that the index means somethign different, but it's still doing everything with real numbers (floats). Wow, klunky API! but here is what the OP would want: np.mgrid[-60:90:((60.j+90.j)*4. + 1j)] which is klunkier that linspace. I'd have used two different function names for the different mgrid functionality, rather that than the complex kludge -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
