[FieldTrip] ft_sourceanalysis, reshape error

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Feb 10 17:19:40 CET 2016


Hi David,

Could you first try and upgrade to the most recent version of Fieldtrip? Currently it seems that the reshaping that you mention on line 619/620 of ft_sourceanalysis, corresponds to lines 615/616 in my (i.e. the current) version.

It could be that something goes wrong with the data handling, but I want to be sure that you’re not running into the problem with a buggy version of the code that may have been fixed in the meantime.

Best
Jan-Mathijs

On Feb 10, 2016, at 5:04 PM, David Pedrosa <david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>> wrote:

Hi Jan-Mathijs,

thanks for your reply. I have explicitly made sure the order of both is identical (except for the EMG channel which is only present in the frequency analysis but not in the leadfield) and the problem still pops up, which makes me wonder if it could be something else as you suggested.

Sorry for not being more precise. So the freqAll contains the fourier spectra for all channels and I have used many trials so I chose 'keeptrials'. Do you have any other suggestions what I could check or which settings might be causing this problem?

Thanks
Best,
David

________________________________
Dr. David Pedrosa

Clinical Research Fellow
Medical Research Council Brain Network Dynamics Unit at the University of Oxford
Nuffield Department of Clinical Neurosciences
University of Oxford
Level 6, West Wing
John Radcliffe Hospital, OX3 9DU
Tel: +44 (0)1865 572490
E-Mail: david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>

http://www.mrcbndu.ox.ac.uk/<https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f>
________________________________
Von: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>]" im Auftrag von "Schoffelen, J.M. (Jan Mathijs) [jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>]
Gesendet: Mittwoch, 10. Februar 2016 15:30
An: FieldTrip discussion list
Betreff: Re: [FieldTrip] ft_sourceanalysis, reshape error

Hi David,

Yes, I think that could cause the problem, although if that were true, your specific issue seems to be a convoluted manifestation of it.

Bottom line with respect to channel order: when using pre-computed leadfields, the underlying assumption is more or less that the order of the channels, as represented in the leadfields, is the same as the order of the channels in the data. In principle, this can be accommodated with proper data bookkeeping, i.e. checking the labels that are associated with the data structure containing the forward model (i.e. the leadfield) against the channels in the data. We have started to move in this direction by inclusion of a label-field in data structures containing leadfields. Yet, the explicit check  about channels and orderings of channels so far only throws an error if there’s a mismatch in the number of channels.

Your reported error with a reshape issue could also reflect a problem with the data handling as such. Some more information would be appreciated in this regard. What does your freqAll contain in terms of spectral data? Fourier coefficients or cross-spectra? In case it’s cross-spectra, does it include multiple trials or not? If not, would it make sense to switch off the cfg.keeptrials flag in your cfg to ft_sourceanalysis.

Best,
Jan-Mathijs



On Feb 10, 2016, at 3:54 PM, David Pedrosa <david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>> wrote:

Hi Azeez,

I have been checking leadfields and data labels and they are actually the same. But the order is slightly different. Do you think this may cause the problems?

Thanks for your help.

Best,
David

________________________________
Dr. David Pedrosa

Clinical Research Fellow
Medical Research Council Brain Network Dynamics Unit at the University of Oxford
Nuffield Department of Clinical Neurosciences
University of Oxford
Level 6, West Wing
John Radcliffe Hospital, OX3 9DU
Tel: +44 (0)1865 572490
E-Mail: david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>

http://www.mrcbndu.ox.ac.uk/<https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f>
________________________________
Von: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>]" im Auftrag von "Azeez Adebimpe [azeez.adebimpe5 at gmail.com<mailto:azeez.adebimpe5 at gmail.com>]
Gesendet: Freitag, 5. Februar 2016 22:44
An: FieldTrip discussion list
Betreff: Re: [FieldTrip] ft_sourceanalysis, reshape error

Hi David,

Sorry for late reply, I was on the journey.
The same issue happened to me before when the labels in the leadfield and data were not the same.
if you have 'Fp1' in leadfield and 'FP1' in data, it will view as different channels.


Azeez




On Fri, Feb 5, 2016 at 9:51 AM, David Pedrosa <david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>> wrote:
Hi Azeez,

thank you for the fast reply!
I hadn't considered that but I have checked and I use the same labels for both leadfield and data.

I mean it makes kind of sense that the reshape doesn't work as it is now, but I don't know where the problem is before.

Can you think of anything else?

Best,
David

________________________________
Dr. David Pedrosa

Clinical Research Fellow
Medical Research Council Brain Network Dynamics Unit at the University of Oxford
Nuffield Department of Clinical Neurosciences
University of Oxford
Level 6, West Wing
John Radcliffe Hospital, OX3 9DU
Tel: +44 (0)1865 572490<tel:%2B44%20%280%291865%20572490>
E-Mail: david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>

http://www.mrcbndu.ox.ac.uk/<https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f>
________________________________
Von: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>]" im Auftrag von "Azeez Adebimpe [azeez.adebimpe5 at gmail.com<mailto:azeez.adebimpe5 at gmail.com>]
Gesendet: Freitag, 5. Februar 2016 13:56
An: FieldTrip discussion list
Betreff: Re: [FieldTrip] ft_sourceanalysis, reshape error

Hi David,

Probably the channels' labels in leadfield and data are not the same.

check it and try again.

Azeez

On Fri, Feb 5, 2016 at 8:47 AM, David Pedrosa <david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>> wrote:
Dear list,

after installing the newest version of Fieldtrip today, I have encountered a rather strange error . I am tying to compute corticomuscular coherence for an EEG/EMG dataset and it worked well so far. With the new version however, I get a reshape error I find fard to understand. This is the code:

    cfg              = [];
    cfg.frequency    = 20;;
    cfg.grid        = leadfield;
    cfg.method       = 'dics';
    cfg.refchan      = 'ExtR1';
    cfg.channel         = {'EEG' 'ExtR1'};
    cfg.vol          = hdm;
    cfg.dics.projectnoise = 'no';
    cfg.dics.lambda       = '1%';
    cfg.dics.keepfilter   = 'yes';
    cfg.dics.keeptrials   = 'yes';
    cfg.dics.realfilter   = 'yes';
    sourceAll = ft_sourceanalysis(cfg, freqAll);

but this hasn't changed. The error pops up at lines 619/620 of ft_sourceanalysis (Cf = reshape(sum(Cf, 1) / Ntrials, [Nchans Nchans]);), where it supposedly just averages the CSD matrix over trials.  And it makes kind of sense as the line says to reshape the CSDs from a 1xNchans matrix into a [Nchans Nchans] one. But why is it poppin up now as nothing has changed in my analyses? I have checked the updates of the last months and I couldn't find anything related to this. So has any one an idea why the analysis crashes at this point.

Thanks in advance
Best,
David

________________________________
Dr. David Pedrosa

Clinical Research Fellow
Medical Research Council Brain Network Dynamics Unit at the University of Oxford
Nuffield Department of Clinical Neurosciences
University of Oxford
Level 6, West Wing
John Radcliffe Hospital, OX3 9DU
Tel: +44 (0)1865 572490<tel:%2B44%20%280%291865%20572490>
E-Mail: david.pedrosa at ndcn.ox.ac.uk<mailto:david.pedrosa at ndcn.ox.ac.uk>

http://www.mrcbndu.ox.ac.uk/<https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f>

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160210/cfb740db/attachment-0002.html>


More information about the fieldtrip mailing list