I'm running into a curious problem. I have a HybridModel, which in principle works just fine. However, I need to compare a number of models, so I put each model it its own package, with an interface class for easy access. I've done this quite straightforward by cutting up the original (working) code and distribute it over a number of functions.
Apparently, this was a too naive approach, since it doesn't work anymore ;-) I'm facing the following error:
Error in Generator: SingleSupport
Model interface compute_traj method for model 'SingleSupport' failed
<type 'exceptions.ValueError'> setting an array element with a sequence.
Traceback (most recent call last):
File "/Users/ludo/Devel/python/PyDSTool/Model.py", line 2907, in compute
File "/Users/ludo/Devel/python/PyDSTool/Model.py", line 1166, in renameTraj
raise ValueError('No such trajectory name %s'%trajname)
ValueError: No such trajectory name test_iface_traj
I've looked through the files Model.py and MProject.py trying to see what is happening, but honestly, I have no clue. Any help would be much appreciated.
My bad, the error was (of course) caused by my code and not PyDSTool. The traceback send me in the wrong direction.
My apologies :)
I am getting exactly the same error message from my code and cannot figure out what I've done wrong. What was the error that caused this in your program so that I know what to look for?
I use SymPy to generate the differential equations. SymPy unfortunately keeps matrix expressions as a matrix, even though it evaluates to scalar. I had an expression of the form
K = 0.5 * v^T * M * v
(v a vector, M a matrix), and had used
varspec = str(K)
This caused the error, because
str(K) = '[value_of_K]'
(so with square brackets). To resolve it, I had to write
varspec = str(K)
To make a long story short: check the expressions for you differential equations and see if there's something in there that may look to Python as an array (i.e., square brackets).
Log in to post a comment.