title: Filtering histogram edges and counts
body: <p>Consider a histogram calculation of a numpy array that returns percentages:</p>
  
  <pre><code># 500 random numbers between 0 and 10,000
  values = np.random.uniform(0,10000,500)
  
  # Histogram using e.g. 200 buckets
  perc, edges = np.histogram(values, bins=200,
                             weights=np.zeros_like(values) + 100/values.size)
  </code></pre>
  
  <p>The above returns two arrays:</p>
  
  <ul>
  <li><code>perc</code> containing the <code>%</code> (i.e. percentages) of values within each pair of consecutive <code>edges[ix]</code> and <code>edges[ix+1]</code> out of the total.</li>
  <li><code>edges</code> of length <code>len(hist)+1</code></li>
  </ul>
  
  <p>Now, say that I want to filter <code>perc</code> and <code>edges</code> so that I only end up with the percentages and edges for <strong>values</strong>  contained within a new range <code>[m, M]</code>. '</p>
  
  <p>That is, I want to work with the <strong>sub-arrays</strong> of <code>perc</code> and <code>edges</code> corresponding to the interval of values within <code>[m, M]</code>.  Needless to say, the new array of percentages would still refer to the total fraction count of the input array. We just want to filter <code>perc</code> and <code>edges</code> to end up with the correct sub-arrays.</p>
  
  <p>How can I post-process <code>perc</code> and <code>edges</code> to do so?</p>
  
  <p>The values of <code>m</code> and <code>M</code> can be any number of course. In the example above, we can assume e.g. <code>m = 0</code> and <code>M = 200</code>.</p>