<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Grace Mae,
<div class=""><br class="">
</div>
<div class="">I suspect that the datafile.times is in ms, while fieldtrip expets this to be expressed in good old seconds. Consequence: FieldTrip ’thinks’ that your data is sampled a 1Hz, rather than at 1000 Hz.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes and happy computing,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 4 Feb 2022, at 18:26, Elliott, Grace Mae via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Hi all,</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
I'm brand new to fieldtrip, so I apologize for what may be a remedial question. I have resting-state continuous EEG data (71 channels, sampling rate 1000Hz, 7 minutes in length) and I'm trying to write a script to analyze connectivity with WPLI. I'm running
 into two issues right now: </div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
1.) When I try to specify a frequency range with cfg.foi in ft_freqanalysis, I keep receiving an error that the frequencies are above the Nyquist. My sampling rate is 1000Hz, so I'm confused about this error when I'm only entering values up to 60Hz.</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
2.) When I forgo using cfg.foi and run through the script, I keep ending up with a WPLI spectrum matrix of NaN values and an error message that WPLI requires >1 trial. I've tried segmenting my data and trying to keep trials throughout frequency analysis, but
 this does not appear to be working.</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Thank you to all readers - I am open to any suggestions! The script I've been using:</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
%load set from EEGLAB
<div class="">datafile = pop_loadset('data.set')</div>
<div class=""><br class="">
</div>
<div class="">%format set into fieldtrip compatible structure</div>
<div class="">hdr = ft_read_header('data.set')</div>
<div class="">ftdata = []</div>
<div class="">ftdata.time = datafile.times</div>
<div class="">ftdata.trial = ft_read_data('data.set','data',hdr)</div>
<div class="">ftdata.label = hdr.label</div>
<div class="">ftdata.fsample = 1000.0</div>
<div class="">ftdata.dimord = 'chan_time'</div>
<div class=""><br class="">
</div>
<div class="">%segment data</div>
<div class="">cfg0 = []</div>
<div class="">cfg0.length = 105250</div>
<div class="">cfg0.overlap = 0</div>
<div class="">freq1 = ft_redefinetrial(cfg0, ftdata)</div>
<div class=""><br class="">
</div>
<div class="">%check datatyppe</div>
<div class="">data2 = ft_datatype(freq1)</div>
<div class=""><br class="">
</div>
<div class="">cfg2 = []</div>
<div class="">cfg2.covariance = 'yes'</div>
<div class="">cfg2.keeptrials = 'yes'</div>
<div class="">[freq] = ft_timelockanalysis(cfg2, freq1)</div>
<div class=""><br class="">
</div>
<div class="">%frequency analysis</div>
<div class="">cfg8 = []</div>
<div class="">cfg8.method = 'mtmfft'</div>
<div class="">cfg8.taper = 'hanning'</div>
<div class="">cfg8.keeptrials = 'yes'</div>
<div class="">cfg8.output = 'powandcsd'</div>
<div class="">cfg8.foi = 9.0:1.0:20.0</div>
<div class="">freq.label = hdr.label</div>
<div class="">freq.fsample = 1000.0</div>
<div class="">freq10 = ft_freqanalysis(cfg8, freq)</div>
<div class=""><br class="">
</div>
<div class="">%check datatype</div>
<div class="">data5 = ft_datatype(freq10)</div>
<div class=""><br class="">
</div>
<div class="">%calculate wpli</div>
<div class="">cfg4 = []</div>
<div class="">cfg4.method = 'wpli'</div>
[wpli] = ft_connectivityanalysis(cfg4, freq10)<br class="">
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5FQufx8P5eZgH6cDCdDY1qLnNxsOa4rCsJJW3vRqx_jgqK-Ucn40U-xfbPMKL5ZAUmdR45W0Vk7PfVOjgjlkb9l2n9vLebxwg5e4Xw$" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5FQufx8P5eZgH6cDCdDY1qLnNxsOa4rCsJJW3vRqx_jgqK-Ucn40U-xfbPMKL5ZAUmdR45W0Vk7PfVOjgjlkb9l2n9vLebxwg5e4Xw$</a><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>