-
Notifications
You must be signed in to change notification settings - Fork 0
/
WCOExperimentCutOff.m
58 lines (53 loc) · 2.85 KB
/
WCOExperimentCutOff.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
%% REFERENCE
% [1] Thomas Schreiber and Andreas Schmitz (2009)
% "Surrogate time series Thomas"
function varargout = WCOExperimentCutOff(ts_x1, ts_x2, labels_vec, parameter_space)
%% number of surrogates
% approximation possible (eg., |2/(0.99-1)| = 200), see [1] here larger number to increase discrimination power due to still increasing statistics after 100 surrogates
disp = false; % display options
source = 'J'; % use Matlab for Matlab implementation of the CWT
%% continious wavelet transform
[cwt_1,scales,periods,coi,time] = CWT(ts_x1, ...
'wave_normalization', char(parameter_space.wave_normalization),...
'morse_space', char(parameter_space.morse_space),...
'K', 1, ...
'be', parameter_space.be,...
'ga', parameter_space.ga,...
'disp_cwt', false,...
'wavelet_type', char(parameter_space.wavelet_type),...
'source', source...
);
cwt_2 = CWT(ts_x2,...
'wave_normalization', char(parameter_space.wave_normalization),...
'morse_space', char(parameter_space.morse_space),...
'K', 1, ...
'be', parameter_space.be,...
'ga', parameter_space.ga,...
'disp_cwt', false,...
'wavelet_type', char(parameter_space.wavelet_type),...
'source', source...
);
%% wavelet coherence
inputWCO = WCO(cwt_1,cwt_2,scales,periods,...
'smoothing', char(parameter_space.smoothing),...
'ws_size', parameter_space.ws_size,...
'wt_size', parameter_space.wt_size,...
'disp_coherence', false,...
'coi',cwt_1,...
'time_series',[ts_x1 ts_x2],...
'y_axis', 'scale',...
'coherence', char(parameter_space.coherence)...
);
%% calculate significantly wavelet coherence
[sigWCO, classifier] = SigniWCOCutOff(inputWCO, parameter_space.cut_off, scales, periods,...
'coi',coi,...
'time_series',[ts_x1 ts_x2],...
'disp_coherence', disp,...
'y_axis', 'period',...
'connectivity_vector', labels_vec...
);
Taskperformance = PM(labels_vec,classifier, 'soi', [2.02 12.8], 'space', periods);
Taskperformance.surrogate = string('Cut-Off'); % required because available in WCOExperiment
Objective = 1-Taskperformance.f_score;
varargout = {Objective, struct2table(Taskperformance)}
end