PyPSG

Documentation

Chapter 1: Which specifications should follow my program?

Well, this is an easy question. In principle the only requisite refers to its input. In order to PySPG be useful for you, first of all, you must make small changes in the way your program reads its parameters (or may be your program already has this input file!!!). PySPG writes a file (which is the input file for your simulation code). This file has the following (trivial) structure:
var1    value1
var2    value2

and so on...
For example if D=0.5, and k=2 the file will be
D    0.5
k    2


Perhaps you must rewrite part of your program in order to allow this syntax. Or you can touch the PySPG in order to understand yours.

PySPG is a bunch of Python classes aimed to those of you that must run programs in which some parameters change.

For example: Let's suppose you want to run simulations in which three parameters are envolved, let's say D, k, a. Let's show some possible scenarios for your simulations

  1. You want to run a simulation in which D, k are kept fixed and a varies linearly between 1 and 5 with a step of .2. It's really easy: you just add a loop on a variable, and you are done
  2. Now, you want to keep fixed D, but now both k and a vary linearly between 1 and 5 with a step of .2. It's : you just add another loop on k variable, to that loop on a and you're done again. But note that you had to recompile your code
  3. After those simulations you realise that the scale relevant for the variable a is not a linear one, but logarithmic. Let's compile again.
  4. And if you want to run a simulation in which the variation is on D variable? Obviously compile the whole thing again...
  5. And if the variation must be exponential???

The only relevant information your simulation returns are the measures it does. The variables are set from outside, so you can extract one layer of complexity from your compiled code. In fact the time your program takes to run is NOT in the loops of changing parameters. So you can avoid the problem of writing boring code into just writing a simple text file that will launch the other program for you.




Go back to the documentation page
© 2003-2005 Claudio J. Tessone