-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckGoodTrials.m
61 lines (58 loc) · 2.67 KB
/
checkGoodTrials.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
function [freqVals,psdST,psdBL,baseCorrectedLog10PSD, theta, RHO] = checkGoodTrials(subjectName, expType, stimType)
saveFolder = '/home/me/GammaHarmonicData/savedData';
if isfile(fullfile(saveFolder,[subjectName expType stimType '.mat']))
load(fullfile(saveFolder,[subjectName expType stimType '.mat']));
disp('Variables loaded from Memory')
else
clearvars -except subjectName expType stimType saveFolder
[highRMSElectrodes, goodPos, Fs, stPos, blPos, mt, folderLFP, timeVals, stimPeriod, baselinePeriod, folderSourceString] = getSubjectDetails(subjectName, expType, stimType); %#ok<ASGLU>
[freqVals,psdST,psdBL,baseCorrectedLog10PSD, theta, RHO, stLFP, gammaSig, harmonicSig, gammaFreq, harmonicFreq, gammaAmp, harmonicAmp] = getPSDandPhase(highRMSElectrodes,folderLFP,goodPos,stPos,blPos,mt,Fs); %#ok<ASGLU>
save(fullfile(saveFolder,[subjectName expType stimType '.mat']));
disp('Variables Saved')
end
end
%
% I = divisors(length(goodPos));
% if length(I) <= 2
% I = divisors(length(goodPos)+1);
% end
% if mod(length(I),2)
% ROW = median(I);
% COL = ROW;
% else
% ROW = I(length(I)/2);
% COL = I(length(I)/2+1);
% end
% for i = 4
% % % f1 = figure('Name',['Electrode ' num2str(highRMSElectrodes(i))],'units','normalized','Position', [-1 0 1 1]);
% f2 = figure('Name',['Electrode ' num2str(highRMSElectrodes(i))],'units','normalized','Position', [1 0 1 1]);
%
% p = 1;
% for j = 1:length(goodPos)
% %
% % figure(f1)
% % subplot(ROW,COL,p)
% % hold on
% % plot(freqVals, baseCorrectedLog10PSD(:,j,i),'b','LineWidth',2);
% % plot(freqVals, log10(psdST(:,j,i)),'r','LineWidth',1);
% % plot(freqVals, log10(psdBL(:,j,i)),'k','LineWidth',1);
% % xlim([0 150]);
% % title(['Trial ' num2str(goodPos(j))]);
% % hold off
%
% [Mean, Std,~,~,~,Mode] = getPhaseProperties(RHO(:,j,i));
% Mean = Mean*180; Std = Std*180; Mode = Mode*180;
%
% figure(f2)
% subplot(ROW,COL,p)
% if (Mean >= 150 && Mean <= 210 && Std <=65 && Mode >= 150 && Mode <= 210)
% polarplot(theta',RHO(:,j,i),'r')
% else
% polarplot(theta',RHO(:,j,i))
% end
%
% title(['T-' num2str(goodPos(j)) ' M-' num2str(round(Mean)) ' S-' num2str(round(Std)) ' Md-' num2str(round(Mode))]);
% p = p+1;
% end
% saveas(f2,[subjectName expType stimType 'PhaseDiff' '.tiff'])
% end