count_within_bounds#

cuqi.utilities.count_within_bounds(x, lower_bounds, upper_bounds, threshold=1e-06, exception=nan)#

Returns the number of values in an array whose value lies between the provided lower and upper bounds.

Parameters:
  • x (np.ndarray) – Array to count elements of.

  • lower_bounds (np.ndarray) – Lower bound on values to disregard when counting.

  • upper_bounds (np.ndarray) – Upper bound on values to disregard.

  • threshold (float) – Theshold for considering a value as nonzero.