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

Function write_forward_solution

mne/forward/forward.py:858–900  ·  view source on GitHub ↗

Write forward solution to a file. Parameters ---------- %(fname_fwd)s fwd : Forward Forward solution. %(overwrite)s %(verbose)s See Also -------- read_forward_solution Notes ----- Forward solutions, which are derived from an original forward

(fname, fwd, overwrite=False, verbose=None)

Source from the content-addressed store, hash-verified

856
857@verbose
858def write_forward_solution(fname, fwd, overwrite=False, verbose=None):
859 """Write forward solution to a file.
860
861 Parameters
862 ----------
863 %(fname_fwd)s
864 fwd : Forward
865 Forward solution.
866 %(overwrite)s
867 %(verbose)s
868
869 See Also
870 --------
871 read_forward_solution
872
873 Notes
874 -----
875 Forward solutions, which are derived from an original forward solution with
876 free orientation, are always stored on disk as forward solution with free
877 orientation in X/Y/Z RAS coordinates. Transformations (surface orientation,
878 fixed orientation) will be reverted. To reapply any transformation to the
879 forward operator please apply :func:`convert_forward_solution` after
880 reading the forward solution with :func:`read_forward_solution`.
881
882 Forward solutions, which are derived from an original forward solution with
883 fixed orientation, are stored on disk as forward solution with fixed
884 surface-based orientations. Please note that the transformation to
885 surface-based, fixed orientation cannot be reverted after loading the
886 forward solution with :func:`read_forward_solution`.
887 """
888 check_fname(
889 fname,
890 "forward",
891 ("-fwd.fif", "-fwd.fif.gz", "_fwd.fif", "_fwd.fif.gz", "-fwd.h5", "_fwd.h5"),
892 )
893
894 # check for file existence and expand `~` if present
895 fname = _check_fname(fname, overwrite)
896 if fname.suffix == ".h5":
897 _write_forward_hdf5(fname, fwd)
898 else:
899 with start_and_end_file(fname) as fid:
900 _write_forward_solution(fid, fwd)
901
902
903def _write_forward_hdf5(fname, fwd):

Callers 9

test_make_forward_dipoleFunction · 0.90
test_make_forward_no_megFunction · 0.90
test_io_forwardFunction · 0.90
test_channel_name_limitFunction · 0.90
saveMethod · 0.85

Calls 5

check_fnameFunction · 0.85
_check_fnameFunction · 0.85
_write_forward_hdf5Function · 0.85
start_and_end_fileFunction · 0.85
_write_forward_solutionFunction · 0.85

Tested by 8

test_make_forward_dipoleFunction · 0.72
test_make_forward_no_megFunction · 0.72
test_io_forwardFunction · 0.72
test_channel_name_limitFunction · 0.72