Merge lp:~breisfeld/pydstool/test_fix into lp:pydstool

Proposed by breisfeld
Status: Needs review
Proposed branch: lp:~breisfeld/pydstool/test_fix
Merge into: lp:pydstool
Diff against target: 115 lines (+19/-13)
5 files modified
PyDSTool/Generator/Vode_ODEsystem.py (+1/-1)
PyDSTool/Toolbox/optimizers/helpers/finite_difference.py (+1/-1)
PyDSTool/common.py (+2/-2)
PyDSTool/tests/Symbolic_test.py (+8/-6)
PyDSTool/utils.py (+7/-3)
To merge this branch: bzr merge lp:~breisfeld/pydstool/test_fix
Reviewer Review Type Date Requested Status
VCS imports Pending
Review via email: mp+70206@code.launchpad.net

Description of the change

This branch has a few minor changes that addressed some of the test failures I was experiencing

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/2/2011 9:00 PM, breisfeld wrote:
> breisfeld has proposed merging lp:~breisfeld/pydstool/test_fix into
> lp:pydstool.
>
> Requested reviews: VCS imports (vcs-imports)
>
> For more details, see:
> https://code.launchpad.net/~breisfeld/pydstool/test_fix/+merge/70206
>
> This branch has a few minor changes that addressed some of the test
> failures I was experiencing

I don't think you want to propose this against lp:pydstool. You probably
are looking for lp:ubuntu/pydstool.

I'm not positive, though. But I'm pretty sure pydstool isn't using
Launchpad to manage its code. (Given the owner is VCS-Imports.)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk477BkACgkQJdeBCYSNAAOAaQCeJYATiVJH06J8AjHf8TqngL7X
4SwAoLsK6Tl3n0xw3IQXHUZBNeJ2PdOf
=X14e
-----END PGP SIGNATURE-----

Revision history for this message
Robert Clewley (rob-clewley) wrote :

Thanks to you both for your interest and information. Additions fixing these issues have been made in the actual repository that we use, which is at sourceforge. It will show up on the bzr repo at http://sourceforge.net/scm/?type=bzr&group_id=140858
-Rob

Unmerged revisions

504. By breisfeld

Minor changes to address a few of the test failures.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'PyDSTool/Generator/Vode_ODEsystem.py'
2--- PyDSTool/Generator/Vode_ODEsystem.py 2010-07-20 01:03:28 +0000
3+++ PyDSTool/Generator/Vode_ODEsystem.py 2011-08-02 18:59:45 +0000
4@@ -13,7 +13,7 @@
5 # Other imports
6 from numpy import Inf, NaN, isfinite, sometrue, alltrue, sign, all, any, \
7 array, zeros, less_equal, transpose, concatenate, asarray, linspace, \
8- unique1d
9+ unique
10 import math, random
11 from copy import copy, deepcopy
12 import os, platform, shutil, sys, gc
13
14=== modified file 'PyDSTool/Toolbox/optimizers/helpers/finite_difference.py'
15--- PyDSTool/Toolbox/optimizers/helpers/finite_difference.py 2010-06-05 23:00:09 +0000
16+++ PyDSTool/Toolbox/optimizers/helpers/finite_difference.py 2011-08-02 18:59:45 +0000
17@@ -118,7 +118,7 @@
18 try:
19 pars = tuple(p)
20 except TypeError:
21- pars = p
22+ pars = (p,)
23 try:
24 r = self.pest.key_logged_residual(pars, self.pest.context.weights)
25 except KeyError:
26
27=== modified file 'PyDSTool/common.py'
28--- PyDSTool/common.py 2010-08-05 01:34:49 +0000
29+++ PyDSTool/common.py 2011-08-02 18:59:45 +0000
30@@ -322,7 +322,7 @@
31 (Must set weights and deadzone vectors/scalars after creation, e.g.
32 in a feature's _local_init method).
33 """
34- def __call__(self, pts1, pts2, use_deadzone=True):
35+ def __call__(self, pts1, pts2, use_deadzone=True):
36 v = array(pts1-pts2).flatten()*self.weights
37 if use_deadzone:
38 v = (abs(v) > self.deadzone).astype(int) * v
39@@ -3324,7 +3324,7 @@
40 if always is True, the report will occur on every function
41 call; otherwise only on the first time the function is called
42 """
43- assert(callable, func)
44+ assert callable(func)
45 def wrapper(*args, **kwargs):
46 ret = func(*args, **kwargs)
47
48
49=== modified file 'PyDSTool/tests/Symbolic_test.py'
50--- PyDSTool/tests/Symbolic_test.py 2010-05-19 19:02:57 +0000
51+++ PyDSTool/tests/Symbolic_test.py 2011-08-02 18:59:45 +0000
52@@ -1,3 +1,5 @@
53+from numpy.testing.utils import assert_approx_equal
54+
55 from PyDSTool import *
56 from PyDSTool.parseUtils import replaceCallsWithDummies, doneg, dosub
57 from numpy.random import rand
58@@ -244,12 +246,12 @@
59 sc4 = str(a.eval(xv=5))=='5/qv'
60 print "a.eval(xv=5) == 5/q? ", sc4
61 assert sc4
62-sc5 = str(a.eval(xv=5,qv=q()))=='0.83333333333333337'
63-print "a.eval(xv=5,qv=q()) == 0.83333333333333337? ", sc5
64-assert sc5
65-sc6 =str(a.eval({'xv': 10, 'qv': q()}))=='0.90909090909090906'
66-print "a.eval({'xv': 10, 'qv': q()}) == 0.90909090909090906? ", sc6
67-assert sc6
68+sc5 = (str(a.eval(xv=5,qv=q())),'0.83333333333333337')
69+assert_approx_equal(*sc5)
70+print "assert_approx_equal(%s,%s)" % sc5
71+sc6 = (str(a.eval({'xv': 10, 'qv': q()})),'0.90909090909090906')
72+print "assert_approx_equal(%s,%s)" % sc6
73+assert_approx_equal(*sc6)
74
75 print "qs=QuantSpec('qsv','xsv+1')"
76 print "xs=QuantSpec('xsv','3')"
77
78=== modified file 'PyDSTool/utils.py'
79--- PyDSTool/utils.py 2009-09-04 16:57:10 +0000
80+++ PyDSTool/utils.py 2011-08-02 18:59:45 +0000
81@@ -10,7 +10,7 @@
82 from numpy import Inf, NaN, isfinite, less, greater, sometrue, alltrue, \
83 searchsorted, take, argsort, array, swapaxes, asarray, zeros, transpose, \
84 float64, int32, ndarray
85-from scipy.optimize import minpack
86+from scipy.optimize import minpack, zeros
87 import time, sys, os
88 import copy
89
90@@ -150,11 +150,15 @@
91 # scipy signatures use y instead of t, but this naming is consistent
92 # with that in the Generator module
93 try:
94+ newton_meth = minpack.newton # older scipy
95+ except AttributeError:
96+ newton_meth = zeros.newton
97+ try:
98 if standalone:
99 def newton_fn(t):
100 rout.start()
101 ## rerr.start()
102- res = minpack.newton(f, x0, args=(t,)+extrafargs, tol=xtolval,
103+ res = newton_meth(f, x0, args=(t,)+extrafargs, tol=xtolval,
104 maxiter=maxnumiter, fprime=fprime)
105 rout.stop()
106 ## warns = rout.stop()
107@@ -196,7 +200,7 @@
108 def newton_fn(s, t):
109 rout.start()
110 ## rerr.start()
111- res = minpack.newton(f, x0, args=(t,)+extrafargs, tol=xtolval,
112+ res = newton_meth(f, x0, args=(t,)+extrafargs, tol=xtolval,
113 maxiter=maxnumiter, fprime=fprime)
114 rout.stop()
115 ## warns = rout.stop()

Subscribers

People subscribed via source and target branches

to all changes: