JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for SPM Archives


SPM Archives

SPM Archives


SPM@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

SPM Home

SPM Home

SPM  February 2011

SPM February 2011

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Warning in spm_eeg_convert2scalp (griddata) & spm_eeg_crop

From:

Vladimir Litvak <[log in to unmask]>

Reply-To:

Vladimir Litvak <[log in to unmask]>

Date:

Wed, 16 Feb 2011 14:57:13 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (214 lines)

Dear Panagiotis,

Sorry for the late reply. I only now found time to look into it more carefully.

On Tue, Feb 8, 2011 at 2:46 PM, Panagiotis Tsiatsis
<[log in to unmask]> wrote:
>  Hello dear Vladimir and thanks for your response
>
> First of all, apologies in advance for the long e-mail; I hope that it will
> be at least a bit important for other users of SPM, too
>
> It seems that the problem appeared after I used spm_eeg_crop to drop my
> continuous CTF meg data file straight after reading it in and before
> applying filtering / downsampling. Without  spm_eeg_crop  everything works
> fine.
>
> [A small recap :
> As explained in a previous e-mail of mine, the logic behind this is that the
> start and the end of a continuous MEG files might be contaminated by
> artifacts (i.e due to subject's movement at the end of the session if she
> for whatever reason realized that the session is over and started moving
> before you press 'stop recording'  )  or / and zero values because of
> padding added by the CTF software. All this should affect any subsequent
> filtering function if they are not removed (even the padding because of the
> sudden jump from values of order 10^-12 to zero!!!!) so I decided to crop
> the edges of my continuous file before continuing. ]
>
>  I remember that when you send me the spm_eeg_crop  file you told me that it
> has not been tested for continuous data but it should in principle work.
>
> I call it by using the following code :
>
>                 Time_Offset_in_ms = 3000; % in ms
>                S = [];
>                S.D = D;
>                S.timewin = [(Time_of_First_Trial_Onset_in_ms -
> Time_Offset_in_ms) (Time_of_Last_Trial_Onset_in_ms + Time_Offset_in_ms)]
>                S.freqwin = [];
>                S.channels = 'all'
>
>                D = spm_eeg_crop(S);
>                D.save;
>
>
> The problem seems to appear in spm_eeg_crop when applied on a continuous
> file  to and more specifically somewhere in the creation of the new object:
>
> Dnew = coor2D(Dnew, [], coor2D(D, chanind));
>
> as some channels do indeed have the same coordinates :
>
>>> size(coor2D(D, chanind)')
>
> ans =
>
>   337     2
>
>>> size(unique(coor2D(D, chanind)','rows'))
>
> ans =
>
>   335     2
>
>
> The above number shows that spm_eeg_crop indeed puts in the coor2D matrix
> (or tries to put) the coordinates of all available channels. Up to now (and
> correct me if I am wrong) I knew that the coor2D matrix contains the
> coordinates of the MEGGRAD channels only. So I modified the code as follows
> :
>
> MEG_Channels = (D.meegchannels('MEG'));
> Dnew = coor2D(Dnew, [], coor2D(D, MEG_Channels));
>
>
> *And indeed the conversion to images of subsequent files was executed
> without warnings*. So, is this a bug or am I going the wrong direction here?
>


I tried this on my CTF dataset and I don't get identical 2D
coordinates. So this is something that happens for your data and I'm
not sure why. If you send me an example I can look. In general this
code should work as it is because 2D coordinates are defined for all
channels (for non-scalp channels these are just points on a square
grid).


> A couple more issues / clarifications :
>
> 1. The statistics at the end of the analysis (assuming all other equal) were
> slightly different depending on whether I cropped the start and the end of
> the continuous initial files that in many cases had large artifacts or zero
> values. I suppose this is because the subsequent filtering applied on the
> data was "smoother", in the sense that the filters did not have to
> compensate for the artifacts or the jumps because of the zero padding. Does
> this train of thought sound logical to you?


Yes that's a reasonable explanation, although how reasonable it is
depends on how far your trials were from the edges and how low was
your high-pass cutoff. It's not that the filters 'compensate' for
something it's just that due to filtering artefacts from the edges can
contaminate data slightly away from the edges.

>
> 2.The cropped file (where only a few non-trial seconds from the start and
> from the and are missing) contains exactly the same number of events as the
> original continuous file. Why??? It seems that some zombie events are
> retained after cropping!
>
>

That's indeed a bug, due to the fact that I wasn't planning this
function to be used on continuous data. I now fixed it and it'll be in
the next update.

> 3.  Please note that there appears to be one more problem with spm_eeg_crop
> and continuous data :
>
> The line Dnew = badchannels(Dnew, [], badchannels(D, chanind)); always
> results in an error when there are no bad channels, i.e. when
> isempty(D.badchannels) == 1. so i have substituted the above line with
>
> if isempty(D.badchannels) == 0
>     Dnew = badchannels(Dnew, [], badchannels(D, chanind));
> end
>

I can't reproduce this problem either. The code should work also for
no bad channels because badchannels(D, chanind) always returns a
vector of 0/1

Best,

Vladimir


>
> I suspect I should put an 'else' condition somewhere there, but of course
> you are the expert on this  :)
>
> Thanks again and all the best,
> Panagiotis
>
> On 2/7/2011 8:10 PM, Vladimir Litvak wrote:
>>
>> Dear Panagiotis,
>>
>> Try doing:
>>
>> spm_eeg_load
>> D.coor2D(D.meegchannels('MEG'))
>>
>> and look which of the channels have the same 2D coordinates. In
>> principle this should not happen for CTF MEG. You can also look in
>> 'Prepare' tool at the 2D channel layout an modify it if necessary or
>> load a template layout from EEGtemplates.
>>
>> Best,
>>
>> Vladimir
>>
>> On Sun, Feb 6, 2011 at 5:23 PM, Panagiotis Tsiatsis
>> <[log in to unmask]>  wrote:
>>>
>>>  Dear All,
>>>
>>> When I am converting my CTF MEG epoched data to images, I am getting the
>>> following warning:
>>>
>>> Warning: Duplicate x-y data points detected: using average of the z
>>> values.
>>>>
>>>> In griddata at 107
>>>
>>>  In spm_eeg_convert2scalp at 204
>>>
>>> My settings are:
>>>
>>>            S = [];
>>>            S.n = 32;
>>>            S.Fname = Concatenated_File_Name_Time;
>>>            S.interpolate_bad = 1;
>>>            S.modality = 'MEG';
>>>
>>> I also have EOG channels whose chantype has been set to 'EEG' during the
>>> conversion (this of course should not interfere since I ve selected my
>>> modality to be 'MEG').
>>>
>>> By browsing the Mathwoks forum, I suspect that this happens when nearby
>>> values get very similar (as is the case with MEG data).
>>>
>>> Anybody seen that before? Any intuitions?
>>>
>>> Thanks and best,
>>> Panagiotis
>>>
>>>
>>> --
>>> Panagiotis S. Tsiatsis
>>> Max Planck Institute for Biological Cybernetics
>>> Cognitive NeuroImaging Group
>>> Tuebingen, Germany
>>>
>
>
> --
> Panagiotis S. Tsiatsis
> Max Planck Institute for Biological Cybernetics
> Cognitive NeuroImaging Group
> Tuebingen, Germany
>
>

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager