_prepare_forward
tit.source._prepare_forward ¶
Assemble the MNE forward/source-space/morph files from a SimNIBS leadfield.
Run as a child process of :func:tit.source.forward.prepare_forward::
<simnibs python> -m tit.source._prepare_forward \
<m2m_dir> <leadfield.hdf5> <info.fif> <trans.fif> --fsaverage 5
This is a drop-in replacement for SimNIBS's own prepare_eeg_forward mne
console script -- same inputs, same call into
:func:simnibs.eeg.forward.make_forward, same outputs written next to the
leadfield -- with one addition:
:func:tit.source._simnibs_compat.ensure_simnibs_eeg_compat runs first.
Why not just call the console script (the failure this prevents)¶
prepare_eeg_forward is a shell wrapper around python -E, which ignores
PYTHONPATH and every other PYTHON* variable, so there is no way to get
a compatibility shim into that interpreter from outside. On the image's stack
SimNIBS's own bridge dies with AttributeError: No mne.source_space attribute
_complete_source_space_info about ten minutes in, after the FEM leadfield
has been computed. Calling the underlying function ourselves keeps the work in
a separate process (the gain matrix is ~0.9 GB for a 75-channel net) while
letting the shim run.