Re: [Numpy-discussion] Cythonizing some of NumPy

2015-09-01 Thread Nathaniel Smith
On Sun, Aug 30, 2015 at 2:44 PM, David Cournapeau wrote: > Hi there, > > Reading Nathaniel summary from the numpy dev meeting, it looks like there is > a consensus on using cython in numpy for the Python-C interfaces. > > This has been on my radar for a long time: that was one of my rationale for

Re: [Numpy-discussion] Notes from the numpy dev meeting at scipy 2015

2015-09-01 Thread Nathaniel Smith
On Sun, Aug 30, 2015 at 9:12 PM, Marten van Kerkwijk wrote: > Hi Nathaniel, others, > > I read the discussion of plans with interest. One item that struck me is > that while there are great plans to have a proper extensible and presumably > subclassable dtype, it is discouraged to subclass ndarray

Re: [Numpy-discussion] Numpy FFT.FFT slow with certain samples

2015-09-01 Thread Joseph Codadeen
Hi, I cannot see how the following would work when it is np.fft.fft() that takes a long time based on the length of data. In my case my data is non-periodic.> from numpy.fft import fft> from numpy.random import rand> from math import log, ceil> seq_A = rand(2649674)> seq_B = rand(2646070)> fft

Re: [Numpy-discussion] Cythonizing some of NumPy

2015-09-01 Thread David Cournapeau
On Tue, Sep 1, 2015 at 8:16 AM, Nathaniel Smith wrote: > On Sun, Aug 30, 2015 at 2:44 PM, David Cournapeau > wrote: > > Hi there, > > > > Reading Nathaniel summary from the numpy dev meeting, it looks like > there is > > a consensus on using cython in numpy for the Python-C interfaces. > > > > T

Re: [Numpy-discussion] Numpy FFT.FFT slow with certain samples

2015-09-01 Thread Oscar Benjamin
On 1 September 2015 at 11:38, Joseph Codadeen wrote: > >> And while you zero-pad, you can zero-pad to a sequence that is a power of >> two, thus preventing awkward factorizations. > > Does numpy have an easy way to do this, i.e. for a given number, find the > next highest number (within a range) t

Re: [Numpy-discussion] Numpy FFT.FFT slow with certain samples

2015-09-01 Thread Joseph Codadeen
Ah, looking back I see what Pierre-André did, the penny drops. Sorry I miss-read.I'm only interested in this part;>zeropadded_fft_A = fft(seq_A, n=2**(ceil(log(len(seq_A),2))+1)) >zeropadded_fft_B = fft(seq_B, n=2**(ceil(log(len(seq_B),2))+1))>You could >remove the "+1" above to get faste

Re: [Numpy-discussion] Numpy FFT.FFT slow with certain samples

2015-09-01 Thread Phil Hodge
On 09/01/2015 11:14 AM, Oscar Benjamin wrote: > Just use the next power of 2. Pure powers of 2 are the most efficient > for FFT algorithms so it potentially works out better than finding a > smaller but similarly composite size to pad to. Finding the next power > of 2 is easy to code and never a ba

Re: [Numpy-discussion] Numpy FFT.FFT slow with certain samples

2015-09-01 Thread Oscar Benjamin
On Tue, 1 Sep 2015 18:43 Phil Hodge wrote: On 09/01/2015 11:14 AM, Oscar Benjamin wrote: > Just use the next power of 2. Pure powers of 2 are the most efficient > for FFT algorithms so it potentially works out better than finding a > smaller but similarly composite size to pad to. Finding the nex

Re: [Numpy-discussion] Numpy FFT.FFT slow with certain samples

2015-09-01 Thread Charles R Harris
On Tue, Sep 1, 2015 at 12:06 PM, Oscar Benjamin wrote: > > On Tue, 1 Sep 2015 18:43 Phil Hodge wrote: > > On 09/01/2015 11:14 AM, Oscar Benjamin wrote: > > Just use the next power of 2. Pure powers of 2 are the most efficient > > for FFT algorithms so it potentially works out better than finding

[Numpy-discussion] UTC-based datetime64

2015-09-01 Thread Chris Barker
> Googling for a way to print UTC out of the box, the best thing I could > find is: > > In [40]: [str(i.item()) for i in np.array([t], dtype="datetime64[s]")] > Out[40]: ['2015-08-26 11:52:10'] > > Now, is there a better way to specify that I want the datetimes printed > always in UTC? > maybe, bu

Re: [Numpy-discussion] UTC-based datetime64

2015-09-01 Thread Jim Benson
On Tue, Sep 01, 2015 at 05:28:56PM -0700, Chris Barker wrote: > > Googling for a way to print UTC out of the box, the best thing I could > > find is: > > > > In [40]: [str(i.item()) for i in np.array([t], dtype="datetime64[s]")] > > Out[40]: ['2015-08-26 11:52:10'] > > > > Now, is there a better wa

Re: [Numpy-discussion] np.sign and object comparisons

2015-09-01 Thread Jaime Fernández del Río
On Mon, Aug 31, 2015 at 11:49 PM, Nathaniel Smith wrote: > On Sun, Aug 30, 2015 at 9:09 PM, Jaime Fernández del Río < > jaime.f...@gmail.com> wrote: > >> >> There are three ways of fixing this that I see: >> >>1. Arbitrarily choose a value to set the return to. This is >>equivalent to cho