<div dir="ltr">Dear community,<div><br></div><div>I'm Luca La Fisca, PhD student in Belgium and I'm validating the source reconstruction algorithm using "ft_dipolesimulation".</div><div><br></div><div>After having performed a frequency analysis, I noticed the reconstructed sources have twice the initial frequencies as shown in the following figures (initial dipole frequencies = 10 and 85 Hz) :</div><div><br></div><div>Timelock:</div><div><div><img src="cid:ii_kap0i9980" alt="image.png" width="460" height="246"><br></div></div><div><br></div><div>Reconstructed sources:</div><div><div><img src="cid:ii_kap0m1941" alt="image.png" width="460" height="247"><br></div></div><div><br></div><div>Here is the code used to get the timelock signal:</div><div><font color="#999999">fs = 2048;</font></div><div><font color="#999999">fs_down = 512;</font></div><div><font color="#999999"><br></font></div><div><font color="#999999">% generate EEG pseudo-signal<br>cfg      = [];<br>cfg.headmodel = vol;<br>cfg.elec = elec_aligned;<br>cfg.channel = elec_aligned.label(1:64);<br><br>cfg.dip.pos = [<br>   -1 65 36           % dipole left<br>   1 -62 43          % dipole right<br>   ];<br><br>unif_dip = 3^(1/2)/3;<br>cfg.dip.mom = ...       <br>  [ unif_dip unif_dip unif_dip 0 0 0 ]' + ...<br>  [ 0 0 0 unif_dip unif_dip unif_dip ]';<br><br>event = ft_read_event(EEG_FILE);<br>event = event(3:end);<br>signal1 = zeros(length(eeg_data.trial));<br>signal2 = zeros(length(eeg_data.trial));<br>val = [event.value];<br>for s = drange([event(val==10).sample, event(val==11).sample, event(val==12).sample])<br>    time = (0:ceil(fs*0.5))/fs;<br>    signal1(s:s+ceil(fs*0.5)) = 10*sin(10*time*2*pi);<br>    signal2(s:s+ceil(fs*0.5)) = 30*cos(85*time*2*pi);<br>end<br><br>cfg.dip.signal = {[signal1; signal2]};<br>cfg.fsample = fs;<br>raw1 = ft_dipolesimulation(cfg);<br><br>% Timelock analysis<br>% define trials<br>cfg = [];<br>cfg.dataset = EEG_FILE;<br>cfg.trialdef.eventtype  = 'STATUS';<br>cfg.trialdef.eventvalue = [10 11 12];<br>cfg.trialdef.prestim    = 0.5;<br>cfg.trialdef.poststim   = 1; <br>cfg = ft_definetrial(cfg);<br>data_trial = ft_redefinetrial(cfg, raw1);<br><br>% downsample<br>cfg = [];<br>cfg.resamplefs = fs_down;<br>data_trial = ft_resampledata(cfg,data_trial);<br><br>cfg = [];<br>timelock = ft_timelockanalysis(cfg, data_trial);</font><br></div><div><font color="#999999"><br></font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Here the code related to the source reconstruction:</font></div><div><font color="#999999">% Estimating the leadfield<br>cfg = [];<br>cfg.sourcemodel = sourcemodel;    %% where are the sources?<br>cfg.headmodel   = vol;      %% how do currents spread?<br>cfg.elec        = elec_aligned; %% where are the sensors?<br>cfg.channel = elec_aligned.label(1:64);<br>sourcemodel_and_leadfield = ft_prepare_leadfield(cfg, timelock);<br><br>% Source reconstruction<br>cfg                     = [];<br>cfg.method              = 'mne';                    <br>cfg.sourcemodel         = sourcemodel_and_leadfield;        %the precomputed leadfield<br>cfg.headmodel           = vol;                      %the head model<br>cfg.elec                = elec_aligned;             %the electrodes<br>cfg.channel             = elec_aligned.label(1:64); %the useful channels<br>cfg.mne.prewhiten       = 'yes';                    %prewhiten data<br>cfg.mne.lambda          = 0.01;                     %regularisation parameter<br>cfg.mne.scalesourcecov  = 'yes';                %scaling the source covariance matrix<br>minimum_norm_eeg        = ft_sourceanalysis(cfg,timelock);</font><font color="#000000"><br></font></div><div><br></div><div><font color="#000000">Here the code to perform the frequency analysis:</font></div><div><font color="#999999">tmp_pow = minimum_norm_eeg.avg.pow;<br>pow_fft = fft(tmp_pow'); %freq analysis of reconstructed sources<br>% pow_fft = fft(timelock.avg'); %freq analysis of timelock signal<br>% (un)comment depending on the desired one<br><br>L = length(timelock.avg);<br>f = fs_down*(0:(L/2))/L;<br><br>P2 = abs(pow_fft/L);<br>P1 = P2(1:L/2+1,:);<br>P1 = P1.*f';<br><br>figure()<br>plot(f,P1)<br>title('Single-Sided Amplitude Spectrum of Reconstructed Sources')<br>xlabel('f (Hz)')<br>ylabel('|P1(f)|')</font><font color="#000000"><br></font></div><div><br></div><div>Do you have any idea of what is responsible to this double frequency?<br>Do you think it is a general issue?</div><div>Is it a major issue leading to wrong analysis of the reconstructed signal (e.g. connectivity analysis)?</div><div><br></div><div>I thank you in advance.</div><div><br></div><div>Best regards,</div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="text-align:left"><img src="https://docs.google.com/uc?export=download&id=1kIixsLbG6VMY0eKRmD_V2qGfWdocai3Y&revid=0B-dw3epKQGxwWWNSYThqWVJCZjZYOGJtNnljTHg1OGR5WFNJPQ" width="96" height="34"></div><div style="text-align:left"><b>Luca La Fisca</b><br></div><div style="text-align:left"><b><span lang="FR" style="color:gray">PhD Student</span></b></div><div style="text-align:left"><span style="color:rgb(192,0,0)">Service d'Information, Signal et Intelligence Artificielle</span><br></div><div style="text-align:left"><p class="MsoNormal"><span lang="FR" style="color:rgb(166,166,166)">Boulevard Dolez, 31</span><span lang="FR"><u></u><u></u></span></p><p class="MsoNormal"><span lang="FR" style="color:rgb(166,166,166)">7000 Mons</span></p><p class="MsoNormal"><span lang="FR" style="color:rgb(166,166,166)">+32 (0)65/37.40.83</span></p><p class="MsoNormal"><span lang="FR" style="color:rgb(166,166,166)"><u style="color:rgb(34,34,34)"><span lang="FR" style="color:black"><span style="color:blue"><span><a href="mailto:Luca.LAFISCA@umons.ac.be" style="color:rgb(17,85,204)" target="_blank">Luca.LAFISCA@umons.ac.be</a></span></span></span></u><br></span></p><p class="MsoNormal"><span lang="FR" style="color:rgb(166,166,166)"><u style="color:rgb(34,34,34)"><span lang="FR" style="color:black"><span style="color:blue"><br></span></span></u></span></p><p class="MsoNormal"><span lang="FR" style="color:rgb(166,166,166)"><u style="color:rgb(34,34,34)"><span lang="FR" style="color:black"><span style="color:blue"><img src="https://docs.google.com/uc?export=download&id=1Os8PgOWiHRZwQs_oiXqKDg2gkH2mcJDb&revid=0B-dw3epKQGxweUxueTZMZzRNd2pYR1docldnQzJzWExCWGpFPQ" width="200" height="58"><br></span></span></u></span></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br> <table style="border-top:1px solid #d3d4de">
        <tr>
      <td style="width:55px;padding-top:18px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
                <td style="width:470px;padding-top:17px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Garanti sans virus. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank" style="color:#4453ea">www.avast.com</a>           </td>
        </tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>