-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpscr_preparescoringsheets.m
157 lines (147 loc) · 6.72 KB
/
cpscr_preparescoringsheets.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
%% Read metadata
clear
par.datadir='\\callisto\collpen\AustevollExp\data\HERRINGexp';
file = fullfile(par.datadir,'\CollPenAustevollLog.xls');
block = cp_GetExpPar(file);
save
%% Create excel sheets
clear
load
%trtype={'orca','predmodel','tones','music','vessel'};
obtype={'video','didson','ek60vertical','ek60horizontal'};
% I found this error
%34 4 1
%34 4 2
%34 4 3
%34 4 4
%34 4 5
dat_ANOVA ={'b_block' 'b_groupsize' 's_subblock' 's_treatmenttype' 't_treatment'...
't_treatmenttype' 't_start_time_mt' 't_stop_time_mt' 't_F1' 't_F2' 't_SL'...
't_duration' ' t_rt' 'v_obtype' 'v_scorer' 'v_score'};
for b=17:size(block,1)
for s=1:size(block(b).subblock,2)
% Pick only data of the correct type
for t=1:size(block(b).subblock(s).treatment,2)
trt = block(b).subblock(s).treatment(t);
sbl = block(b).subblock(s);
if strcmp(sbl.s_treatmenttype,'tones')
t_treatmenttype = [trt.t_treatmenttype,'_F1',num2str(trt.t_F1),'_F2',num2str(trt.t_F2),...
'_SL',num2str(trt.t_SL),'_dur',num2str(trt.t_duration),'_rt',num2str(trt.t_rt)];
else
t_treatmenttype = trt.t_treatmenttype;
end
% Fix some errors in the data
if strcmp(block(b).b_groupsize,'no')
block(b).b_groupsize = 'large group in M09';
end
if strcmp(t_treatmenttype,'premodel')
t_treatmenttype = 'predmodel';
end
dum={block(b).b_block block(b).b_groupsize sbl.s_subblock ...
sbl.s_treatmenttype trt.t_treatment t_treatmenttype ...
trt.t_start_time_mt trt.t_stop_time_mt trt.t_F1 trt.t_F2 trt.t_SL...
trt.t_duration trt.t_rt'};
% Data sheet for ANOVA
if ~isfield(trt,'score')||isempty(trt.score)
warning(['No data at all for for block:',...
num2str(block(b).b_block),' Subblock:',num2str(sbl.s_subblock),...
' Treatment:',num2str(trt.t_treatment)])
else
for ob = 1:length(trt.score)
% Add all scorers (v-level)
if ~isempty(trt.score(ob).d_score)
scr = trt.score(ob).d_score;
dat_ANOVA = [dat_ANOVA ;[dum trt.score(ob).d_obtype 'AnneBritt' scr.score_AnneBritt]];
dat_ANOVA = [dat_ANOVA ;[dum trt.score(ob).d_obtype 'Felicia' scr.score_Felicia]];
dat_ANOVA = [dat_ANOVA ;[dum trt.score(ob).d_obtype 'Georg' scr.score_Georg]];
dat_ANOVA = [dat_ANOVA ;[dum trt.score(ob).d_obtype 'Lise' scr.score_Lise]];
dat_ANOVA = [dat_ANOVA ;[dum trt.score(ob).d_obtype 'Herdis' scr.score_Herdis]];
dat_ANOVA = [dat_ANOVA ;[dum trt.score(ob).d_obtype 'Kirsti' scr.score_Kirsti]];
else
warning(['Missing data for block:',...
num2str(block(b).b_block),' Subblock:',num2str(sbl.s_subblock),...
' Treatment:',num2str(trt.t_treatment),' Obstype:',obtype{ob}])
end
end
end
end
end
end
nrows=size(dat_ANOVA,1);
str = '%u;%s;%u;%s;%u;%s;%f;%f;%u;%u;%u;%u;%u;%s;%s;%u\n';
str_h = '%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s\n';
fid = fopen('score_anova.csv', 'wt');
fprintf(fid,str_h, dat_ANOVA{1,:});
for row=2:nrows
fprintf(fid,str, dat_ANOVA{row,:});
end
fclose(fid)
%% Create simplified excel sheet
clear
load
%trtype={'orca','predmodel','tones','music','vessel'};
obtype={'video','didson','ek60vertical'};
dat_ANOVA ={'b_block' 'b_groupsize' 's_subblock' 's_treatmenttype' 't_treatment'...
't_treatmenttype' 't_start_time_mt' 't_stop_time_mt' 't_F1' 't_F2' 't_SL'...
't_duration' 't_rt' 'v_score'};
ni=1;
for b=17:size(block,1)
for s=1:size(block(b).subblock,2)
% Pick only data of the correct type
for t=1:size(block(b).subblock(s).treatment,2)
trt = block(b).subblock(s).treatment(t);
sbl = block(b).subblock(s);
if strcmp(sbl.s_treatmenttype,'tones')
t_treatmenttype = [trt.t_treatmenttype,'_F1',num2str(trt.t_F1),'_F2',num2str(trt.t_F2),...
'_SL',num2str(trt.t_SL),'_dur',num2str(trt.t_duration),'_rt',num2str(trt.t_rt)];
else
t_treatmenttype = trt.t_treatmenttype;
end
% Fix some errors in the data
if strcmp(block(b).b_groupsize,'no')
block(b).b_groupsize = 'large group in M09';
end
if strcmp(t_treatmenttype,'premodel')
t_treatmenttype = 'predmodel';
end
dum={block(b).b_block block(b).b_groupsize sbl.s_subblock ...
sbl.s_treatmenttype trt.t_treatment t_treatmenttype ...
trt.t_start_time_mt trt.t_stop_time_mt trt.t_F1 trt.t_F2 trt.t_SL...
trt.t_duration trt.t_rt'};
% Data sheet for ANOVA
if ~isfield(trt,'score')||isempty(trt.score)
warning(['No data at all for for block:',...
num2str(block(b).b_block),' Subblock:',num2str(sbl.s_subblock),...
' Treatment:',num2str(trt.t_treatment)])
else
sc = NaN(length(trt.score),1);
for ob = 1:length(trt.score)
% Add all scorers (v-level)
if ~isempty(trt.score(ob).d_score)
scr = trt.score(ob).d_score;
% Take mean score over scorer
sc(ob) = mean([scr.score_AnneBritt scr.score_Felicia scr.score_Georg scr.score_Lise scr.score_Kirsti]);
else
warning(['Missing data for block:',...
num2str(block(b).b_block),' Subblock:',num2str(sbl.s_subblock),...
' Treatment:',num2str(trt.t_treatment),' Obstype:',obtype{ob}])
end
end
dat_ANOVA = [dat_ANOVA ;[dum num2str(nanmean(sc))]];
ni=ni+1;
% if ni==17
% keyboard
% end
end
end
end
end
nrows=size(dat_ANOVA,1);
str = '%u;%s;%u;%s;%u;%s;%f;%f;%u;%u;%u;%u;%u;%s\n';
str_h = '%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s;%s\n';
fid = fopen('score_anova_simple.csv', 'wt');
fprintf(fid,str_h, dat_ANOVA{1,:});
for row=2:nrows
fprintf(fid,str, dat_ANOVA{row,:});
end
fclose(fid)