gplepage/lsqfit — pull request #2 by cgohlke (2014-05-24 17:28:13+00:00)
Title: Fix ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

Fixes the following test errors on win-amd64-py3.4:
```
..........................................................................................................EEEEEE.EE....E
EEE.EE.....EEEEEEE.
======================================================================
ERROR: test_basicfit (tests.test_lsqfit.test_lsqfit)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 171, in test_basicfit
self.t_basicfit(yf,pf,p0file)
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 129, in t_basicfit
fit = nonlinear_fit(data=(None,y),prior=pr,fcn=fcn,p0=p0file,debug=True)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: bootstrap_iter
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 465, in test_bootstrap
fit = nonlinear_fit(data=data,fcn=fcn,prior=prior,p0=p0,debug=True)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: test_dump (tests.test_lsqfit.test_lsqfit)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 1006, in test_dump
fit = nonlinear_fit(data=y,prior=prior,fcn=f)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: empbayes fit
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 601, in test_empbayes
fit,z = empbayes_fit(z0,fitargs,analyzer=analyzer,tol=1e-3)
File "X:\Python34\lib\site-packages\lsqfit\_extras.py", line 62, in empbayes_fit
args = fitargs(z)
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 592, in fitargs
prior = gv.gvar(91 * ['0 +- %g' % np.exp(z[0])])
nose.proxy.TypeError: 'NoneType' object is not subscriptable
-------------------- >> begin captured stdout << ---------------------
*** empbayes_fit warning: null logGBF

--------------------- >> end captured stdout << ----------------------

======================================================================
ERROR: fit.simulated_fit_iter
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 1101, in test_fit_iter
fit = nonlinear_fit(data=y, fcn=fcn, prior=prior, svdcut=svdcut)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: fit.format
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 181, in test_format
fit = nonlinear_fit(data=y, prior=prior, fcn=f, svdcut=1e-15)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: fit.logGBF
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 577, in test_logGBF
fit = nonlinear_fit(data=y, fcn=fcn, prior=prior)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: normal priors
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 1153, in test_lognormal
fit = nonlinear_fit(prior=prior, data=y, fcn=fcn)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: fit without prior
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 422, in test_noprior
fit = nonlinear_fit(data=data,p0=p0,fcn=fcn,debug=True,reltol=1e-16)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 676, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:8543)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: log-normal priors
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 1134, in test_normal
fit = nonlinear_fit(prior=prior, data=y, fcn=fcn)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: fit.p.der
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 1034, in test_partialerr1
fit = nonlinear_fit(data=(None,y),fcn=fcn,prior=p,debug=True)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: partialerrors
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 1073, in test_partialerr2
fit = nonlinear_fit(data=(None,mean(y),gv.evalcov(y)),fcn=fcn,prior=p,debug=True)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: sqrt-normal priors
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 1177, in test_sqrtnormal
fit = nonlinear_fit(prior=prior, data=(None,y), fcn=fcn)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: svd cuts
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 519, in test_svd
svdcut=svdcut,debug=True)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: unusual cases
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 258, in test_unusual_cases
fit = nonlinear_fit(data=y,prior=prior,fcn=f)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 408, in lsqfit._utilities._c_fdf (src/lsqfit\_utilities.c:4455)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: fit vs wavg uncorrelated
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 286, in test_wavg1
reltol=1e-16,debug=True)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: fit vs wavg correlated
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 315, in test_wavg2
reltol=1e-16,debug=True)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 279, in __init__
v = self._chiv(p)
File "_utilities.pyx", line 633, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:7038)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: wavg of dicts
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 356, in test_wavg_dict
dict(a=gvar(1.9,10.), b=[gvar(1.9,10.),4+gvar(1.9,10.)]),
File "X:\Python34\lib\site-packages\lsqfit\_extras.py", line 409, in wavg
fit = lsqfit.nonlinear_fit(data=data, fcn=fcn, p0=p0, **kargs)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 408, in lsqfit._utilities._c_fdf (src/lsqfit\_utilities.c:4455)
File "_utilities.pyx", line 676, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:8543)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: wavg with a prior
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 370, in test_wavg_prior
ans = wavg(data, prior=prior)
File "X:\Python34\lib\site-packages\lsqfit\_extras.py", line 409, in wavg
fit = lsqfit.nonlinear_fit(data=data, fcn=fcn, p0=p0, **kargs)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 408, in lsqfit._utilities._c_fdf (src/lsqfit\_utilities.c:4455)
File "_utilities.pyx", line 676, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:8543)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: wavg with svd cut
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 337, in test_wavg_svd
var = wavg([(a+b)/2,(a+c)/2.,a],svdcut=1-1e-16).var
File "X:\Python34\lib\site-packages\lsqfit\_extras.py", line 409, in wavg
fit = lsqfit.nonlinear_fit(data=data, fcn=fcn, p0=p0, **kargs)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 676, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:8543)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

======================================================================
ERROR: wavg of arrays
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Build\lsqfit\tests\test_lsqfit.py", line 347, in test_wavg_vec
[gvar(1.9,10.),4+gvar(1.9,10.)]])
File "X:\Python34\lib\site-packages\lsqfit\_extras.py", line 409, in wavg
fit = lsqfit.nonlinear_fit(data=data, fcn=fcn, p0=p0, **kargs)
File "X:\Python34\lib\site-packages\lsqfit\__init__.py", line 290, in __init__
fit = multifit(p0, nf, self._chiv, **self.fitterargs)
File "_utilities.pyx", line 332, in lsqfit._utilities.multifit.__init__ (src/lsqfit\_utilities.c:3211)
File "_utilities.pyx", line 374, in lsqfit._utilities._c_f (src/lsqfit\_utilities.c:3822)
File "_utilities.pyx", line 676, in lsqfit._utilities._build_chiv_chivw.chiv (src/lsqfit\_utilities.c:8543)
ValueError: Buffer dtype mismatch, expected 'long_t' but got 'long'

----------------------------------------------------------------------
Ran 139 tests in 2.203s

FAILED (errors=21)
```