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

Function _check_subject_src

mne/morph.py:823–849  ·  view source on GitHub ↗
(
    subject, src, name="subject_from", src_name="src", *, warn_none=False
)

Source from the content-addressed store, hash-verified

821###############################################################################
822# I/O
823def _check_subject_src(
824 subject, src, name="subject_from", src_name="src", *, warn_none=False
825):
826 if isinstance(src, str):
827 subject_check = src
828 elif src is None: # assume it's correct although dangerous but unlikely
829 subject_check = subject
830 else:
831 subject_check = src._subject
832 warn_none = True
833 if subject_check is None and warn_none:
834 warn(
835 "The source space does not contain the subject name, we "
836 "recommend regenerating the source space (and forward / "
837 "inverse if applicable) for better code reliability"
838 )
839 if subject is None:
840 subject = subject_check
841 elif subject_check is not None and subject != subject_check:
842 raise ValueError(
843 f"{name} does not match {src_name} subject ({subject} != {subject_check})"
844 )
845 if subject is None:
846 raise ValueError(
847 f"{name} could not be inferred from {src_name}, it must be specified"
848 )
849 return subject
850
851
852def read_source_morph(fname):

Callers 2

compute_source_morphFunction · 0.85
_interpolate_dataFunction · 0.85

Calls 1

warnFunction · 0.85

Tested by

no test coverage detected