python fitting subroutines