/usr/lib/python2.7/dist-packages/mne/dipole.py is in python-mne 0.7.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: Simplified BSD
import numpy as np
from .utils import logger, verbose
@verbose
def read_dip(fname, verbose=None):
"""Read .dip file from Neuromag/xfit or MNE
Parameters
----------
fname : str
The name of the .dip file.
verbose : bool, str, int, or None
If not None, override default verbose level (see mne.verbose).
Returns
-------
time : array, shape=(n_dipoles,)
The time instants at which each dipole was fitted.
pos : array, shape=(n_dipoles, 3)
The dipoles positions in meters
amplitude : array, shape=(n_dipoles,)
The amplitude of the dipoles in nAm
ori : array, shape=(n_dipoles, 3)
The dipolar moments. Amplitude of the moment is in nAm.
gof : array, shape=(n_dipoles,)
The goodness of fit
"""
try:
data = np.loadtxt(fname, comments='%')
except:
data = np.loadtxt(fname, comments='#') # handle 2 types of comments...
if data.ndim == 1:
data = data[None, :]
logger.info("%d dipole(s) found" % len(data))
time = data[:, 0]
pos = 1e-3 * data[:, 2:5] # put data in meters
amplitude = data[:, 5]
ori = data[:, 6:9]
gof = data[:, 9]
return time, pos, amplitude, ori, gof
|