From af16f2fe1e09239c8551cc8634966dc9a58adef6 Mon Sep 17 00:00:00 2001 From: Lewin Probst <info@emirror.de> Date: Sun, 24 Nov 2019 19:08:45 +0100 Subject: [PATCH] Bugfix, Reference position was not plotted correctly. --- .../+parameter/validateCombinationsInput.m | 5 ----- lib/+artoa/+float/calculateTrajectory.m | 17 +-------------- .../+trajectory/plotTimeDivergenceToGps.m | 4 +++- .../plotTrajectoryReferencePositions.m | 21 ++++++++++++------- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/lib/+artoa/+controller/+track/+parameter/validateCombinationsInput.m b/lib/+artoa/+controller/+track/+parameter/validateCombinationsInput.m index e060a84..a2106ca 100644 --- a/lib/+artoa/+controller/+track/+parameter/validateCombinationsInput.m +++ b/lib/+artoa/+controller/+track/+parameter/validateCombinationsInput.m @@ -21,11 +21,6 @@ if any(strcmp(pCombinationsTable.soundsources, '')) return; end -if any(strcmp(pCombinationsTable.referencePosition, '')) - message = 'The "Reference Position" column contains an invalid value!'; - return; -end - if any(isnan(pCombinationsTable.soundspeed1)) ... || any(isnan(pCombinationsTable.soundspeed2)) ... || any(isnan(pCombinationsTable.soundspeed3)) ... diff --git a/lib/+artoa/+float/calculateTrajectory.m b/lib/+artoa/+float/calculateTrajectory.m index 512fdaf..6ceb01b 100644 --- a/lib/+artoa/+float/calculateTrajectory.m +++ b/lib/+artoa/+float/calculateTrajectory.m @@ -37,13 +37,6 @@ uniqueToaDates = unique(pToaData.toaDate); [involvedSoundsources, involvedSoundsourceNames] = ... artoa.controller.track.getInvolvedSoundsources(); -%% Add float drift to TOA -pToaData = artoa.data.addFloatDrift( ... - pToaData, ... - pTrackingParameter.soundsourceOffsets{'Float', 'Begin'}, ... - pTrackingParameter.soundsourceOffsets{'Float', 'End'} ... -); - %% Initialize return variables trajectory = false; trajectoryDates = false; @@ -110,12 +103,7 @@ for i = 1:length(involvedSoundsources) kx = find(abs(currentToaDate - dates(oDates)) < 1/2); currentToa(kx) = currentToa(kx) - offsets(oDates); end - - % subtract offset (corrective value) of sound source - soundsourceOffsetCorrectiveValue = ... - pTrackingParameter.soundsourceOffsets{currentSoundsource.sourcename, 'Begin'}; - currentToa = currentToa - soundsourceOffsetCorrectiveValue; - + % interpolate toa data [ ... preparedData.(currentSoundsource.sourcename).toaDate, ... @@ -128,7 +116,6 @@ for i = 1:length(involvedSoundsources) pTrackingParameter.gapSize, ... lower(pTrackingParameter.interpolationMethodString) ... ); - %preparedData.(currentSoundsource.sourcename).toaIndex = preparedData.(currentSoundsource.sourcename).toaIndex'; % combine interpolated and original data and sort them preparedData.(currentSoundsource.sourcename).toaDate = ... @@ -196,8 +183,6 @@ end %% Get static data floatReferenceTime = pFloatDetails.phasereftime; -%startPosition = [pSatData.lat_sat(1) pSatData.lon_sat(1)]; -%trackingMethod = lower(pTrackingParameter.trackingMethodString); trajectory = []; trajectoryDates = []; diff --git a/lib/+artoa/+trajectory/plotTimeDivergenceToGps.m b/lib/+artoa/+trajectory/plotTimeDivergenceToGps.m index 16ed8ef..255f03a 100644 --- a/lib/+artoa/+trajectory/plotTimeDivergenceToGps.m +++ b/lib/+artoa/+trajectory/plotTimeDivergenceToGps.m @@ -14,6 +14,7 @@ cla(pAxesHandle); %% Plot data hold(pAxesHandle, 'on'); +counter = 1; for i = 1:length(fnames) current = pTrajectory.timeDivergenceToGps.(fnames{i}); if isempty(current) @@ -22,7 +23,8 @@ for i = 1:length(fnames) x = current(:, 1); y = current(:, 2); handleTimeDivergenceToGps.(fnames{i}) = plot(pAxesHandle, x, y, '.-'); - legendText{i} = fnames{i}; + legendText{counter} = fnames{i}; + counter = counter + 1; end hold(pAxesHandle, 'off'); diff --git a/lib/+artoa/+trajectory/plotTrajectoryReferencePositions.m b/lib/+artoa/+trajectory/plotTrajectoryReferencePositions.m index 6d76b0b..5324c64 100644 --- a/lib/+artoa/+trajectory/plotTrajectoryReferencePositions.m +++ b/lib/+artoa/+trajectory/plotTrajectoryReferencePositions.m @@ -2,14 +2,19 @@ function [scatterHandles, textHandles] = plotTrajectoryReferencePositions(pAxesH %PLOTTRAJECTORYREFERENCEPOSITIONS Summary of this function goes here % Detailed explanation goes here -%% Prepare variables -referencePositions = pTrajectory.trackParameter.soundsourceCombinations.referencePosition; -referencePositions = cellfun(@strsplit, referencePositions, 'UniformOutput', false); -referencePositions = cellfun(@str2double, referencePositions, 'UniformOutput', false); -referencePositions = cell2mat(referencePositions); - -x = referencePositions(:, 2); -y = referencePositions(:, 1); +x = []; +y = []; + +for i = 1:length(pTrajectory.trackParameter.soundsourceCombinations.referencePosition) + current = pTrajectory.trackParameter.soundsourceCombinations.referencePosition{i}; + if strcmp('', strtrim(current)) + continue; + end + tmp = str2double(strsplit(current)); + x = [x; tmp(2)]; + y = [y; tmp(1)]; +end + %% Plot -- GitLab