mne-tools/mne-python — pull request #675 by rgoj (2013-06-28 16:37:00+00:00)
Title: WIP Example implementing DICS pSPM calculation

I'm working on implementing DICS (issue #94). The commit in this PR consists of an example where parts of DICS are implemented; there are no separate DICS-related functions for now, this will come later. This is a first draft and a work in progress, I suspect the example will either disappear or be completely reworked (i.e. refactored into functions) by the end of this PR.

I'm submitting it now, so that you can comment on it if you want, but it's nowhere near ready for final review! Any input on direction this is taking is very welcome, though :)

The next step I'd like to take is to prepare a script doing DICS in Fieldtrip to compare to this one. I suspect this will help me/us decide how to go proceed further with implementing DICS (and help me fix any gross errors in the code).

What the implemented example does is:

* calculate CSD from data (done via nitime and matplotlib for comparison; I chose to use these implementations of CSD calculation because they're the most faithful to the original 2001 DICS publication - they use Welch's method)
* calculate spatial filter based on the CSD for a predefined frequency range
* use the spatial filter to obtain source power estimates

There are lots of issues with the code and with what's not there, here are the ones I think are important:

* the example doesn't display the resulting pSPM map
* it doesn't handle SSP and whitening yet
* it will work only for raw data, for evoked data erDICS should be used (Laaksonen et al. 2008) which uses wavelet transform instead of STFT to calculate CSDs
* there is now a dependency on nitime; I suspect you'd prefer not to keep it? the code used can be very easily copied into MNE-Python (like is multitaper.py) or reimplemented, in any case the heavy lifting of CSD
calculation is done by `matplotlib.mlab.csd`
* I guess the CSD calculation could be done using what's already implemented in MNE-Python (`_csd_from_mt`), but I wanted to use Welch's method as in the original publication; this is open for discussion/change of course!