MCPcopy
hub / github.com/ContextLab/hypertools / scale

Function scale

hypertools/_shared/helpers.py:26–32  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

24
25
26def scale(x):
27 assert type(x) is list, "Input data to scale must be list"
28 x_stacked = np.vstack(x)
29 m1 = np.min(x_stacked)
30 m2 = np.max(x_stacked - m1)
31 f = lambda x: 2*(np.divide(x - m1, m2)) - 1
32 return [f(i) for i in x]
33
34
35def group_by_category(vals):

Callers 1

plotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected