-
Notifications
You must be signed in to change notification settings - Fork 12
/
sp_setting_defaults.m
220 lines (213 loc) · 6.03 KB
/
sp_setting_defaults.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
function spParams = sp_setting_defaults(varargin)
% Establish basic parameter settings, then update for species
% specific defaults, and user preferences.
% Pulled into subroutine kf 10/4/2016
% get user input and set up file names
n = 1;
while n <= length(varargin)
switch varargin{n}
case 'sp'
sp = varargin{n+1}; n=n+2;
case 'srate'
srate = varargin{n+1}; n=n+2;
case 'analysis'
analysis = varargin{n+1}; n=n+2;
case 'spParamsUser'
spParamsUser = varargin{n+1}; n=n+2;
otherwise
error('Bad optional argument: "%s"', varargin{n});
end
end
% Set parameters according to sp
if (strcmp(sp,'Ko') || strcmp(sp,'k'))
speName = 'Kogia'; specChar = 'K';
tfSelect = 80000;
dtHi = 0.5;
fLow = 70;
threshRL = 116;
iciRange = [40, 130];
dbRange = [100, 150];
frRange = [80, 160];
frdbwRange = [0, 80];
durRange = [30, 111];
durstep = 3;
elseif (strcmp(sp,'Zc') || strcmp(sp,'z') || strcmp(sp,'Cuviers'))
speName = 'Cuviers'; specChar = 'Z';
tfSelect = 40200;
dtHi = 1.0;
fLow = 10;
threshRL = 121;
threshRMS = 55;
ltsaContrast = 150; ltsaBright = 50;
iciRange = [40, 750];
dbRange = [90, 170];
frdbwRange = [0, 80];
durRange = [30, 300];
durstep = 2;
minDur = 60;
dfManual = 100;
elseif (strcmp(sp,'Me') || strcmp(sp,'m'))
speName = 'Gervais'; specChar = 'M';
tfSelect = 40200;
dtHi = 1.0;
fLow = 25;
threshRL = 121;
iciRange = [40, 750];
dbRange = [90, 170];
frdbwRange = [0, 80];
durRange = [30, 300];
durstep = 2;
elseif (strcmp(sp,'BWG') || strcmp(sp,'g'))
speName = 'BWG'; specChar = 'G';
tfSelect = 40200;
dtHi = 1.0;
fLow = 25;
threshRL = 121;
elseif (strcmp(sp,'Md') || strcmp(sp,'d'))
speName = 'BW31'; specChar = 'D';
tfSelect = 40200;
dtHi = 1.0;
fLow = 10;
threshRL = 121;
threshRMS = 55;
ltsaContrast = 150; ltsaBright = 50;
iciRange = [40, 750];
dbRange = [90, 170];
frdbwRange = [0, 80];
durRange = [30, 300];
durstep = 2;
minDur = 60;
dfManual = 100;
elseif strcmpi(sp,'De')
speName = 'Delphin';
dtHi = 0.6;
fLow = 10;
threshRL = 118;
rlLow = threshRL - 6.9; rlHi = 190;
elseif (strcmp(sp,'Po') || strcmp(sp,'p'))
speName = 'Porpoise';
dtHi = 0.5;
fLow = 25;
threshRL = 100;
rlLow = threshRL - 5; rlHi = 190;
ltsaContrast = 250; ltsaBright = 100;
elseif strcmpi(sp,'MFA')
speName = 'MFA';
tfSelect = 4000;
ltsaMax = .5;
threshRL = 80;
dtHi = 2;
fLow = 2;
rlLow = threshRL - 5; rlHi = 180;
dfManual = 10;
elseif strcmpi(sp,'whs')
speName = 'whs';
ltsaMax = .5;
dtHi = 2;
fLow = 5;
rlLow = 0; rlHi = 20;
dfManual = 10;
ltsaContrast = 310; ltsaBright = 100;
ltsaLims = [5,30];
elseif strcmpi(sp,'Dl')
speName = 'Beluga';
tfSelect = 45000;
dtHi = 0.5;
fLow = 20;
threshRL = 110;
rlLow = threshRL - 5; rlHi = 170;
ltsaContrast = 200; ltsaBright = 70;
iciRange = [20, 500];
dbRange = [90, 170];
durRange = [10, 300];
durstep = 2;
elseif (strcmp(sp,'Mm') || strcmp(sp,'Narwhal'))
speName = 'Narwhal';
tfSelect = 48000;
dtHi = 1;
fLow = 2;
threshRL = 100; %threshHiFreq = 25;
%threshRMS = 95; threshPP = 140;
ltsaContrast = 240; ltsaBright = 35;
% dfManual = 100;
minBout = 75; %minDur = 30;
%slope = 1.05;
iciRange = [40, 1000];
durRange = [10, 300];
frRange = [fLow fHi];
rawFileDur = 300; % it is not HARP data
% N = 512;
elseif (strcmp(sp,'PM') || strcmp(sp,'pm') || strcmp(sp,'Pm'))
speName = 'Pm';
dtHi = 2;
fLow = 5;
threshRL = 125; threshHiFreq = 30;
threshRMS = 95; threshPP = 140;
ltsaContrast = 180; ltsaBright = 73;
dfManual = 100;
minBout = 75; minDur = 60;
slope = 1.05;
iciRange = [300, 2000];
frRange = [fLow fHi];
N = 512;
else
warning('Unknown Species Type!!!')
end
%% create struct to return parameters
switch analysis
case {'detEdit','mkLTSA'}
spParams.specchar = specChar;
spParams.speName = speName;
spParams.tfSelect = tfSelect;
spParams.dtHi = dtHi;
spParams.fLow = fLow;
spParams.fHi = fHi;
spParams.threshRL = threshRL;
spParams.threshRMS = threshRMS;
spParams.threshPP = threshPP;
spParams.threshHiFreq = threshHiFreq;
spParams.ltsaContrast = ltsaContrast;
spParams.ltsaBright = ltsaBright;
spParams.ltsaLims = ltsaLims;
spParams.ltsaMax = ltsaMax;
spParams.rlLow = rlLow;
spParams.rlHi = rlHi;
spParams.dfManual = dfManual;
spParams.dfManual = dfManual;
spParams.p1Low = p1Low;
spParams.p1Hi = p1Hi;
spParams.minBout = minBout;
spParams.minDur = minDur;
spParams.slope = slope;
spParams.binDur = binDur;
spParams.rawFileDur = rawFileDur;
% apply default if user has not specified a value
if exist('spParamsUser','var')
for fn = fieldnames(spParamsUser)'
spParams.(fn{1}) = spParamsUser.(fn{1});
end
end
case {'modDet'}
spParams.tfSelect = tfSelect;
spParams.threshRL = threshRL;
spParams.dbRange = dbRange;
spParams.iciRange = iciRange;
spParams.frRange = frRange;
spParams.frdbwRange = frdbwRange;
spParams.durRange = durRange;
spParams.durstep = durstep;
spParams.N = N;
spParams.gth = gth;
spParams.minBout = minBout;
spParams.p1Hi = p1Hi;
case {'SumPPICIBin'}
spParams.iciRange = iciRange;
spParams.speName = speName;
spParams.threshRL = threshRL;
spParams.gth = gth;
spParams.p1Hi = p1Hi;
spParams.binDur = binDur;
otherwise
sprintf(['No analysis specified. Please add one of these options:\n',...
'detEdit, mkLTSA or modDet'])
end