-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfixUniqueIndexSeries_Awake.m
93 lines (78 loc) · 2.95 KB
/
fixUniqueIndexSeries_Awake.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%% correcting unique series and index series data in awake animal s
clc
clear
close all
if isunix && ~ismac
genDir = '/synology/adeeti/ecog/iso_awake_VEPs/';
picsDir = '/synology/adeeti/ecog/images/Iso_Awake_VEPs/';
dropboxLocation = '/home/adeeti/Dropbox/ProektLab_code/Adeeti_code/'; %'C:\Users\adeeti\Dropbox\KelzLab\';
elseif ispc
genDir = 'Z:\adeeti\ecog\iso_awake_VEPs\';
picsDir = 'Z:\adeeti\ecog\images\Iso_Awake_VEPs\';
dropboxLocation = 'C:\Users\adeeti\Dropbox\ProektLab_code\Adeeti_code\';
end
allMice = [{'goodMice'}; {'maybeMice'}];
cd(genDir)
ident1 = '2019*';
ident2 = '2020*';
stimIndex = [0, Inf];
%%
for g = 1:length(allMice)
genDirM = [genDir, (allMice{g}), '/'];
picsDirM = [picsDir, (allMice{g}), '/'];
cd(genDirM)
allDir = [dir('GL*'); dir('*IP2');dir('*CB3')];
if g ==1
allDir = [dir('*CB3')];
startD = 1;
else
allDir = [dir('GL*'); dir('*IP2');dir('*CB3')];
startD = 1;
end
for d = startD:length(allDir)
cd([genDirM, allDir(d).name])
mouseID = allDir(d).name;
disp(mouseID)
genPicsDir = [picsDirM, mouseID, '/'];
dirIn = [genDirM, mouseID, '/'];
dirWAVE = [dirIn, 'Wavelets/'];
dirFILT = [dirIn, 'FiltData/'];
dirIPSC = [dirIn, 'IPSC/'];
dirWCOH = [dirIn, 'wCoh/'];
allData = dir(ident1);
identifier = ident1;
if isempty(allData)
allData = dir(ident2);
identifier = ident2;
end
for a = 1:length(allData)
load(allData(a).name, 'indexSeries', 'uniqueSeries')
if length(indexSeries)>100
indexSeries(1) =2;
uniqueSeries(2,:) = [Inf, Inf];
disp('Saving timeseries')
save([dirIn, allData(a).name], 'indexSeries', 'uniqueSeries', '-append')
try
disp('Saving wavelets')
save([dirWAVE, allData(a).name(1:end-4), 'wave.mat'], 'indexSeries', 'uniqueSeries', '-append')
catch ME
continue
end
disp('Saving filtered data')
save([dirFILT, allData(a).name(1:end-4), 'wave.mat'], 'indexSeries', 'uniqueSeries', '-append')
try
if exist('dirIPSC')
disp('Saving IPSC')
save([dirIPSC, allData(a).name(1:end-4), 'wave.mat'], 'indexSeries', 'uniqueSeries', '-append')
end
catch ME
continue
end
% if exist('dirWCOH')
% disp('Saving coherence')
% save([dirWCOH, allData(a).name(1:end-4), 'wave.mat'], 'indexSeries', 'uniqueSeries', '-append')
% end
end
end
end
end