I profiled the code on the mac and made a few adjustments. matplotlib is crashing python so i gave up on it.