Skip to content

Commit

Permalink
minimal formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanharvey1 committed Nov 26, 2024
1 parent f2a851d commit 7f298c5
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions preProcessing/LFPfromDat.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
function LFPfromDat(basepath, varargin)
%
%
% LFPFROMDAT Extract Local Field Potential (LFP) from wideband .dat file
% [perform lowpass (2 X output Fs) sinc filter on wideband data
% subsample the filtered data and save as a new flat binary
% basename must have basename.dat and basename.xml
Expand Down Expand Up @@ -156,7 +155,6 @@ function LFPfromDat(basepath, varargin)
nbChunks = floor(nBytes/(nbChan * sizeInBytes * chunksize)) - 1;

%% GET LFP FROM DAT

if exist([basepath, '\', basename, '.lfp'], 'file') || exist([basepath, '\', basename, '.eeg'], 'file')
fprintf('LFP file already exists \n')
return
Expand Down Expand Up @@ -204,35 +202,28 @@ function LFPfromDat(basepath, varargin)
end
end


DATA = nan(size(dat, 1), chunksize/sampleRatio);
for ii = 1:size(dat, 1)

d = double(dat(ii, :));
if useGPU
d = gpuArray(d);
tmp = gpuArray(zeros(size(d)));
end

tmp = iosr.dsp.sincFilter(d, ratio);
if useGPU
if ibatch == 1
DATA(ii, :) = gather_try(int16(real(tmp(sampleRatio:sampleRatio:end-ntbuff))));
else
DATA(ii, :) = gather_try(int16(real(tmp(ntbuff+sampleRatio:sampleRatio:end-ntbuff))));
end

else
if ibatch == 1
DATA(ii, :) = int16(real(tmp(sampleRatio:sampleRatio:end-ntbuff)));
else
DATA(ii, :) = int16(real(tmp(ntbuff+sampleRatio:sampleRatio:end-ntbuff)));
end

end

end

fwrite(fidout, DATA(:), 'int16');
end

Expand All @@ -258,7 +249,6 @@ function LFPfromDat(basepath, varargin)
tmp = iosr.dsp.sincFilter(d, ratio);

if useGPU

DATA(ii, :) = gather_try(int16(real(tmp(ntbuff+sampleRatio:sampleRatio:end))));
else
DATA(ii, :) = int16(real(tmp(ntbuff+sampleRatio:sampleRatio:end)));
Expand Down

0 comments on commit 7f298c5

Please sign in to comment.