[SciPy-Dev] replacing integrate.cumtrapz with numpy.trapz

Ralf Gommers ralf.gommers at googlemail.com
Sat Jul 17 09:52:22 EDT 2010


On Sat, Jul 17, 2010 at 9:48 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:

>
>
> On Sat, Jul 17, 2010 at 7:38 AM, Ralf Gommers <ralf.gommers at googlemail.com
> > wrote:
>
>>
>>
>> On Sat, Jul 17, 2010 at 8:57 PM, Charles R Harris <
>> charlesr.harris at gmail.com> wrote:
>>
>>>
>>>
>>> On Sat, Jul 17, 2010 at 2:42 AM, Ralf Gommers <
>>> ralf.gommers at googlemail.com> wrote:
>>>
>>>> integrate.cumtrapz and numpy.trapz do exactly the same thing and the
>>>> code is very similar but not identical, as pointed out in
>>>> http://projects.scipy.org/scipy/ticket/720. Assuming numpy.trapz is not
>>>> going anywhere, can we replace the scipy version with it?
>>>>
>>>> For a small bonus, the numpy version is about 10% faster (tested for
>>>> several array shapes):
>>>> >>> a = np.arange(1e4).reshape(500, 20)
>>>> >>> %timeit np.trapz(a, axis=1)
>>>> 10000 loops, best of 3: 182 us per loop
>>>> >>> %timeit sp.integrate.cumtrapz(a, axis=1)
>>>> 1000 loops, best of 3: 209 us per loop
>>>>
>>>>
>>> Replacement seems reasonable to me. We should try to prune duplicate
>>> functionality with numpy taking precedence.
>>>
>>> Just to double check, that also means deprecating the name cumtrapz
>> right?
>>
>>
> Yes, I think so. And maybe a ticket to remove it later although that means
> having versions in trac for future releases. Maybe we should have a
> "deprecated" component so we can use such tickets.
>
> I was thinking about adding "check all deprecations" as part of the release
process (at the beginning). Then there's less chance to forget it, and less
noise in Trac.

Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20100717/785c244f/attachment.html>


More information about the SciPy-Dev mailing list