MCPcopy Create free account
hub / github.com/danieljfarrell/pvtrace / allinrange

Function allinrange

pvtrace/geometry/utils.py:368–381  ·  view source on GitHub ↗

Returns True if all elements of x are inside x_range, inclusive of the edge values. Parameters ---------- x : array-like A numpy array of values. x_range : tuple of float A tuple defining a range like (xmin, xmax)

(x, x_range)

Source from the content-addressed store, hash-verified

366
367
368def allinrange(x, x_range):
369 """ Returns True if all elements of x are inside x_range, inclusive of the
370 edge values.
371
372 Parameters
373 ----------
374 x : array-like
375 A numpy array of values.
376 x_range : tuple of float
377 A tuple defining a range like (xmin, xmax)
378 """
379 if isinstance(x, (int, float, np.float, np.int)):
380 x = np.array([x])
381 return np.where(np.logical_or(x < x_range[0], x > x_range[1]))[0].size == 0
382
383
384# Vector helpers

Callers 3

__call__Method · 0.90
lookupMethod · 0.90
sampleMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected