%% Prepare handle and batch_metrics
% Animal selection
basedir = 'Z:\buzsakilab\Buzsakilabspace\LabShare\HainmuellerT\';
% ChRmice = {'SST2','SST4','YutaMouse20','YutaMouse21','YutaMouse37','YutaMouse38',...
%     'YutaMouse39','YutaMouse40','PV1','PV3','PV5','PV16','PV18','PV19','PV21','PV29'}; % PV16 1:1, PV18, PV23, SST6 1:3, SST7, others pure, PV28 thalamic injection
% HRmice = {'PV13','PV22','SST3','SST5'}; % 'PV20',
% linear = {'PV19','PV21','YutaMouse21','YutaMouse29'}; % Linear probe mice
WTmice = {'TH10','TH11','TH12','TH13','TH14','TH15'}; % TH17 once downloaded
% animals = cat(2,ChRmice,HRmice,WTmice);
animals = WTmice;

% Querry for numbers of units meeting different criteria
querryCells(1).tag = 'nDG';
querryCells(1).include = struct('brainRegion','DG');
querryCells(2).tag = 'nCA3';
querryCells(2).include = struct('brainRegion','CA3');
querryCells(3).tag = 'nCA1';
querryCells(3).include = struct('brainRegion','CA1');
querryCells(4).tag = 'nENTm';
querryCells(4).include = struct('brainRegion','ENTm');
%querryFiles = {'DS','.DS2.events.mat'};

handle = makeDShandle('basedir',basedir,'animals',animals,...
    'querryCells',querryCells,'querryFiles',querryFiles);
handle = handle([handle(:).hasMetrics]);

% Write to table to excel in CURRENT folder
t = struct2table(handle);
writetable(t,'Feresteh_overview.xls');

% Load batch
batch_metrics = LoadCellMetricBatch('basepaths',{handle(:).basepath});