Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions preProcessing/acqID.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
if contains(checkPath, ignoreFolders(f))
usePath = false;
end
if contains(checkPath, ".memory_usage")
usePath = false; %check for new memory usage dat file and ignore automatically
end
end
if usePath
datpaths{i} = checkPath;
Expand All @@ -82,11 +85,19 @@
expNum(i) = '1';
recNum(i) = '1';
else
recordingnames{i} = relParts{1};
expIdx = find(startsWith(relParts, 'experiment'), 1);
recIdx = find(startsWith(relParts, 'recording'), 1);
expNum(i) = ternary(~isempty(expIdx), extractAfter(relParts{expIdx}, 'experiment'), '1');
recNum(i) = ternary(~isempty(recIdx), extractAfter(relParts{recIdx}, 'recording'), '1');
recordingnames{i} = parts{1};
expIdx = find(startsWith(relPath, 'experiment'), 1);
recIdx = find(startsWith(relPath, 'recording'), 1);
if ~isempty(expIdx)
expNum(i) = extractAfter(relParts(expIdx), 'experiment');
else
expNum(i) = '1';
end
if ~isempty(expIdx)
recNum(i) = extractAfter(relParts(recIdx), 'recording');
else
recNum(i) = '1';
end
end
else
fprintf('.dat file found nested in a folder labeled %s . Skipping: \n', ignoreFolders(f));
Expand Down
2 changes: 1 addition & 1 deletion preProcessing/concatenateDats.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function concatenateDats(varargin)
end
for ii = 1:length(toFill)
if toFill(ii) == 1
fillMissingDats('basepath', basepath, 'fileType', otherdattypes{ii});
fillMissingDats('basepath', basepath, 'fileType', otherdattypes{ii},'ignoreFolders',ignoreFolders);
end
end
else
Expand Down
22 changes: 21 additions & 1 deletion preProcessing/fillMissingDats.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ function fillMissingDats(varargin)
isFileType = @(x) sum(strcmp(x, otherdattypes)) == 1;
addParameter(p, 'basepath', pwd, @isfolder)
addParameter(p, 'fileType', [], isFileType)
addParameter(p, 'ignoreFolders', "", @isstring);

parse(p, varargin{:})
basepath = p.Results.basepath;
fileType = p.Results.fileType;
ignoreFolders = p.Results.ignoreFolders;

if ignoreFolders == ""
ignoreFolders = [];
end

% get file types and data types
files_table = table();
Expand All @@ -53,6 +59,20 @@ function fillMissingDats(varargin)
contFiles = dir([basepath, filesep, '**', filesep, 'continuous.dat']); %check for openEphys
ampFiles = cat(1, ampFiles, contFiles);
typeFolders = {typeFiles.folder};

useAmpFiles = [];
for a = 1:length(ampFiles)
skip = 0;
for f = 1:length(ignoreFolders)
if (contains(ampFiles(a).folder, ignoreFolders(f)) || contains(ampFiles(a).folder, ".memory_usage"))
skip = 1;
end
end
if skip~=1
useAmpFiles = cat(1, useAmpFiles, ampFiles(a));
end
end
ampFiles = useAmpFiles;
ampFolders = {ampFiles.folder};

fillInds = find(~ismember(ampFolders, typeFolders)); %index of folders that need fill
Expand All @@ -68,7 +88,7 @@ function fillMissingDats(varargin)
for ii = 1:length(fillInds)
fillIdx = fillInds(ii);
localAmpSize = ampFiles(fillIdx).bytes;
nPoints = localAmpSize / (ampNch * 2);
nPoints = double(localAmpSize / (ampNch * 2));

zeroData = zeros(typeNch, nPoints);

Expand Down
Loading