<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Robin<div class=""><br class=""></div><div class="">In terms of segmenting data after it having been read into memory, the following procedure works:</div><div class=""><br class=""></div><div class="">1) ft_preprocessing, without specifying cfg.trl or trialfun -> this reads the data as a single segment (i.e. one very long trial)</div><div class="">2) ft_definetrial, with cfg.trialfun, which could get events from another file -> this results in cfg.trl</div><div class="">3) ft_redefinetrial which takes the trl from step 2 and the continuous data from step 1.</div><div class=""><br class=""></div><div class="">With regards to the data format: the files are plain EDF and as such supported by FieldTrip out the box. E.g.</div><div class=""><br class=""></div><div class=""><font face="Courier" class="">>> cfg = []</font></div><div class=""><div class=""><font face="Courier" class="">>> cfg.dataset = '000222000.010616.103900.Events.edf'</font></div><div class=""><font face="Courier" class="">>> ft_databrowser(cfg)</font></div></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><div class=""><font face="Courier" class="">>> hdr = ft_read_header(cfg.dataset)</font></div><div class=""><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">hdr = </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">             Fs: 1000</font></div><div class=""><font face="Courier" class="">         nChans: 1</font></div><div class=""><font face="Courier" class="">          label: {'EDF Annotations'}</font></div><div class=""><font face="Courier" class="">       nSamples: 13000</font></div><div class=""><font face="Courier" class="">    nSamplesPre: 0</font></div><div class=""><font face="Courier" class="">        nTrials: 1</font></div><div class=""><font face="Courier" class="">           orig: [1x1 struct]</font></div><div class=""><font face="Courier" class="">       chantype: {'unknown'}</font></div><div class=""><font face="Courier" class="">       chanunit: {'unknown'}</font></div></div></div><div class=""><br class=""></div><div class="">and</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">>> cfg = []</font></div><div class=""><div class=""><font face="Courier" class="">>> cfg.dataset = '000222000.010616.103900.Signals.Raw.edf'</font></div><div class=""><font face="Courier" class="">>> ft_databrowser(cfg)</font></div></div></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><div class=""><div class=""><font face="Courier" class="">>> hdr = ft_read_header(cfg.dataset)</font></div><div class=""><font face="Courier" class="">Warning: channels with different sampling rate not supported, using a subselection of 10 channels at</font></div><div class=""><font face="Courier" class="">256.000000 Hz </font></div><div class=""><font face="Courier" class="">> In read_edf (line 330)</font></div><div class=""><font face="Courier" class="">  In ft_read_header (line 678) </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">hdr = </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">             Fs: 256</font></div><div class=""><font face="Courier" class="">         nChans: 10</font></div><div class=""><font face="Courier" class="">          label: {10x1 cell}</font></div><div class=""><font face="Courier" class="">       nSamples: 1145600</font></div><div class=""><font face="Courier" class="">    nSamplesPre: 0</font></div><div class=""><font face="Courier" class="">        nTrials: 1</font></div><div class=""><font face="Courier" class="">           orig: [1x1 struct]</font></div><div class=""><font face="Courier" class="">       chantype: {10x1 cell}</font></div><div class=""><font face="Courier" class="">       chanunit: {10x1 cell}</font></div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">However, non-standard is to have the events in a separate file. Furthermore, the data file has channels with variable sampling rate, which is also not (by default) supported. See <a href="http://www.fieldtriptoolbox.org/getting_started/edf" class="">http://www.fieldtriptoolbox.org/getting_started/edf</a> and <a href="http://www.fieldtriptoolbox.org/reference/edf2fieldtrip" class="">http://www.fieldtriptoolbox.org/reference/edf2fieldtrip</a>. Looking at the Events channel, I do think that you’ll need a separate trialfun anyway.</div><div class=""><br class=""></div><div class="">From the Signals.Raw I see</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">>> hdr.orig.Label</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">ans =</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">ECG             </font></div><div class=""><font face="Courier" class="">POz             </font></div><div class=""><font face="Courier" class="">Fz              </font></div><div class=""><font face="Courier" class="">Cz              </font></div><div class=""><font face="Courier" class="">C3              </font></div><div class=""><font face="Courier" class="">C4              </font></div><div class=""><font face="Courier" class="">F3              </font></div><div class=""><font face="Courier" class="">F4              </font></div><div class=""><font face="Courier" class="">P3              </font></div><div class=""><font face="Courier" class="">P4              </font></div><div class=""><font face="Courier" class="">ESUTimestamp    </font></div><div class=""><font face="Courier" class="">SystemTimestamp </font></div><div class=""><font face="Courier" class="">Tilt X          </font></div><div class=""><font face="Courier" class="">Tilt Y          </font></div><div class=""><font face="Courier" class="">Tilt Z          </font></div><div class=""><font face="Courier" class="">EDF Annotations </font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">which means that the annotations also seem to be present in the data file itself and the separate Event file might not be needed.</div><div class=""><br class=""></div><div class="">With </div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">>> data = edf2fieldtrip('000222000.010616.103900.Signals.Raw.edf')</font></div><div class=""><font face="Courier" class="">Warning: channels with different sampling rate not supported, using a subselection of 10 channels at</font></div><div class=""><font face="Courier" class="">256.000000 Hz </font></div><div class=""><font face="Courier" class="">> In read_edf (line 330)</font></div><div class=""><font face="Courier" class="">  In ft_read_header (line 678)</font></div><div class=""><font face="Courier" class="">  In edf2fieldtrip (line 36) </font></div><div class=""><font face="Courier" class="">reading 1 channels with 8 Hz sampling rate</font></div><div class=""><font face="Courier" class="">reading 3 channels with 128 Hz sampling rate</font></div><div class=""><font face="Courier" class="">reading 10 channels with 256 Hz sampling rate</font></div><div class=""><font face="Courier" class="">reading 1 channels with 512 Hz sampling rate</font></div><div class=""><font face="Courier" class="">reading 1 channels with 1024 Hz sampling rate</font></div><div class=""><font face="Courier" class="">upsampling 1 channels from 8 to 1024 Hz</font></div><div class=""><font face="Courier" class="">the input is raw data with 1 channels and 1 trials</font></div><div class=""><font face="Courier" class="">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 3 MB</font></div><div class=""><font face="Courier" class="">resampling data</font></div><div class=""><font face="Courier" class="">resampling data in trial 1 from 1</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">original sampling rate = 8 Hz</font></div><div class=""><font face="Courier" class="">new sampling rate = 1024 Hz</font></div><div class=""><font face="Courier" class="">the call to "ft_resampledata" took 1 seconds and required the additional allocation of an estimated 146 MB</font></div><div class=""><font face="Courier" class="">upsampling 3 channels from 128 to 1024 Hz</font></div><div class=""><font face="Courier" class="">the input is raw data with 3 channels and 1 trials</font></div><div class=""><font face="Courier" class="">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 1 MB</font></div><div class=""><font face="Courier" class="">resampling data</font></div><div class=""><font face="Courier" class="">resampling data in trial 1 from 1</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">original sampling rate = 128 Hz</font></div><div class=""><font face="Courier" class="">new sampling rate = 1024 Hz</font></div><div class=""><font face="Courier" class="">the call to "ft_resampledata" took 1 seconds and required the additional allocation of an estimated 165 MB</font></div><div class=""><font face="Courier" class="">upsampling 10 channels from 256 to 1024 Hz</font></div><div class=""><font face="Courier" class="">the input is raw data with 10 channels and 1 trials</font></div><div class=""><font face="Courier" class="">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 1 MB</font></div><div class=""><font face="Courier" class="">resampling data</font></div><div class=""><font face="Courier" class="">resampling data in trial 1 from 1</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">original sampling rate = 256 Hz</font></div><div class=""><font face="Courier" class="">new sampling rate = 1024 Hz</font></div><div class=""><font face="Courier" class="">the call to "ft_resampledata" took 2 seconds and required the additional allocation of an estimated 507 MB</font></div><div class=""><font face="Courier" class="">upsampling 1 channels from 512 to 1024 Hz</font></div><div class=""><font face="Courier" class="">the input is raw data with 1 channels and 1 trials</font></div><div class=""><font face="Courier" class="">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 2 MB</font></div><div class=""><font face="Courier" class="">resampling data</font></div><div class=""><font face="Courier" class="">resampling data in trial 1 from 1</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">original sampling rate = 512 Hz</font></div><div class=""><font face="Courier" class="">new sampling rate = 1024 Hz</font></div><div class=""><font face="Courier" class="">the call to "ft_resampledata" took 0 seconds and required the additional allocation of an estimated 105 MB</font></div><div class=""><font face="Courier" class="">input dataset 1, 1 channels, 1 trials</font></div><div class=""><font face="Courier" class="">input dataset 2, 3 channels, 1 trials</font></div><div class=""><font face="Courier" class="">input dataset 3, 10 channels, 1 trials</font></div><div class=""><font face="Courier" class="">input dataset 4, 1 channels, 1 trials</font></div><div class=""><font face="Courier" class="">input dataset 5, 1 channels, 1 trials</font></div><div class=""><font face="Courier" class="">concatenating the channels within each trial</font></div><div class=""><font face="Courier" class="">the call to "ft_appenddata" took 1 seconds and required the additional allocation of an estimated 560 MB</font></div><div class=""><font face="Courier" class="">adding the comment: reordered the channels to the original order in the EDF file</font></div><div class=""><font face="Courier" class="">the call to "ft_annotate" took 0 seconds and required the additional allocation of an estimated 463 MB</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">data = </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">      label: {16x1 cell}</font></div><div class=""><font face="Courier" class="">      trial: {[16x4582400 double]}</font></div><div class=""><font face="Courier" class="">       time: {[1x4582400 double]}</font></div><div class=""><font face="Courier" class="">    fsample: 1024</font></div><div class=""><font face="Courier" class="">        cfg: [1x1 struct]</font></div></div><div class=""><br class=""></div><div class="">But then</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">>> cfg = [];</font></div><div class=""><font face="Courier" class="">>> cfg.viewmode = 'vertical';</font></div><div class=""><font face="Courier" class="">>> ft_databrowser(cfg, data)</font></div></div><div class=""><br class=""></div><div class="">shows that the EDF Annotations channel (after upsampling) has been slightly messed up (due to filters). Perhaps it can still be of use. Otherwise I also would not directly know how to link the two files to each other, as the sampling rates are very incompatible (1000 in one, and powers of 2 in the other).</div><div class=""><br class=""></div><div class="">Perhaps you can learn something from the EEGLAB code.</div><div class=""><br class=""></div><div class="">Good luck with the data</div><div class="">Robert</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 09 Jun 2016, at 11:03, Robin Kramer <<a href="mailto:kramerrobin92@gmail.com" class="">kramerrobin92@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div dir="ltr" class="">​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1;background-color:rgb(245,245,245)"><a href="https://drive.google.com/file/d/0B4UCcTb4Xh26ZU85WUF4aHJFdms/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0px;border:none" class=""><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png" class=""> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom" class="">000222000.010616.103900.Events.edf</span></a><img src="x-msg://ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="display: none; float: right;" class=""></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1;background-color:rgb(245,245,245)"><a href="https://drive.google.com/file/d/0B4UCcTb4Xh26N3BPQWFKRTIwSGM/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0px;border:none" class=""><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png" class=""> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom" class="">000222000.010616.103900.Signals.Raw.edf</span></a><img src="x-msg://ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="float: right; display: none;" class=""></div>​Hello,<div class=""><br class=""></div><div class="">Recently we started a research with a new wearable EEG system called the B-Alert X-10 from Advanced Brain Monitoring. ABM does deliver their own analyzing software and it is compatible with EEGLab but not with Fieldtrip. Has anyone attempted to analyze the B-Alert data via FieldTrip already? </div><div class=""><br class=""></div><div class="">The way data is stored is rather odd actually. The data is epoched in every second, with 256 samples (Fs = 256) in each epoch for each channel. In other words, there are as much separate trials as there are seconds. After preprocessing, and some manual labour I could rearrange the epochs and make the data continuous, but then I encountered two challenges. </div><div class=""><br class=""></div><div class="">First, the event markers are stored in a different EDF file. Therefore, I have to define my own trial function, but the event-marker data is also stored rather oddly. </div><div class="">Second, it seems that fieldtrip cannot segment any data after preprocessing with ft_definetrials(). Sadly, before preprocessing the B-Alert data is in the strange format. Is there a workaround? I have send a link with the two EDF files, in case one would like to inspect them themselves.</div><div class=""><br class=""></div><div class="">Thank you so much.</div><div class=""><br class=""></div><div class="">Best regards,</div><div class=""><br class=""></div><div class="">Robin Kramer</div><div class="">Student MSc Human-Machine Communication</div><div class="">University of Groningen, the Netherlands</div></div>
_______________________________________________<br class="">fieldtrip mailing list<br class=""><a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</div></blockquote></div><br class=""></div></body></html>