Ported MATLAB wrapper functions to Python