MCPcopy Create free account
hub / github.com/chenhaoxing/HDNet / print_numpy

Function print_numpy

util/util.py:67–80  ·  view source on GitHub ↗

Print the mean, min, max, median, std, and size of a numpy array Parameters: val (bool) -- if print the values of the numpy array shp (bool) -- if print the shape of the numpy array

(x, val=True, shp=False)

Source from the content-addressed store, hash-verified

65
66
67def print_numpy(x, val=True, shp=False):
68 """Print the mean, min, max, median, std, and size of a numpy array
69
70 Parameters:
71 val (bool) -- if print the values of the numpy array
72 shp (bool) -- if print the shape of the numpy array
73 """
74 x = x.astype(np.float64)
75 if shp:
76 print('shape,', x.shape)
77 if val:
78 x = x.flatten()
79 print('mean = %3.3f, min = %3.3f, max = %3.3f, median = %3.3f, std=%3.3f' % (
80 np.mean(x), np.min(x), np.max(x), np.median(x), np.std(x)))
81
82
83def mkdirs(paths):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected