[FieldTrip] Possibly speeding Up Preprocessing.
johnnguyen.education at gmail.com
Thu Apr 5 23:11:19 CEST 2018
I was running a lot of preprocessing and was finding that it was running
slower than I wanted despite good amount CPU/GPUS on board so I decided to
look more into the code. I think I found a way to improve the speed but I'm
not familiar with Github and pull requests so I just wanted to throw it out
there and get people's opinion.
In read_brainvision_eeg there is a for loop at line 79 using fseek and
fread to reposition the pointer and read the channel-specfic data. Using
tic-toc, I'm finding that it takes some time, around ~.27 secs for the loop
When no channels are found, the same script runs fseek and fread only once
and I feel like this is the better way to go.
if 64-65 is replaced with
" fseek(fid, hdr.NumberOfChannels*samplesize*(begsample-1), *'bof'*);
dat = fread(fid, [hdr.NumberOfChannels, (endsample-begsample+1)],
*dat = dat(chanindx,:)*;"
where underlined are the changes. the code should run whether or not
chanindx is empty.
tic-toc says it takes ~.05 sec and isequal says the two dat to be exactly
the same. This could makes sense because it is not running fseek and fread
constantly which relies on hard drive speeds?
Though the timing seems to negligible, .27 sec per trial vs .05 per trial
comes out to be a lot in large number of trials. [29 minutes vs 4 mins at
216 trls for 30 subs]
Is my assumption correct? why is the for-loop at line 78 running though the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fieldtrip