These are links to a few complete experiments (and analysis routines). A good way to get going might be to take one of these and modify it for your experiment...

staircase_JND.py This experiment measures your just noticeable difference (JND) using a staircase design. Combined with the staircase_analysis.py analysis below it's a very efficient method. After 50 trials (or maybe two runs of 50) you should be able to construct a fairly reasonable version of your complete psychometric function. In this case it measures your JND for orientation.

staircase_analysis.py. This script will take a 'pickle' data file (or will combine multiple runs) from a staircase experiment and fit a full psychometric function to it. It works by binning the intensity values and the responses from all the way through the staircase. This way the subject's threshold is calculated from all of their data rather than just the intensity at the final 4 reversals.

Valid XHTML 1.0! Valid CSS!