[Scipy-svn] r7003 - in trunk/scipy/odr: . tests

scipy-svn@scip... scipy-svn@scip...
Sat Dec 11 17:47:46 CST 2010


Author: ptvirtan
Date: 2010-12-11 17:47:46 -0600 (Sat, 11 Dec 2010)
New Revision: 7003

Modified:
   trunk/scipy/odr/__odrpack.c
   trunk/scipy/odr/tests/test_odr.py
Log:
BUG: odr: use 'i' instead of 'l' in Py_BuildValue for ints (#1253)

Modified: trunk/scipy/odr/__odrpack.c
===================================================================
--- trunk/scipy/odr/__odrpack.c	2010-12-11 21:09:40 UTC (rev 7002)
+++ trunk/scipy/odr/__odrpack.c	2010-12-11 23:47:46 UTC (rev 7003)
@@ -436,7 +436,7 @@
 
       work_ind =
         Py_BuildValue
-        ("{s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l,s:l}",
+        ("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i}",
          "delta", delta, "eps", eps, "xplus", xplus, "fn", fn, "sd", sd, "sd",
          vcv, "rvar", rvar, "wss", wss, "wssde", wssde, "wssep", wssep,
          "rcond", rcond, "eta", eta, "olmav", olmav, "tau", tau, "alpha",
@@ -499,7 +499,7 @@
 
       retobj =
         Py_BuildValue
-        ("OOO{s:O,s:O,s:O,s:O,s:d,s:d,s:d,s:d,s:d,s:d,s:O,s:O,s:O,s:l}",
+        ("OOO{s:O,s:O,s:O,s:O,s:d,s:d,s:d,s:d,s:d,s:d,s:O,s:O,s:O,s:i}",
          PyArray_Return(beta), PyArray_Return(sd_beta),
          PyArray_Return(cov_beta), "delta", PyArray_Return(deltaA), "eps",
          PyArray_Return(epsA), "xplus", PyArray_Return(xplusA), "y",
@@ -551,7 +551,7 @@
 
   if (kwds == NULL)
     {
-      if (!PyArg_ParseTuple(args, "OOOO|OOOOOOOllz#z#ldddlOOOOOOi:odr",
+      if (!PyArg_ParseTuple(args, "OOOO|OOOOOOOiiz#z#idddiOOOOOOi:odr",
                             &fcn, &initbeta, &py, &px, &pwe, &pwd,
                             &fjacb, &fjacd, &extra_args, &pifixb, &pifixx,
                             &job, &iprint, &errfile, &lerrfile, &rptfile,
@@ -565,7 +565,7 @@
   else
     {
       if (!PyArg_ParseTupleAndKeywords(args, kwds,
-                                       "OOOO|OOOOOOOllz#z#ldddlOOOOOOi:odr",
+                                       "OOOO|OOOOOOOiiz#z#idddiOOOOOOi:odr",
                                        kw_list, &fcn, &initbeta, &py, &px,
                                        &pwe, &pwd, &fjacb, &fjacd,
                                        &extra_args, &pifixb, &pifixx, &job,
@@ -1326,7 +1326,7 @@
 
   printdict =
     Py_BuildValue
-    ("{s:l,s:l,s:l,s:l,s:O,s:O,s:l,s:O,s:l,s:O,s:l,s:l,s:O,s:l,s:l,s:O,s:O,s:l,s:l,s:l,s:d,s:d,s:d,s:l,s:O,s:O,s:l,s:O,s:O,s:l,s:O,s:l,s:O,s:l,s:l}",
+    ("{s:i,s:i,s:i,s:i,s:O,s:O,s:i,s:O,s:i,s:O,s:i,s:i,s:O,s:i,s:i,s:O,s:O,s:i,s:i,s:i,s:d,s:d,s:d,s:i,s:O,s:O,s:i,s:O,s:O,s:i,s:O,s:i,s:O,s:i,s:i}",
      "n", n, "m", m, "np", np, "nq", nq, "beta", (PyObject *) beta, "y",
      (PyObject *) y, "ldy", ldy, "x", (PyObject *) x, "ldx", ldx, "we",
      (PyObject *) we, "ldwe", ldwe, "ld2we", ld2we, "wd", (PyObject *) wd,

Modified: trunk/scipy/odr/tests/test_odr.py
===================================================================
--- trunk/scipy/odr/tests/test_odr.py	2010-12-11 21:09:40 UTC (rev 7002)
+++ trunk/scipy/odr/tests/test_odr.py	2010-12-11 23:47:46 UTC (rev 7003)
@@ -1,7 +1,8 @@
 # Scipy imports.
 import numpy as np
 from numpy import pi
-from numpy.testing import assert_array_almost_equal, TestCase, run_module_suite
+from numpy.testing import assert_array_almost_equal, TestCase, \
+     run_module_suite, assert_equal
 from scipy.odr import Data, Model, ODR, RealData, odr_stop
 
 
@@ -307,6 +308,21 @@
         )
 
 
+    def test_ticket_1253(self):
+        def linear(c, x):
+            return c[0]*x+c[1]
+
+        c = [2.0, 3.0]
+        x = np.linspace(0, 10)
+        y = linear(c, x)
+
+        model = Model(linear)
+        data = Data(x, y, wd=1.0, we=1.0)
+        job = ODR(data, model, beta0=[1.0, 1.0])
+        result = job.run()
+        assert_equal(result.info, 2)
+
+
 if __name__ == "__main__":
     run_module_suite()
 #### EOF #######################################################################



More information about the Scipy-svn mailing list