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

Function get_score_funcs

mne/preprocessing/ica.py:135–173  ·  view source on GitHub ↗

Get the score functions. Returns ------- score_funcs : dict The score functions.

()

Source from the content-addressed store, hash-verified

133
134# makes score funcs attr accessible for users
135def get_score_funcs():
136 """Get the score functions.
137
138 Returns
139 -------
140 score_funcs : dict
141 The score functions.
142 """
143 score_funcs = Bunch()
144 xy_arg_dist_funcs = [
145 (n, f)
146 for n, f in vars(distance).items()
147 if isfunction(f) and not n.startswith("_") and n not in _BLOCKLIST
148 ]
149 xy_arg_stats_funcs = [
150 (n, f)
151 for n, f in vars(stats).items()
152 if isfunction(f) and not n.startswith("_") and n not in _BLOCKLIST
153 ]
154 score_funcs.update(
155 {
156 n: _make_xy_sfunc(f)
157 for n, f in xy_arg_dist_funcs
158 if signature(f).parameters == ["u", "v"]
159 }
160 )
161 # In SciPy 1.9+, pearsonr has (x, y, *, alternative='two-sided'), so we
162 # should just look at the positional_only and positional_or_keyword entries
163 for n, f in xy_arg_stats_funcs:
164 params = [
165 name
166 for name, param in signature(f).parameters.items()
167 if param.kind
168 in (Parameter.POSITIONAL_ONLY, Parameter.POSITIONAL_OR_KEYWORD)
169 ]
170 if params == ["x", "y"]:
171 score_funcs.update({n: _make_xy_sfunc(f, ndim_output=True)})
172 assert "pearsonr" in score_funcs
173 return score_funcs
174
175
176def _check_for_unsupported_ica_channels(picks, info, allow_ref_meg=False):

Callers 2

test_ica_additionalFunction · 0.90
_find_sourcesFunction · 0.85

Calls 3

BunchClass · 0.85
_make_xy_sfuncFunction · 0.85
updateMethod · 0.45

Tested by 1

test_ica_additionalFunction · 0.72