Skip to content

Commit b45c0ea

Browse files
authored
Merge pull request #10 from NTIA/DevPullRequest9
Publish Dev-PR9
2 parents bd558af + b200255 commit b45c0ea

File tree

80 files changed

+3894
-709
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3894
-709
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
script_front_to_back_test.m
22
script_test_export_NRPars.m
33
*.asv
4+
documentation/images/Thumbs.db

analyze_NRpars.m

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function analyze_NRpars(nr_dataset, base_dir, feature_function, varargin)
253253

254254
% combined
255255
fprintf('\n');
256-
fprintf('average corr = %5.2f rmse = %5.2f\n', mean(corr), mean(rmse));
256+
fprintf('average corr = %5.2f rmse = %5.2f\n', mean(corr,'omitnan'), mean(rmse,'omitnan'));
257257
if length(nr_dataset) ~= 1
258258
do_subplot = false;
259259
analyze_par_dataset(all_datasets, NRpars_all, pcnt, do_print, do_plot, do_subplot, false, all_datasets, NRpars_all, 2, nan, preproc_message);
@@ -347,16 +347,36 @@ function analyze_NRpars(nr_dataset, base_dir, feature_function, varargin)
347347

348348
% skip if less than 2 elements
349349
if sum(double(subset)) < 2
350+
% create plot with "no data" prominently displayed in the center
350351
xlabel(one_NRpars.par_name{pcnt},'interpreter','none');
351352
ylabel('MOS', 'interpreter','none');
352-
title(sprintf('%s (no data)', test_name), 'interpreter','none');
353+
title(test_name, 'interpreter','none');
354+
axis([0 1 1 5])
355+
text(0.5, 3,'no data','HorizontalAlignment','center','color','r')
356+
357+
corr = nan;
358+
rmse = nan;
353359
return;
354360
end
355-
361+
356362
% organize data for linear regression
357363
xdata = ones(sum(subset),2);
358364
xdata(:,2) = one_NRpars.data(pcnt,subset);
359365
ydata = [one_dataset.media(subset).mos]';
366+
367+
% skip if all data is NaN or Inf; need at least 2 elements
368+
if sum(~isnan(xdata(:,2)) & ~isinf(xdata(:,2))) < 2
369+
% create plot with "no data" prominently displayed in the center
370+
xlabel(one_NRpars.par_name{pcnt},'interpreter','none');
371+
ylabel('MOS', 'interpreter','none');
372+
title(test_name, 'interpreter','none');
373+
axis([0 1 1 5])
374+
text(0.5, 3,'no data','HorizontalAlignment','center','color','r')
375+
376+
corr = nan;
377+
rmse = nan;
378+
return;
379+
end
360380

361381
% discard inf, nan
362382
keep = isfinite(xdata(:,2)) & isfinite(ydata);
@@ -406,22 +426,22 @@ function analyze_NRpars(nr_dataset, base_dir, feature_function, varargin)
406426

407427
hold off;
408428

409-
% specify axes. Always include 0 in metric value range. Assume
410-
% [1..5] for MOS range.
429+
% specify axes. Assume [1..5] for MOS range.
411430
xmin = min(min(all_NRpars.data(pcnt,train_set_all)),min(one_NRpars.data(pcnt,subset)));
412431
xmax = max(max(all_NRpars.data(pcnt,train_set_all)),max(one_NRpars.data(pcnt,subset)));
413-
if xmin > 0
414-
xmin = 0;
415-
elseif xmax < 0
416-
xmax = 0;
417-
end
418432

419433
ymin = min(min([all_dataset.media(train_set_all).mos]), min([one_dataset.media(subset).mos]));
420434
ymin = min(ymin, 1);
421435
ymax = max(max([all_dataset.media(train_set_all).mos]), max([one_dataset.media(subset).mos]));
422436
ymax = max(ymax, 5);
423437

424-
axis([xmin xmax ymin ymax]);
438+
if xmin < xmax
439+
axis([xmin xmax ymin ymax]);
440+
else
441+
% parameter is constant / one value
442+
tmp = axis;
443+
axis([tmp(1) tmp(2) ymin ymax]);
444+
end
425445

426446
% labels
427447
if isempty(preproc_message)
@@ -430,7 +450,7 @@ function analyze_NRpars(nr_dataset, base_dir, feature_function, varargin)
430450
xlabel([one_NRpars.par_name{pcnt} preproc_message],'interpreter','none');
431451
end
432452
ylabel('MOS', 'interpreter','none');
433-
title(sprintf('%s, y = %4.2f + %4.2f * x', test_name, w(1), w(2)), 'interpreter','none');
453+
title(test_name, 'interpreter','none');
434454
end
435455

436456
if do_outliers

0 commit comments

Comments
 (0)