[SciPy-user] Using external files in a simulation

Howey, David A d.howey at imperial.ac.uk
Mon Jul 25 09:16:43 EDT 2005


I'm about to embark on rewriting some code that I have in matlab, into
python, with a number of improvements, and making good use of python's
object-oriented approach. Before I start, however, I wondered if I could
ask the advice of the list, as I'm sure you will have had experience
with this sort of thing:
	As part of the simulation, I want to read in start up parameters
(physical properties, initial + boundary conditions etc.) from an
external text file (traditionally I suppose you might call this a '.dat'
file). In matlab, I was just using a matlab script for this (ie just
like a bit of the main program, but in another file, allowing easy
changes for different simulations). I could do the same in python and
just import the data based on a filename name entered by the user. Is
this a good approach? It makes sense to keep it simple, although I was
toying with the idea of using XML files for such data storage, to allow
them to be manipulated by some other front/back end stuff. Seems a bit
pointless to add unnecessary complexity at this stage, though.

I'm not sure if I've put that across particularly clearly.. but.. any
thoughts?

Dave

Ps. A slight subtlety is that in fact my simulation engine is modular to
cope with lots of different system configurations and I actually need to
store an arbitrary list of objects which are then solved in sequence for
a bunch of unknowns. I need to represent this somehow in an external set
up file as well. Aargh!




More information about the SciPy-User mailing list