where function

(Shortest import: from brian2 import where)

brian2.units.unitsafefunctions.where(condition, [x, y, ]/)[source]

Return elements chosen from x or y depending on condition.


When only condition is provided, this function is a shorthand for np.asarray(condition).nonzero(). Using nonzero directly should be preferred, as it behaves correctly for subclasses. The rest of this documentation covers only the case where all three arguments are provided.