Back to the main page.

Bug 3161 - Add support for cross-spectrum to ft_freqdescriptives

Status CLOSED FIXED
Reported 2016-07-13 16:35:00 +0200
Modified 2016-11-29 09:01:14 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 enhancement
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Vladimir Litvak - 2016-07-13 16:35:30 +0200

Created attachment 799 Suggested modifications Hi all, I'm trying to implement jackknife correlation for granger as described in Craig Richter's paper. To make it efficient it is necessary to re-compute average power and cross-spectra from those of single-trials without re-doing freqanalysis. ft_freqdescriptives works for power spectra- but not for cross-. I modified the code as attached but just the part relevant for me. It seems to work. Could you please check this and commit? Thanks, Vladimir


Jan-Mathijs Schoffelen - 2016-07-13 17:05:57 +0200

Is this change needed? ft_checkdata allows for the following (assuming freq data computed with 'fourier' as method): freq = ft_checkdata(freq, 'cmbrepresentation', 'sparsewithpow', 'channelcmb', {some list, Nx2}); freq = ft_checkdata(freq, 'cmbrepresentation', 'full'); The first call should give single trial estimates of crsspctrm and powspctrm in the old-fashioned style, i.e. linearly indexed combinations, with the auto-combinations in powspctrm, The second call should give single trial estimates of the crsspctrm as a nchanxnchanxnfrq matrix. PS: could I gently nudge you towards starting to use github for code contributions?


Vladimir Litvak - 2016-07-13 17:10:59 +0200

This is not about converting from fourier to powandcsd but about going from single trials to average. For jackknife you need to compute averages repeatedly excluding one trial at a time and I don't see a way to do it with the present code other than rerunning freqanalysis. The trouble with github is I forget all about the details of how to use it in between my infrequent contributions. Thanks, Vladimir


Jan-Mathijs Schoffelen - 2016-07-14 09:06:24 +0200

Oh, I see. If it's about going from single trials to average, I'd recommend looking at ft_selectdata with the option cfg.avgoverrpt = 'yes'. Not sure whether crsspctrm is properly supported, but I'd rather further develop the code and support of this functionality there, than in the rather outdated ft_freqdescriptives. Probably even ft_freqdescriptives should be revamped such as to start using ft_selectdata (or should be deprecated altogether).


Vladimir Litvak - 2016-07-14 14:53:45 +0200

That seems to work. Perhaps indeed time to get rid of ft_freqdescriptives.


Jan-Mathijs Schoffelen - 2016-08-08 11:04:56 +0200

this seems resolved