How to use fit_dipole with non-EEG data?

Dear all,

I would like to loaclize a time-varying magnet source (think of it as a dipole that ramps it magnetization up and down) in a space. I have time domain measurement data from multiple magnetometers that aquired synchronized time-traces at multiple known and fixed locations in space. For each magnetometer I have a numpy array of dimension (3xN) for all axes (x,y,z) and the time domain (N points). How can I fit this data using the fit_dipole routing? I feel a little overwhelmed by the Evoked data handler as I do not have fif files but just simple numpy arrays.

Thank you very much!

Peter

You can create MNE python objects from numpy arrays using mne.io.RawArray or mne.EpochsArray

Then run those through the standard dipole fit routine. The problem is the adding in the magnetometer locations and geometry if they are non-standard. If you have one of the standard systems - I would just import them mne.io.read_raw_<fif/ctf/bti/kit>. Look in the mne.io.read… - there are many different options for import.

Hope that helps.
-Jeff

If the locations do not correspond to a standard MEG machine, you can try mne.channels.make_dig_montage(). Normally that’s for EEG sensors but in principle it should work for magnetometers too (and if it doesn’t, let us know, we can probably make it so that it does).

then do as @jstout211 suggests: combine your NumPy arrays into a single array of shape (n_channels, n_times) and use mne.EvokedArray (or mne.EpochsArray if you have multiple trials and will want to average them). Then you can do evoked.set_montage() to add the channel locations. Hopefully from there you can follow the standard fit_dipole code path.