MCPcopy
hub / github.com/mne-tools/mne-python / _rdm

Function _rdm

mne/forward/tests/test_make_forward.py:95–102  ·  view source on GitHub ↗

Compute the ratio of norms, being careful about 0.

(a, b)

Source from the content-addressed store, hash-verified

93
94
95def _rdm(a, b):
96 """Compute the ratio of norms, being careful about 0."""
97 a_norm = np.linalg.norm(a, axis=0)
98 b_norm = np.linalg.norm(b, axis=0)
99 all_zero = (a_norm == 0) & (b_norm == 0)
100 a_norm[all_zero] = 1.0
101 b_norm[all_zero] = 1.0
102 return a_norm / b_norm
103
104
105def _compare_forwards(

Callers 1

_compare_forwardsFunction · 0.85

Calls 1

normMethod · 0.80

Tested by

no test coverage detected