<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">To all:<div><br></div><div>Regarding that last email, I think I found the problem. Line 187 of ft_dipolesimulation calls ft_compute_leadfield, which in my case returned all zeros, so that explains the zeroed data in the output. If I change that line to read:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">lf = ft_compute_leadfield(dippos{trial}, sens, vol,<span style="color: #af4df0">'reducerank'</span>,2);</div><div><br></div><div>to reflect the fact that the input is gradiometer sensors, the simulation is correct. I'm thinking perhaps that code needs to detect the sensor type for input to ft_compute_leadfield.</div><div><br></div><div>Thanks,</div><div><br></div><div>Don</div><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">"Rojas, Don" <<a href="mailto:Don.Rojas@ucdenver.edu">Don.Rojas@ucdenver.edu</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">March 29, 2011 10:32:32 AM MDT<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Email discussion list for the FieldTrip project <<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>problems with ft_dipolesimulation</b><br></span></div><br><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Fieldtrippers,<div><br></div><div>I'm having difficulties trying to construct a simulated dataset using ft_dipolesimulation. I am simulating using a 4D MEG sensor array, read in from an existing dataset (this dataset poses no particular problems when used in other FT routines, but I'm only using the headshape and the gradiometer location/orientation info for the headmodel and simulation anyway). The problem is that I am getting values of zero in all channels at all time points in the simulated set. No errors are generated, but there is a message about the RMS value of simulated data is 0 when ft_dipolesimulation is run - no surprise there. Here is my code:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(49, 152, 51); ">% read 4D file</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(175, 77, 240); "><span style="color: #000000">file = </span>'c,rfhp0.1Hz'<span style="color: #000000">;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">hdr = ft_read_header(file);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">hs = ft_read_headshape(<span style="color: #af4df0">'hs_file'</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; min-height: 14px; "> <br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(49, 152, 51); ">% create a single sphere conductor model from 4D dataset</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg = [];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg.grad = hdr.grad;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg.headshape = hs.pnt;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg.singlesphere = <span style="color: #af4df0">'yes'</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">ft_sphere = ft_prepare_localspheres(cfg);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; min-height: 14px; "> <br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; color: rgb(49, 152, 51); ">% simulate a dipole</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.vol = ft_sphere;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.grad = hdr.grad;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.fsample = hdr.Fs;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.relnoise = .1;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.frequency = 20;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.phase = pi/2; <span style="color: #319833">% 90 degree phase</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.triallength = 1;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.ntrials = 50;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.pos = [0 -.05 .05]; <span style="color: #319833">% position in meters</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">cfg_sim.dip.mom = [0 0 -1]';</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Courier; ">sim = ft_dipolesimulation(cfg_sim);</div><div><br></div><div>Also, I have run the script from the following example:</div><div><br></div><div><a href="http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit">http://fieldtrip.fcdonders.nl/example/compute_forward_simulated_data_and_apply_a_dipole_fit</a></div><div><br></div><div>The simulated data in that example also has no data other than zeros in all channels. So, I don't think this is due to my code per se, which was adapted from that example. My MATLAB version is 2009b (maci64) and I've tried this in several FT versions, including the 20110328 version, all of which produce the same results.</div><div><br></div><div>Any ideas?</div><div><br></div><div>Don</div><div><br></div><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-----------------------<br>Don Rojas, Ph.D.<br>Associate Professor of Psychiatry<br>U. of Colorado Denver Anschutz Medical Campus<br>Director, UCD Magnetoencephalography Lab<br>13001 E. 17th Pl F546<br>Aurora, CO 80045</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">USA<br>303-724-4994</div>
</div>
<br></div></div></blockquote></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br></div></div></div></body></html>