title: Convert quantiz function to python
body: <p>How can I convert <a href="http://www.mathworks.com/help/comm/ref/quantiz.html" rel="nofollow">MATLAB's <code>quantiz</code> function</a>
  (where xd is the desimated signal) into python/scipy? </p>
  
  <p>I am trying to implement an algorithm that I have developed in MATLAB for speech processing in to a software package using python and libraries like scipy, numpy, pygtk, and matplotlib in order to convert the algorithm into a complete package.</p>
  
  <p>I am using scipy for algorithm development, but I can't find an appropriate function to "quantize the signal" in python:</p>
  
  <pre><code>[I,xq] = quantiz(xd,1:step:1-step, -1:step:1);
  </code></pre>
  
  <p>How would I write this in python?</p>