Skip to main content

Dynamical systems simulation in python

Trying out PyDSTools [webpage, download]
These guys look professional - they have a test suite that you can run to check everything out.
Issues:
  1. You need to put a file called PyDSTool.pth [read this]
    Play close attention to the trick about subdirectories - you have to repeat it for each level, not just the root level. I have my install in c:\programs\PyDSTool and my file has
    C:\\
    C:\\Programs\\
    C:\\Programs\\PyDSTool\\
  2. I have scipy version 0.6.0 but PyDSTool doesn't detect that properly. I commented out the relevant lines in PyDSTool's root __init__.py
    #if vernums[1] != 5:
    # raise RuntimeError("SciPy v0.5.1 or above is required")

    and it continued with the tests.
Things seem to work OK, only one thing was declared broken:
PyCont: appears to be broken on your system

But, there were periodic errors of the nature:

***** Testing script impfn_test.py ****************************

Gnuplot not available
------- Examples of implicit function as variable
1D example: a half-circle using newton's method (secant method for estimating de
rivative)
Change sign of 'y' initial condition to solve for other half-circle
Gen defined? => False
traj1 = testimp.compute('traj1')
Error in supplied functional specification code
Traceback (most recent call last):
File "impfn_test.py", line 54, in
traj1 = testimp.compute('traj1')
File "C:\Programs\PyDSTool\Generator\ImplicitFnGen.py", line 294, in compute
exec tempspec[0] in globals()
File "string", line 1
def _specfn_imptest_316e-006(ds, t, x, parsinps):
^
SyntaxError: invalid syntax

***** Testing passed on test file impfn_test.py


Which I can't understand

Comments

  1. Hi -- that's an odd platform specific problem you have with time.clock(). The easy fix is to change the return line in the function PyDSTool.common.timestamp to be the following:

    return c.replace(".","").replace("-","")[:tdigits+1]

    (obviously without the newline that this comment box forces on me!)

    ReplyDelete

Post a Comment

Popular posts from this blog

A note on Python's __exit__() and errors

Python's context managers are a very neat way of handling code that needs a teardown once you are done. Python objects have do have a destructor method ( __del__ ) called right before the last instance of the object is about to be destroyed. You can do a teardown there. However there is a lot of fine print to the __del__ method. A cleaner way of doing tear-downs is through Python's context manager , manifested as the with keyword. class CrushMe: def __init__(self): self.f = open('test.txt', 'w') def foo(self, a, b): self.f.write(str(a - b)) def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): self.f.close() return True with CrushMe() as c: c.foo(2, 3) One thing that is important, and that got me just now, is error handling. I made the mistake of ignoring all those 'junk' arguments ( exc_type, exc_val, exc_tb ). I just skimmed the docs and what popped out is that you need to return True or

Using adminer on Mac OS X

adminer is a nice php based sqlite manager. I prefer the firefox plugin "sqlite manager" but it currently has a strange issue with FF5 that basically makes it unworkable, so I was looking for an alternative to tide me over. I really don't want apache running all the time on my computer and don't want people browsing to my computer, so what I needed to do was: Download the adminer php script into /Library/WebServer/Documents/ Change /etc/apache2/httpd.conf to allow running of php scripts (uncomment the line that begins: LoadModule php5_module Start the apache server: sudo apachectl -k start Operate the script by going to localhost Stop the server: sudo apachectl -k stop