python script for multi-phase model