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

Function _create_eeg_el

mne/forward/_make_forward.py:210–244  ·  view source on GitHub ↗

Create an electrode definition, transform coords if necessary.

(ch, t=None)

Source from the content-addressed store, hash-verified

208
209
210def _create_eeg_el(ch, t=None):
211 """Create an electrode definition, transform coords if necessary."""
212 if ch["kind"] != FIFF.FIFFV_EEG_CH:
213 raise RuntimeError(
214 f"{ch['ch_name']} is not an EEG channel. Cannot create an electrode "
215 "definition."
216 )
217 if t is None:
218 t = Transform("head", "head") # identity, no change
219 if t.from_str != "head":
220 raise RuntimeError("Inappropriate coordinate transformation")
221
222 r0ex = _loc_to_eeg_loc(ch["loc"])
223 if r0ex.shape[1] == 1: # no reference
224 w = np.array([1.0])
225 else: # has reference
226 w = np.array([1.0, -1.0])
227
228 # Optional coordinate transformation
229 r0ex = apply_trans(t["trans"], r0ex.T)
230
231 # The electrode location
232 cosmag = r0ex.copy()
233 _normalize_vectors(cosmag)
234 res = dict(
235 chname=ch["ch_name"],
236 coil_class=FWD.COILC_EEG,
237 w=w,
238 accuracy=_accuracy_dict["normal"],
239 type=ch["coil_type"],
240 coord_frame=t["to"],
241 rmag=r0ex,
242 cosmag=cosmag,
243 )
244 return res
245
246
247def _create_meg_coils(chs, acc, t=None, coilset=None, do_es=False):

Callers 1

_create_eeg_elsFunction · 0.85

Calls 5

TransformClass · 0.85
_loc_to_eeg_locFunction · 0.85
apply_transFunction · 0.85
_normalize_vectorsFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected