python code for automating experiments