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

Method del_proj

mne/_fiff/proj.py:351–388  ·  view source on GitHub ↗

Remove SSP projection vector. .. note:: The projection vector can only be removed if it is inactive (has not been applied to the data). Parameters ---------- idx : int | list of int | str Index of the projector to remove. Can also be "a

(self, idx="all")

Source from the content-addressed store, hash-verified

349 return self
350
351 def del_proj(self, idx="all"):
352 """Remove SSP projection vector.
353
354 .. note:: The projection vector can only be removed if it is inactive
355 (has not been applied to the data).
356
357 Parameters
358 ----------
359 idx : int | list of int | str
360 Index of the projector to remove. Can also be "all" (default)
361 to remove all projectors.
362
363 Returns
364 -------
365 self : same type as the input data
366 The instance.
367 """
368 if isinstance(idx, str) and idx == "all":
369 idx = list(range(len(self.info["projs"])))
370 idx = np.atleast_1d(np.array(idx, int)).ravel()
371
372 for ii in idx:
373 proj = self.info["projs"][ii]
374 if proj["active"] and set(self.info["ch_names"]) & set(
375 proj["data"]["col_names"]
376 ):
377 msg = (
378 f"Cannot remove projector that has already been "
379 f"applied, unless you first remove all channels it "
380 f"applies to. The problematic projector is: {proj}"
381 )
382 raise ValueError(msg)
383
384 keep = np.ones(len(self.info["projs"]))
385 keep[idx] = False # works with negative indexing and does checks
386 with self.info._unlock():
387 self.info["projs"] = [p for p, k in zip(self.info["projs"], keep) if k]
388 return self
389
390 @fill_doc
391 def plot_projs_topomap(

Callers 15

test_xdawn_fitFunction · 0.80
test_XdawnTransformerFunction · 0.80
test_ica_coreFunction · 0.80
short_raw_epochsFunction · 0.80
test_regress_artifactFunction · 0.80
test_find_ecgFunction · 0.80
test_add_reorderFunction · 0.80
test_projFunction · 0.80
get_raw_dataFunction · 0.80
_test_raw_readerFunction · 0.80

Calls 2

setFunction · 0.85
_unlockMethod · 0.80

Tested by 15

test_xdawn_fitFunction · 0.64
test_XdawnTransformerFunction · 0.64
test_ica_coreFunction · 0.64
short_raw_epochsFunction · 0.64
test_regress_artifactFunction · 0.64
test_find_ecgFunction · 0.64
test_add_reorderFunction · 0.64
test_projFunction · 0.64
_test_raw_readerFunction · 0.64
test_reorder_channelsFunction · 0.64