My apologies for bringing up the same question regarding single trial output from tf-mxne several times - I hope my questions are getting better each time.
As Dr. Gramfort has explained in the past, tf-mxne solves for both locations and their timecourses concurrently, and therefore there is no separate inverse operator which can be returned from this process and reused. This solution is based on an average evoked response, so no trial-wise output is possible. My problem is that I would like to use the tf-mxne output to estimate spectral Granger causality, and the spectral estimates this depends upon requires single trial output from the neural sources. It would be perfectly acceptable to use an average evoked response for the tf-mxne localizations, if it was then possible to apply this solution to obtain single trial timecourses at the resulting sources.
As a solution to this I propose to MVAR regress the tf-mxne timecourses, representing the brain-space response, onto the average evoked response as seen at the sensors. The relationship between the sources and the sensors should be linear and constant in time, and this should yield a set of MVAR regression coefficients which may then be used as the inverse operator to generate single trial brain-space timecourses.
I believe that the solution timecourses may be altered somewhat by doing this, as tf-mxne is based on discarding Gabor atoms as dictated by the mixed norm cost function, and that there is no guarantee that the resulting timecourses are directly linearly related to the sensor measurements, but I hope this effect to be minimal. (In my application, which depends upon maintaining linearity throughout the analysis pipeline, this may even be beneficial.)
what you describe is possible ie run a least square inverse on time-frequencies
atoms selected by TF-MxNE. This is however not implemented.
In terms of approach what bothers me is the use of a stationary model
such as Granger on time courses which are obtained to carefully model
the evoked data which are transient / non-stationary effects.
With regard to creating an inverse operator which can be used to produce individual trial output from the tf-mxne solution: I am attempting this by regressing the tf_mixed_norm timecourses onto the evoked average sensor data. This appears to work for magnetometer data but not gradiometers. I expect this is something simple, but I haven't been able to figure it out. I am using the evoked data without whitening (but which doesn't seem to make a difference) or any other preprocessing except for 2-100Hz filtering on the continuous data, and trial rejection based on thresholding the EOG channel. Likewise I am using the 'X' output from tf_mixed_norm without any alterations.
I would like to make this work for both Neuromag 306 and CTF 275 systems. Do you have any ideas? Thanks again,
I have uploaded the function I am using to accomplish this to https://github.com/perlysne/pal_repository along with figures showing output for magnetometers (showing success) and gradiometers (no success). This is based on median nerve stimulation data collected on a Neuromag system. The localizations are very good.
I'm not sure if you would like a complete, running script, or that it be applied to MNE sample data. I can provide either one if needed.
the reason it's not working with both mag and grad is that you don't put them
in the same scale using spatial whitening. At least it's what I suspect.
See how whitening/whitener works in MNE-Python source code.
I tried this without success, but let me revisit my efforts and get back to you. Even if this is a scaling issue, the solution with gradiometers-only should be successful(?). (If you can see the figures I uploaded, one is the successful "magnetometers-only" regression, and the other the unsuccessful "gradiometers-only".)
In the meantime, if I could validate my primary assumption with you: that the relationship between the neural sources and the sensor measurements is fixed and linear (as long as the subject doesn't move in the scanner). This should apply for both magnetometers and gradiometers. I also assume that none of the preprocessing steps (whitening, scaling) are strictly necessary to maintain this?
I tried this without success, but let me revisit my efforts and get back to you. Even if this is a scaling issue, the solution with gradiometers-only should be successful(?). (If you can see the figures I uploaded, one is the successful "magnetometers-only" regression, and the other the unsuccessful "gradiometers-only".)
yes it should. As your example does not run on the MNE sample dataset I cannot
really reproduce.
In the meantime, if I could validate my primary assumption with you: that the relationship between the neural sources and the sensor measurements is fixed and linear (as long as the subject doesn't move in the scanner). This should apply for both magnetometers and gradiometers.
yes via the forward operator.
I also assume that none of the preprocessing steps (whitening, scaling) are strictly necessary to maintain this?
if whatever you apply to the data (whitening, scaling) you apply it
too to the forward matrix yes you're good.