-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextraAnalyses.m
180 lines (149 loc) · 6.82 KB
/
extraAnalyses.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
function extraAnalyses(subject,nDataSets)
%This function analyzes and plots:
% -endingCoherence (no plot)
% -coherence staircase
% -frame rate
% -number of frames
% subject parameter should be e.g. 'subject1'
% nDataSets parameter should be e.g. 6
% PARAMETERS
plotRange = 1:100;
axisLabelSize = 22;
tickSize = 16;
legendFontSize = 18;
%Create stores for the variables
endingCoherenceStore = nan(1,nDataSets);
unsignedCoherenceStore = nan(numel(plotRange),nDataSets);
frameRateStore = nan(numel(plotRange),nDataSets);
numberOfFramesStore = nan(numel(plotRange),nDataSets);
cd ('/Users/cml2/Desktop/YiMerfeldCSD')
path = pwd;
for i = 1:nDataSets
%The filename for this dataset/ this experiment run
filename = [path,'/data/', subject 'Data' num2str(i) '.xls'];
%filename = 'sivaData6.xls';
%Read in the data from the file
allData = xlsread(filename);
%===Unsigned Coherence===
endingCoherenceStore(i) = allData(455,14);
%===Unsigned Coherence===
%Get all data in the coherence column (unsigned because we will not
%convert those going left to be negative
unsignedCoherence = allData(:,14);
%Only get the trials where there is a valid coherence
unsignedCoherence = unsignedCoherence(~isnan(unsignedCoherence));
%Delete the practice trials
unsignedCoherence(1:10,:) = [];
%Store the unsignedCoherence in the store
unsignedCoherenceStore(:,i) = unsignedCoherence;
%===Frame Rate===
%Get all data in the frame_rate column
frameRate = allData(:,25);
%Only get the trials where there is a valid frame rate
frameRate = frameRate(~isnan(frameRate));
%Delete the practice trials
frameRate(1:10,:) = [];
%Store the frame rate in the store
frameRateStore(:,i) = frameRate;
%===Number of Frames===
%Get all data in the number_of_frames column
numberOfFrames = allData(:,27);
%Only get the trials where there is a valid frame rate
numberOfFrames = numberOfFrames(~isnan(numberOfFrames));
%Delete the practice trials
numberOfFrames(1:10,:) = [];
%Store the frame rate in the store
numberOfFramesStore(:,i) = numberOfFrames;
end %End of for loop to go through data sets
%========================
%====== STATISTICS ======
%========================
% Stats for the ending coherence
endingCoherence_SD = std(unsignedCoherenceStore(100,:));
%========================
%======= PLOTTING =======
%========================
%Set up the legend
dataLegend = cell(nDataSets,1);
for i = 1:nDataSets
dataLegend{i} = [' Run ' num2str(i)];
end
%Plot for unsignedCoherence
figure;
for i = 1:nDataSets
%Plot the data
plot(plotRange, unsignedCoherenceStore(:,i), 'MarkerSize', 12, 'Marker', '.', 'LineWidth', 2);
%title('Staircase Coherence');
%ylabel('Coherence');
%xlabel('Trial number');
xLabel = get(gca, 'Xlabel'); %Get the x label
xLabelFontSize = get(xLabel,'FontSize'); %Store the Xlabel font size
yLabel = get(gca, 'Ylabel'); %Get the y label
yLabelFontSize = get(yLabel,'FontSize'); %Store the Ylabel font size
xTicks = get(gca, 'XAxis'); %Get the Xaxis
yTicks = get(gca, 'YAxis'); %Get the Xaxis
set(xTicks, 'FontSize', tickSize); % Set the Xaxis font size
set(yTicks, 'FontSize', tickSize); % Set the Yaxis font size
set(xLabel, 'FontSize', xLabelFontSize); %Restore the Xlabel font size
set(yLabel, 'FontSize', yLabelFontSize); %Restore the Ylabel font size
xlim([0, 100]);
ylim([0, 1.0]);
hold on;
end
%legendObject = legend(dataLegend);
%legendObject.FontSize = legendFontSize;
%Plot for frameRate
figure;
for i = 1:nDataSets
%Plot the data
plot(plotRange, frameRateStore(:,i), 'MarkerSize', 12, 'Marker', '.', 'LineWidth', 1);
title('Average time per frame');
ylabel({'Average milliseconds per frame',''}, 'FontSize', axisLabelSize);
xlabel({'','Trial number'}, 'FontSize', axisLabelSize);
xLabel = get(gca, 'Xlabel'); %Get the x label
xLabelFontSize = get(xLabel,'FontSize'); %Store the Xlabel font size
yLabel = get(gca, 'Ylabel'); %Get the y label
yLabelFontSize = get(yLabel,'FontSize'); %Store the Ylabel font size
xTicks = get(gca, 'XAxis'); %Get the Xaxis
yTicks = get(gca, 'YAxis'); %Get the Xaxis
set(xTicks, 'FontSize', tickSize); % Set the Xaxis font size
set(yTicks, 'FontSize', tickSize); % Set the Yaxis font size
set(xLabel, 'FontSize', xLabelFontSize); %Restore the Xlabel font size
set(yLabel, 'FontSize', yLabelFontSize); %Restore the Ylabel font size
xlim([0, 100]);
ylim([0, 30]);
hold on;
end
legend(dataLegend);
%legend({'Google Chrome - Ubuntu','Google Chrome - OSX'});
%Add in the line for the ideal frameRate
idealFrameRate = 1000/60;
line([plotRange(1), plotRange(end)], [idealFrameRate, idealFrameRate], 'LineStyle', '--', 'Color', 'k', 'LineWidth', 2);
%Plot for numberOfFrames
figure;
for i = 1:nDataSets
%Plot the data
plot(plotRange, numberOfFramesStore(:,i), 'MarkerSize', 12, 'Marker', '.', 'LineWidth', 1);
title('Number of frames per trial');
ylabel({'Number of frames',''}, 'FontSize', axisLabelSize);
xlabel({'','Trial number'}, 'FontSize', axisLabelSize);
xLabel = get(gca, 'Xlabel'); %Get the x label
xLabelFontSize = get(xLabel,'FontSize'); %Store the Xlabel font size
yLabel = get(gca, 'Ylabel'); %Get the y label
yLabelFontSize = get(yLabel,'FontSize'); %Store the Ylabel font size
xTicks = get(gca, 'XAxis'); %Get the Xaxis
yTicks = get(gca, 'YAxis'); %Get the Xaxis
set(xTicks, 'FontSize', tickSize); % Set the Xaxis font size
set(yTicks, 'FontSize', tickSize); % Set the Yaxis font size
set(xLabel, 'FontSize', xLabelFontSize); %Restore the Xlabel font size
set(yLabel, 'FontSize', yLabelFontSize); %Restore the Ylabel font size
xlim([0, 100]);
ylim([0, 30]);
hold on;
end
legend(dataLegend);
%legend({'Google Chrome - Ubuntu','Google Chrome - OSX'});
%Add in the line for the ideal numberOfFrames
idealNumberOfFrames = 60 * 0.2; %fps * s
line([plotRange(1), plotRange(end)], [idealNumberOfFrames, idealNumberOfFrames], 'LineStyle', '--', 'Color', 'k', 'LineWidth', 2);
end % End of function