[FieldTrip] fieldtrip Digest, Vol 31, Issue 15
Steve Johnston
S.J.Johnston at swansea.ac.uk
Fri Jun 7 11:59:10 CEST 2013
Thanks, and sorry, that was a pretty poor description of the results by me. Yes, I am getting a result, but the error/warning is
'Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.376132e-17. '
I figured that matrix singularity may have been the problem, although I hadn't appreciated that replacing only three channels could lead to it - I was expecting that to result from more channel replacements or using a lot of electrodes to interpolate with.
Thanks a lot for the help, will try as you suggest
Steve
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 7 Jun 2013 10:23:20 +0100
> From: Steve Johnston <S.J.Johnston at swansea.ac.uk>
> To: "fieldtrip at science.ru.nl" <fieldtrip at science.ru.nl>
> Subject: [FieldTrip] Bad channel correction problems and ICA
> Message-ID: <55D211F2-5D76-43EE-B41A-EA05C8FFCE6F at swansea.ac.uk>
> Content-Type: text/plain; charset="windows-1252"
>
> Dear fters
>
> I've just started using ft and, although being able to run through a test run of eye movement data just fine, I'm now getting into the more detailed stuff and I'm hitting a snag that I hope you can help me with.
>
> Specifically I'm struggling to get any real ICA results after using ft_channelrepair but not if I go through without it.
>
> Data was recorded on a biosemi 128 system and the trials are just eye movements that I want to identify via ICA (simple test).
>
> If I just run through the procedure of importing data, set markers, remove gross artifacts (keeping all channels, including 3 bad ones) and then run the ICA - I get lovely eye movement components appearing. However, now I want to do it 'properly' and replace the bad channels. Currently I do the following ? (sorry, for completeness I included everything to be on the safe side).
>
> %%
> % Standard cfg for import
>
> cfg = [];
> cfg.trialdef.prestim = .2;
> cfg.trialdef.poststim = 2;
> cfg.trialdef.eventtype = 'STATUS';
>
> %%
> %Load each dataset and examine for channels that are bad - starting with EOG Localiser.
>
> cfg.dataset = [subjectdata.dir filesep subjectdata.artifactfile];
> cfg.trialdef.eventvalue = markers.artifact;
> cfg = ft_definetrial(cfg);
>
> cfg.demean = 'yes';
> data = ft_preprocessing(cfg);
>
> % After the above, run ChannelRepair after identifying bad channels.
> %%
> % Channel Replace - get nearest neighbours
> cfg = [];
> cfg.method = 'distance'
> cfg.layout = 'biosemi128.lay';
> cfg.neighbourdist = 0.13;
> [neighbours] = ft_prepare_neighbours(cfg,data)
>
> %% Interpolate and put into new data structure
> cfg = [];
> cfg.badchannel = replace_channels;
> cfg.layout = 'biosemi128.lay';
> cfg.method = 'nearest';
> cfg.neighbours = neighbours;
> cfg.neighbourdist = 0.13;
> artifact_cleandata = ft_channelrepair(cfg,data)
>
> % Visualise data for and mark uncorrectable artifacts.
> cfg.viewmode = 'vertical';
> cfg.continuous = 'yes';
> cfg.blocksize = 12;
> cfg = ft_databrowser(cfg,artifact_cleandata)
>
> %%
> % Do artifact rejection (also redefine settings lost during re-cfg in artefact rejection)
> cfg.trialdef.prestim = .2;
> cfg.trialdef.poststim = 2;
> cfg.trialdef.eventtype = 'STATUS';
> cfg.artifact.reject = 'complete';
> cfg.channel = 'EEG';
> cfg = ft_rejectartifact(cfg, artifact_cleandata);
> trialdata = ft_preprocessing(cfg, artifact_cleandata);
>
> %%
> cfg = [];
> comp = ft_componentanalysis(cfg, trialdata);
> cfg = [];
> cfg.component = [1:20]
> cfg.layout = 'biosemi128.lay'
> cfg.comment = 'no'
> ft_topoplotIC(cfg,comp)
>
> So, the big question is - why do I get nothing after doing the channel repair. I've been through it several times and that seems to be the step where everything goes wrong. I've looked at the data post re-interpolation and it looks good - for now I'm assuming I've missed something.
>
> Thanks for any help
>
> Steve
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130607/21b376d0/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 07 Jun 2013 11:47:11 +0200
> From: "J?rn M. Horschig" <jm.horschig at donders.ru.nl>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Bad channel correction problems and ICA
> Message-ID: <51B1AC1F.1010008 at donders.ru.nl>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> Hi Steve,
>
> I'm not quite sure what you mean with getting nothing (nothing like,
> empty? or an error?) or not getting real ICA results (real in contrast
> to complex?). My hunge is that you need to take the rank of your data
> into account. Interpolating missing channels is done by combining
> already existing information, i.e. channels, to reconstruct a
> time-course at another spatial location, i.e. another channel. Since you
> do not add any new information by this (it's just a linear combination
> of your existing data matrix), you can leave that step out prior to
> doing ICA. Otherwise, you can set something like ica_cfg.XXXica.pca =
> rank(data.trial{1}), then afaik ft_componentanalysis will perform a PCA
> and essentially identify that the interpolated channels are a linear
> combination of other channels (ICA is then done of the PCA components).
> Both methods are equivalent, so you might as well just drop the
> interpolation and remove bad channels completely.
>
> Best,
> J?rn
>
>
> On 6/7/2013 11:23 AM, Steve Johnston wrote:
>> Dear fters
>>
>> I've just started using ft and, although being able to run through a
>> test run of eye movement data just fine, I'm now getting into the more
>> detailed stuff and I'm hitting a snag that I hope you can help me with.
>>
>> Specifically I'm struggling to get any real ICA results after using
>> ft_channelrepair but not if I go through without it.
>>
>> Data was recorded on a biosemi 128 system and the trials are just eye
>> movements that I want to identify via ICA (simple test).
>>
>> If I just run through the procedure of importing data, set markers,
>> remove gross artifacts (keeping all channels, including 3 bad ones)
>> and then run the ICA - I get lovely eye movement components appearing.
>> However, now I want to do it 'properly' and replace the bad channels.
>> Currently I do the following ... (sorry, for completeness I included
>> everything to be on the safe side).
>>
>> %%
>> % Standard cfg for import
>>
>> cfg = [];
>> cfg.trialdef.prestim = .2;
>> cfg.trialdef.poststim = 2;
>> cfg.trialdef.eventtype = 'STATUS';
>>
>> %%
>> %Load each dataset and examine for channels that are bad - starting
>> with EOG Localiser.
>>
>> cfg.dataset = [subjectdata.dir filesep
>> subjectdata.artifactfile];
>> cfg.trialdef.eventvalue = markers.artifact;
>> cfg = ft_definetrial(cfg);
>>
>> cfg.demean = 'yes';
>> data = ft_preprocessing(cfg);
>>
>> % After the above, run ChannelRepair after identifying bad channels.
>> %%
>> % Channel Replace - get nearest neighbours
>> cfg = [];
>> cfg.method = 'distance'
>> cfg.layout = 'biosemi128.lay';
>> cfg.neighbourdist = 0.13;
>> [neighbours] = ft_prepare_neighbours(cfg,data)
>>
>> %% Interpolate and put into new data structure
>> cfg = [];
>> cfg.badchannel = replace_channels;
>> cfg.layout = 'biosemi128.lay';
>> cfg.method = 'nearest';
>> cfg.neighbours = neighbours;
>> cfg.neighbourdist = 0.13;
>> artifact_cleandata = ft_channelrepair(cfg,data)
>>
>> % Visualise data for and mark uncorrectable artifacts.
>> cfg.viewmode = 'vertical';
>> cfg.continuous = 'yes';
>> cfg.blocksize = 12;
>> cfg = ft_databrowser(cfg,artifact_cleandata)
>>
>> %%
>> % Do artifact rejection (also redefine settings lost during re-cfg in
>> artefact rejection)
>> cfg.trialdef.prestim = .2;
>> cfg.trialdef.poststim = 2;
>> cfg.trialdef.eventtype = 'STATUS';
>> cfg.artifact.reject = 'complete';
>> cfg.channel = 'EEG';
>> cfg = ft_rejectartifact(cfg, artifact_cleandata);
>> trialdata = ft_preprocessing(cfg, artifact_cleandata);
>>
>> %%
>> cfg = [];
>> comp = ft_componentanalysis(cfg, trialdata);
>> cfg = [];
>> cfg.component = [1:20]
>> cfg.layout = 'biosemi128.lay'
>> cfg.comment = 'no'
>> ft_topoplotIC(cfg,comp)
>>
>> So, the big question is - why do I get nothing after doing the channel
>> repair. I've been through it several times and that seems to be the
>> step where everything goes wrong. I've looked at the data post
>> re-interpolation and it looks good - for now I'm assuming I've missed
>> something.
>>
>> Thanks for any help
>>
>> Steve
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> --
> J?rn M. Horschig
> PhD Student
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> Neuronal Oscillations Group
> FieldTrip Development Team
>
> P.O. Box 9101
> NL-6500 HB Nijmegen
> The Netherlands
>
> Contact:
> E-Mail: jm.horschig at donders.ru.nl
> Tel: +31-(0)24-36-68493
> Web: http://www.ru.nl/donders
>
> Visiting address:
> Trigon, room 2.30
> Kapittelweg 29
> NL-6525 EN Nijmegen
> The Netherlands
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130607/8cb527b6/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> End of fieldtrip Digest, Vol 31, Issue 15
> *****************************************
More information about the fieldtrip
mailing list