[NumPy-Tickets] [NumPy] #1438: numpy.trapz() doesn't respect subclass

NumPy Trac numpy-tickets@scipy....
Mon Mar 29 10:41:27 CDT 2010

#1438: numpy.trapz() doesn't respect subclass
 Reporter:  rmay    |       Owner:  somebody    
     Type:  defect  |      Status:  needs_review
 Priority:  normal  |   Milestone:  2.0.0       
Component:  Other   |     Version:  devel       
 Keywords:  patch   |  

Comment(by rmay):

 Updated patch that:[[BR]]
 * Uses the array.sum() method instead of add.reduce to make subclasses
 fully work (this was still breaking masked arrays.[[BR]]

 * Catches an exception on doing the actual multiply and sum of the arrays
 and tries again after casting to ndarrays.  This allows any subclasses
 that relied on being cast to still work.[[BR]]

 * Adds tests that ensure matrices work (test passes before and after
 changes to trapz()) and adds a test for masked arrays that checks that
 masked points are treated as expected. In this case, expected is defined
 to be the same as if you implemented the trapezoidal method by hand using
 MaskedArray's basic arithmetic operations.

Ticket URL: <http://projects.scipy.org/numpy/ticket/1438#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list