Thermodynamic Integration Python