python port of matKAM