Port from scientific python to scipy/numpy.