Handy Python Scripts
Here are some Python scripts I use
for running experiments and performing data analysis. Some of the
scripts interface with MySQL.
I use
MySQL-python-0.9.1 to interface with MySQL through Python.
Use these scripts at your own risk.
- create_run.py
- Given lists of parameter values for various command-line switches,
this script will generate a script that calls an executable with all
combinations of those command-line switches.
- create_table.py
- This script along with the create_rec.py and create_printf.py
scripts use a foo.fields file. The idea is to have one text file
describing a MySQL table. The create_table.py script has an example
of a foo.fields file in its file header. It takes the foo.fields
file and creates the specified MySQL table.
- create_printf.py
- This script uses the same foo.fields file as used by
create_table.py. create_printf.py generates C include files which
declare, define, and then print out global variables for each field
in the foo.fields file.
- create_rec.py
- This script uses the foo.fields file and the data file generated
by a program using the printf statment generated by create_printf to
put all of the raw text data into the corresponding MySQL table.
- util.py
- Once all of the data is in MySQL, it is still useful to use Python
for data analysis. This python module contains generally useful
functions for making MySQL queries from Python.
Here is
an example script which uses util.py.
mstrout@cs.colostate.edu
.... January 1, 2009