Re: [Numpy-discussion] [AstroPy] Rotating and Transforming Vectors--Flight Path of a Celestial Body

2009-12-18 Thread Charles R Harris
On Thu, Dec 17, 2009 at 11:14 PM, Anne Archibald wrote: > 2009/12/18 Wayne Watson : > > It's starting to come back to me. I found a few old graphics books that > > get into transformation matrices and such. Yes, earth centered. I ground > > out some code with geometry and trig that at least gets t

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread David Goldsmith
np.dot(x.flat, x.flat) _is exactly_ "sum of squares"(x.flat). Your math education appears to have drawn a distinction between "dot product" and "scalar product," that, when one is talking about Euclidean vectors, just isn't there: in that context, they are one and the same thing. DG On Fri, Dec

Re: [Numpy-discussion] ValueError for numpy when importing KDTree from scipy.spatial

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 10:42 PM, Howard Chong wrote: > I'm getting an odd behavior when I try to load KDTree. In the interactive > interpreter: the first time I try to load it, it gives me an error. Second > time works fine. When trying to run from command line, same error. > > To reproduce, jus

Re: [Numpy-discussion] objects are not aligned. Matrix and Array

2009-12-18 Thread Wayne Watson
Is math automatic (built-in)? Same result with np.dot(m2, m1). Ah, this works. dotres = np.dot(m2.T, m1). It looks to me like the shapes are the same, so maybe dot() requires one as a column vector and one as a row. Thanks. Charles R Harris wrote: > > > On Fri, Dec 18, 2009 at 10:20 PM, Wayne

Re: [Numpy-discussion] ValueError for numpy when importing KDTree from scipy.spatial

2009-12-18 Thread josef . pktd
On Sat, Dec 19, 2009 at 12:42 AM, Howard Chong wrote: > I'm getting an odd behavior when I try to load KDTree. In the interactive > interpreter: the first time I try to load it, it gives me an error. Second > time works fine. When trying to run from command line, same error. > To reproduce, just t

Re: [Numpy-discussion] objects are not aligned. Matrix and Array

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 10:20 PM, Wayne Watson wrote: > This program gives me the message following it: > Program== > import numpy as np > from numpy import matrix > import math > > You don't want math. > def sinD(D): # given in degrees, convert to radians >return ma

[Numpy-discussion] ValueError for numpy when importing KDTree from scipy.spatial

2009-12-18 Thread Howard Chong
I'm getting an odd behavior when I try to load KDTree. In the interactive interpreter: the first time I try to load it, it gives me an error. Second time works fine. When trying to run from command line, same error. To reproduce, just type the 4 commands below. If people can't reproduce it, I migh

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
I'll amend that. I should have said, "Dot's all folks." -- Bugs Bunny -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Nicely done. Alan G Isaac wrote: > On 12/18/2009 7:12 PM, Wayne Watson wrote: > >> The point of the scalar product is to produce theta. >> > > As David said, that is just NumPy's `dot`. > > a = np.array([0,2]) b = np.array([5,0]) theta = np.arccos(np.dot(a,b)/np.sqrt(np.d

[Numpy-discussion] objects are not aligned. Matrix and Array

2009-12-18 Thread Wayne Watson
This program gives me the message following it: Program== import numpy as np from numpy import matrix import math def sinD(D): # given in degrees, convert to radians return math.sin(math.radians(D)) def cosD(D): return math.cos(math.radians(D)) r = math.sqrt(2*2+5*

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-18 Thread Fernando Perez
On Fri, Dec 18, 2009 at 8:10 PM, Robert Kern wrote: > My policy and rationale, which I believe is reflected in the docstring > standard, is that examples in the docstrings should put pedagogical > concerns above all others. In my experience, a properly robust doctest > sacrifices the readability,

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-18 Thread Robert Kern
On Fri, Dec 18, 2009 at 21:21, Fernando Perez wrote: > On Wed, Dec 16, 2009 at 10:56 AM, Skipper Seabold wrote: >> Presumably the doctests should be turned into >> actual tests (noting Robert's comment) to make it more likely that it >> gets in > > Just curious: is there a policy against pure doc

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-18 Thread josef . pktd
On Fri, Dec 18, 2009 at 10:21 PM, Fernando Perez wrote: > On Wed, Dec 16, 2009 at 10:56 AM, Skipper Seabold wrote: >> Presumably the doctests should be turned into >> actual tests (noting Robert's comment) to make it more likely that it >> gets in > > Just curious: is there a policy against pure

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 8:21 PM, Fernando Perez wrote: > On Wed, Dec 16, 2009 at 10:56 AM, Skipper Seabold > wrote: > > Presumably the doctests should be turned into > > actual tests (noting Robert's comment) to make it more likely that it > > gets in > > Just curious: is there a policy against p

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-18 Thread Fernando Perez
On Wed, Dec 16, 2009 at 10:56 AM, Skipper Seabold wrote: > Presumably the doctests should be turned into > actual tests (noting Robert's comment) to make it more likely that it > gets in Just curious: is there a policy against pure doctests in numpy? I've always found that doctests and 'real test

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Alan G Isaac
On 12/18/2009 7:12 PM, Wayne Watson wrote: > The point of the scalar product is to produce theta. As David said, that is just NumPy's `dot`. >>> a = np.array([0,2]) >>> b = np.array([5,0]) >>> theta = np.arccos(np.dot(a,b)/np.sqrt(np.dot(a,a)*np.dot(b,b))) >>> theta 1.5707963267948966 >>> theta/n

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Alan G Isaac
On 12/18/2009 5:54 PM, Keith Goodman wrote: > On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson > wrote: >> That should do it. Thanks. How do I get the scalar result by itself? > >>> np.dot(x.T,x)[0,0] > 14 > > or > >>> x = np.array([1,2,3]) >>> np.dot(x,x) > 14 or np.dot(x.flat,x.flat) fw

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Not quite. The point of the scalar product is to produce theta. My intended use is that found in calculus. Nevertheless, my question is how to produce the result in some set of functions that are close to minimal. I could finish this off by using the common definition found in a calculus book (

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread David Goldsmith
On Fri, Dec 18, 2009 at 3:40 PM, Wayne Watson wrote: > Well, they aren't quite the same. If a is the length of A, and b is the > length of B, then a*b = A dot B* cos (theta).  I'm still not familiar > enough with numpy or math to know if there's some function that will > produce a from A. It's eas

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Well, they aren't quite the same. If a is the length of A, and b is the length of B, then a*b = A dot B* cos (theta). I'm still not familiar enough with numpy or math to know if there's some function that will produce a from A. It's easy enough to do, a = A(0)**2 + ..., but I would like to thi

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 3:22 PM, Wayne Watson wrote: > Is there a scalar product in numpy? Isn't that the same thing as a dot product? np.dot doesn't do what you want? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/ma

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Very good. Is there a scalar product in numpy? Keith Goodman wrote: > On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson > wrote: > >> That should do it. Thanks. How do I get the scalar result by itself? >> > > >>> np.dot(x.T,x)[0,0] >>> >14 > > or > > >>> x = np.array([1,2,3]

Re: [Numpy-discussion] fromfile can segfault if data is corrupted

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 3:58 PM, Travis Oliphant wrote: > > On Dec 15, 2009, at 12:28 PM, Charles R Harris wrote: > > > > On Tue, Dec 15, 2009 at 11:20 AM, Michael Droettboom wrote: > >> I just discovered a bug in fromfile where it can segfault if the file data >> is corrupted in such a way that t

Re: [Numpy-discussion] fromfile can segfault if data is corrupted

2009-12-18 Thread Travis Oliphant
On Dec 15, 2009, at 12:28 PM, Charles R Harris wrote: On Tue, Dec 15, 2009 at 11:20 AM, Michael Droettboom wrote: I just discovered a bug in fromfile where it can segfault if the file data is corrupted in such a way that the array size is insanely large. (It was a byte-swapping proble

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 2:51 PM, Wayne Watson wrote: > That should do it. Thanks. How do I get the scalar result by itself? >> np.dot(x.T,x)[0,0] 14 or >> x = np.array([1,2,3]) >> np.dot(x,x) 14 ___ NumPy-Discussion mailing list NumPy-Discussion

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
That should do it. Thanks. How do I get the scalar result by itself? Keith Goodman wrote: > On Fri, Dec 18, 2009 at 1:51 PM, Wayne Watson > wrote: > >> Is it possible to calculate a dot product in numpy by either notation >> (a ^ b, where ^ is a possible notation) or calling a dot function >>

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-18 Thread David Warde-Farley
Hi Gael, On 16-Dec-09, at 2:16 PM, Gael Varoquaux wrote: > I was under the impression that we should > direct users who have linalg problems to scipy, as it can do much > more. I agree about pushing users in that direction, but I think that's mostly a consequence of all the wrapped Fortran

Re: [Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 1:51 PM, Wayne Watson wrote: > Is it possible to calculate a dot product in numpy by either notation > (a ^ b, where ^ is a possible notation) or calling a dot function > (dot(a,b)? I'm trying to use a column matrix for both "vectors". > Perhaps, I need to somehow change th

[Numpy-discussion] dot function or dot notation, matrices, arrays?

2009-12-18 Thread Wayne Watson
Is it possible to calculate a dot product in numpy by either notation (a ^ b, where ^ is a possible notation) or calling a dot function (dot(a,b)? I'm trying to use a column matrix for both "vectors". Perhaps, I need to somehow change them to arrays? -- Wayne Watson (Watson Adventu

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 2:02 PM, Charles R Harris wrote: > > > On Fri, Dec 18, 2009 at 10:46 AM, Keith Goodman wrote: > >> I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already >> known, fixed, reproducible? >> >> >> np.array(121).argsort(0).argsort(0) >> Segmentation fault >> >> > Th

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 1:02 PM, Charles R Harris wrote: > > > On Fri, Dec 18, 2009 at 10:46 AM, Keith Goodman wrote: >> >> I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already >> known, fixed, reproducible? >> >> >> np.array(121).argsort(0).argsort(0) >> Segmentation fault >> > > Th

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 10:46 AM, Keith Goodman wrote: > I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already > known, fixed, reproducible? > > >> np.array(121).argsort(0).argsort(0) > Segmentation fault > > The immediate problem is in scalartypes.c.src in these lines {"sort",

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Christoph Gohlke
On 12/18/2009 9:46 AM, Keith Goodman wrote: > I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already > known, fixed, reproducible? > >>> np.array(121).argsort(0).argsort(0) > Segmentation fault > > The expected result: > > AttributeError: 'np.int64' object has no attribute 'argsort' O

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 10:46 AM, Keith Goodman wrote: > I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already > known, fixed, reproducible? > > >> np.array(121).argsort(0).argsort(0) > Segmentation fault > > The expected result: > > AttributeError: 'np.int64' object has no attribute

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Skipper Seabold
On Fri, Dec 18, 2009 at 1:07 PM, Skipper Seabold wrote: > On Fri, Dec 18, 2009 at 1:00 PM, Robert Kern wrote: >> >> Can you give us a gdb backtrace? >> > > No idea what I'm doing, but I figure I should learn a bit...  Does > this look right? > > skip...@linux-desktop:~$ gdb python > GNU gdb (GDB)

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Skipper Seabold
On Fri, Dec 18, 2009 at 1:00 PM, Robert Kern wrote: > > Can you give us a gdb backtrace? > No idea what I'm doing, but I figure I should learn a bit... Does this look right? skip...@linux-desktop:~$ gdb python GNU gdb (GDB) 7.0-ubuntu Copyright (C) 2009 Free Software Foundation, Inc. License GP

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread josef . pktd
On Fri, Dec 18, 2009 at 1:01 PM, Charles R Harris wrote: > > > On Fri, Dec 18, 2009 at 10:57 AM, Skipper Seabold > wrote: >> >> On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern >> wrote: >> > On Fri, Dec 18, 2009 at 11:46, Keith Goodman >> > wrote: >> >> I am using the numpy 1.3 binary from Ubuntu

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Charles R Harris
On Fri, Dec 18, 2009 at 10:57 AM, Skipper Seabold wrote: > On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern > wrote: > > On Fri, Dec 18, 2009 at 11:46, Keith Goodman > wrote: > >> I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already > >> known, fixed, reproducible? > >> > np.array

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Keith Goodman
On Fri, Dec 18, 2009 at 9:52 AM, Robert Kern wrote: > On Fri, Dec 18, 2009 at 11:46, Keith Goodman wrote: >> I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already >> known, fixed, reproducible? >> np.array(121).argsort(0).argsort(0) >> Segmentation fault >> >> The expected result

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Robert Kern
On Fri, Dec 18, 2009 at 11:57, Skipper Seabold wrote: > On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern wrote: >> On Fri, Dec 18, 2009 at 11:46, Keith Goodman wrote: >>> I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already >>> known, fixed, reproducible? >>> > np.array(121).argsor

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Skipper Seabold
On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern wrote: > On Fri, Dec 18, 2009 at 11:46, Keith Goodman wrote: >> I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already >> known, fixed, reproducible? >> np.array(121).argsort(0).argsort(0) >> Segmentation fault >> >> The expected resul

Re: [Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Robert Kern
On Fri, Dec 18, 2009 at 11:46, Keith Goodman wrote: > I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already > known, fixed, reproducible? > >>> np.array(121).argsort(0).argsort(0) > Segmentation fault > > The expected result: > > AttributeError: 'np.int64' object has no attribute 'args

[Numpy-discussion] Segmentation fault with argsort

2009-12-18 Thread Keith Goodman
I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already known, fixed, reproducible? >> np.array(121).argsort(0).argsort(0) Segmentation fault The expected result: AttributeError: 'np.int64' object has no attribute 'argsort' ___ NumPy-Discussi

Re: [Numpy-discussion] test_multiarray.TestIO.test_ascii segmentation fault with Python2.7

2009-12-18 Thread Bruce Southey
On 12/15/2009 10:59 AM, Charles R Harris wrote: On Tue, Dec 15, 2009 at 9:51 AM, Pauli Virtanen > wrote: Tue, 15 Dec 2009 10:36:03 -0600, Bruce Southey wrote: [clip] > Program received signal SIGSEGV, Segmentation fault. setup_context > (registry=, modu

Re: [Numpy-discussion] [AstroPy] Rotating and Transforming Vectors--Flight Path of a Celestial Body

2009-12-18 Thread denis
Fyinfo, http://code.google.com/p/geometry-simple has classes "Point","Line","Plane","Movement", with methods points moved distance_to angle_to midpoint_to ... It's not all you want (~ 350 lines, uses straight numpy, would benefit from an expert eye (dot = inner ? math. ?)) but has a clean api. @An