1
# This test compares the results of TISEAN extrema function
2
# $ extrema amplitude.dat -o "amplitude_tisean_max.dat"
3
# $ extrema amplitude.dat -z -o "amplitude_tisean_min.dat"
9
dataset = {"amplitude"};
10
ndata = numel (dataset);
12
tisean_max_output = @(x) sprintf("%s_tisean_max.dat",x);
13
tisean_min_output = @(x) sprintf("%s_tisean_min.dat",x);
18
data_tisean_max = load (tisean_max_output (dataset{i}));
19
data_tisean_min = load (tisean_min_output (dataset{i}));
21
data = load ([dataset{i} ".dat"]);
24
# Change to absolute time reference
25
max_rows = rows (data_tisean_max);
27
data_tisean_max(max_rows+1-j,2) = sum (data_tisean_max([1:max_rows+1-j],2));
30
min_rows = rows (data_tisean_min);
32
data_tisean_min(min_rows+1-j,2) = sum (data_tisean_min([1:min_rows+1-j],2));
35
# Calculate with Octave
36
[pks_octave, loc, extra] = findpeaks (data, "DoubleSided", "MinPeakDistance", 2);
40
plot ([1:5000],data,'b', ...
41
loc, pks_octave,'ro', ...
42
data_tisean_max(:,2), data_tisean_max(:,1), 'g.');
43
legend ("Data", "Octave","Tisean");
47
plot ([1:5000],data,'b', ...
48
loc, pks_octave,'ro', ...
49
data_tisean_min(:,2), data_tisean_min(:,1), 'g.');
50
legend ("Data", "Octave","Tisean");
54
# printf ("Difference on %s: %.3g\n", dataset{i}, ...
55
# sqrt (mean ((data_octave-data_tisean(:,2)).^2)));