[SciPy-User] [SciPy-user] scipy.odr - Correct form of covx, covy matrix

Elfnor elfnor@gmail....
Sun Feb 12 17:11:35 CST 2012


I'm having trouble using covariance matrices with odrpack RealData

I expected the following adaptation of the test in test_odr.py to work but
get the error

  File "C:\Python27\lib\site-packages\scipy\odr\odrpack.py", line 1080, in
run
    self.output = Output(apply(odr, args, kwds))
ValueError: could not convert we to a suitable array
_________________________
import numpy as np
from  scipy.odr.odrpack import *

p_x = np.array([0.,.9,1.8,2.6,3.3,4.4,5.2,6.1,6.5,7.4])
p_y = np.array([5.9,5.4,4.4,4.6,3.5,3.7,2.8,2.8,2.4,1.5])
p_sx = np.array([.03,.03,.04,.035,.07,.11,.13,.22,.74,1.])
p_sy = np.array([1.,.74,.5,.35,.22,.22,.12,.12,.1,.04])

def pearson_fcn(B, x):
        return B[0] + B[1]*x

covp_x = np.diag(p_sx**2)
covp_y = np.diag(p_sy**2)

p_dat = RealData(p_x, p_y, covx=covp_x, covy=covp_y)

p_mod = Model(pearson_fcn, meta=dict(name='Uni-linear Fit'))

p_odr = ODR(p_dat, p_mod, beta0=[1.,1.])

out = p_odr.run()
out.pprint()

_________________________________

Does anyone know the correct matrix form for this?

thanks Eleanor
-- 
View this message in context: http://old.nabble.com/scipy.odr---Correct-form-of-covx%2C-covy-matrix-tp33312093p33312093.html
Sent from the Scipy-User mailing list archive at Nabble.com.



More information about the SciPy-User mailing list