Re: [Numpy-discussion] Convert datetime64 to python datetime.datetime in numpy 1.6.1?

2011-12-04 Thread Didrik Pinte
On Sun, Dec 4, 2011 at 6:11 AM, Warren Weckesser warren.weckes...@enthought.com wrote: In numpy 1.6.1, what's the most straightforward way to convert a datetime64 to a python datetime.datetime?  E.g. I have In [1]: d = datetime64(2011-12-03 12:34:56.75) In [2]: d Out[2]: 2011-12-03

Re: [Numpy-discussion] Convert datetime64 to python datetime.datetime in numpy 1.6.1?

2011-12-04 Thread Warren Weckesser
On Sun, Dec 4, 2011 at 5:30 AM, Didrik Pinte dpi...@enthought.com wrote: On Sun, Dec 4, 2011 at 6:11 AM, Warren Weckesser warren.weckes...@enthought.com wrote: In numpy 1.6.1, what's the most straightforward way to convert a datetime64 to a python datetime.datetime? E.g. I have In

Re: [Numpy-discussion] NumPy Governance

2011-12-04 Thread Alan G Isaac
On 12/4/2011 1:43 AM, Charles R Harris wrote: I don't think there are 5 active developers, let alone 11. With hard work you might scrape together two or three. Having 5 or 11 people making decisions for the two or three actually doing the work isn't going to go over well. Very true! But you

Re: [Numpy-discussion] NumPy Governance

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 6:16 AM, Alan G Isaac alan.is...@gmail.com wrote: On 12/4/2011 1:43 AM, Charles R Harris wrote: I don't think there are 5 active developers, let alone 11. With hard work you might scrape together two or three. Having 5 or 11 people making decisions for the two or

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Charles R Harris
On Sat, Dec 3, 2011 at 8:14 PM, Geoffrey Irving irv...@naml.us wrote: Hello, I'm trying to add a fixed precision rational number dtype to numpy, and am running into an issue trying to register ufunc loops. The code in question looks like int npy_rational =

Re: [Numpy-discussion] bug in PyArray_GetCastFunc

2011-12-04 Thread Charles R Harris
On Sat, Dec 3, 2011 at 5:28 PM, Geoffrey Irving irv...@naml.us wrote: When attempting to cast to a user defined type, PyArray_GetCast looks up the cast function in the dictionary but doesn't check if the entry exists. This causes segfaults. Here's a patch. Geoffrey diff --git

[Numpy-discussion] stacking scalars with column vector

2011-12-04 Thread Santhosh R
Hi , I am trying to learn python to convert some of my mlab codes to python.Am new to python.Some help here would be appreciated I am trying to make a column vector by stacking two scalars--Xstart,Xend and second column of n X 2 2Darray--A In matlab the code is b=[Xstart;A(:,1);Xend] I have

Re: [Numpy-discussion] stacking scalars with column vector

2011-12-04 Thread Olivier Delalleau
You can do it in one shot with: x = np.vstack((Xstart, A[:, 0:1], Xend)) Using A[:, 0:1] instead of A[:, 0] lets you keep it as a 2d matrix (this should answer your last question). Then the scalars Xstart and Xend will automatically be broadcasted to accomodate the shape of A[:, 0:1], so you

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Geoffrey Irving
This may be the problem. Simple diffs are pleasant. I'm guessing this code doesn't get a lot of testing. Glad it's there, though! Geoffrey diff --git a/numpy/core/src/umath/ufunc_type_resolution.c b/numpy/core/src/umath/ufunc_type_resolution.c index 0d6cf19..a93eda1 100644 ---

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving irv...@naml.us wrote: This may be the problem. Simple diffs are pleasant. I'm guessing this code doesn't get a lot of testing. Glad it's there, though! Geoffrey diff --git a/numpy/core/src/umath/ufunc_type_resolution.c

Re: [Numpy-discussion] bug in PyArray_GetCastFunc

2011-12-04 Thread Geoffrey Irving
On Sun, Dec 4, 2011 at 10:02 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Dec 3, 2011 at 5:28 PM, Geoffrey Irving irv...@naml.us wrote: When attempting to cast to a user defined type, PyArray_GetCast looks up the cast function in the dictionary but doesn't check if the entry

Re: [Numpy-discussion] bug in PyArray_GetCastFunc

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 6:30 PM, Geoffrey Irving irv...@naml.us wrote: On Sun, Dec 4, 2011 at 10:02 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Dec 3, 2011 at 5:28 PM, Geoffrey Irving irv...@naml.us wrote: When attempting to cast to a user defined type,

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Geoffrey Irving
On Sun, Dec 4, 2011 at 5:18 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving irv...@naml.us wrote: This may be the problem.  Simple diffs are pleasant.  I'm guessing this code doesn't get a lot of testing.  Glad it's there, though!

Re: [Numpy-discussion] stacking scalars with column vector

2011-12-04 Thread Santhosh R
Thanks Oliver. You can do it in one shot with: x = np.vstack((Xstart, A[:, 0:1], Xend)) Using A[:, 0:1] instead of A[:, 0] lets you keep it as a 2d matrix (this should answer your last question). Then the scalars Xstart and Xend will automatically be broadcasted to accomodate the shape of

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Charles R Harris
On Sun, Dec 4, 2011 at 6:59 PM, Geoffrey Irving irv...@naml.us wrote: On Sun, Dec 4, 2011 at 5:18 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving irv...@naml.us wrote: This may be the problem. Simple diffs are pleasant. I'm

Re: [Numpy-discussion] NumPy Governance

2011-12-04 Thread Travis Oliphant
Great points. My initial suggestion of 5-11 was more about current board size rather than trying to fix it. I agree that having someone represent from major downstream projects would be a great thing. -Travis On Dec 4, 2011, at 7:16 AM, Alan G Isaac wrote: On 12/4/2011 1:43 AM,

Re: [Numpy-discussion] failure to register ufunc loops for user defined types

2011-12-04 Thread Geoffrey Irving
On Sun, Dec 4, 2011 at 6:45 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Dec 4, 2011 at 6:59 PM, Geoffrey Irving irv...@naml.us wrote: On Sun, Dec 4, 2011 at 5:18 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Dec 4, 2011 at 5:41 PM, Geoffrey Irving