binomial_filter#

class binomial_filter(prob, arr)[source]#

Binomial “filter” – the same as n_binomial, except return the elements of arr that succeeded.

Parameters:
  • prob (float) – probability of each trial succeeding

  • arr (array) – the array to be filtered

Returns:

Subset of array for which trials succeeded

Example:

inds = hpv.binomial_filter(0.5, np.arange(20)**2) # Return which values out of the (arbitrary) array passed the coin flip