[Scipy-svn] r7024 - in branches/0.9.x/scipy/odr: . tests

scipy-svn at scipy.org scipy-svn at scipy.org
Tue Jan 11 07:48:03 EST 2011


Author: rgommers
Date: 2011-01-11 06:48:03 -0600 (Tue, 11 Jan 2011)
New Revision: 7024

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

(backported from r7003)

Modified: branches/0.9.x/scipy/odr/__odrpack.c
===================================================================
--- branches/0.9.x/scipy/odr/__odrpack.c	2011-01-11 12:47:38 UTC (rev 7023)
+++ branches/0.9.x/scipy/odr/__odrpack.c	2011-01-11 12:48:03 UTC (rev 7024)
@@ -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: branches/0.9.x/scipy/odr/tests/test_odr.py
===================================================================
--- branches/0.9.x/scipy/odr/tests/test_odr.py	2011-01-11 12:47:38 UTC (rev 7023)
+++ branches/0.9.x/scipy/odr/tests/test_odr.py	2011-01-11 12:48:03 UTC (rev 7024)
@@ -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