[NumPy-Tickets] [NumPy] #2242: Wrong result for ma.polyfit in masked arrays
NumPy Trac
numpy-tickets@scipy....
Fri Nov 2 14:50:05 CDT 2012
#2242: Wrong result for ma.polyfit in masked arrays
----------------------------+-----------------------------------------------
Reporter: Bartstra | Owner: pierregm
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.ma | Version: 1.6.2
Keywords: polynomial fit |
----------------------------+-----------------------------------------------
When doing polynomial fits on multiple sets of y-data stored as columns in
a masked array, the masking pattern in one column also affects the fit-
result obtained in other columns, e.g.:
{{{
x = ma.arange(3.) # [0,1,2]
y = ma.array([range(3)]*2).transpose() # 2 identical columns: [0,1,2]
p0 = ma.polyfit(x, y, deg=0) # 0-deg fit, just yielding the
mean value in each column
print 'no masked values: fitpar[col0, col1] = ', p0
y[0,0] = ma.masked # mask 1st element in column 0
p1 = ma.polyfit(x, y, deg=0)
print 'same for 1 masked value in column 0 : ', p1, ', i.e., fitpar for
column 1 has changed too'
}}}
In this example, masking a y-value in the first column also affects the
result obtained for the second (all-unmasked) column
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/2242>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list