Skip to content
Snippets Groups Projects
Verified Commit db93686e authored by leprob001's avatar leprob001
Browse files

feat: Added "Use empirical shift" checkbox to edit TOA and main window

This commit also fixes the application of the empiricalShift in the
tracking algorithm. It is now applied the same way as the offsets,
namely: TOA + -1 * empiricalShift
parent e57f89bf
No related branches found
No related tags found
No related merge requests found
Showing
with 128 additions and 14 deletions
367 368
function [newValue] = checkboxUseEmpiricalShift(~, ~)
%CHECKBOXUSEEMPIRICALSHIFT Summary of this function goes here
% Detailed explanation goes here
global artoaGui artoaWorkspace;
newValue = logical(artoaGui.editTimeOfArrival.checkboxUseEmpiricalShift.Value);
artoaWorkspace.trackParameter.useEmpiricalShift = newValue;
%% Update gui
% Needs to be done because the checkbox has also been integrated into the TOA window.
artoa.controller.main.updateControls();
%% Recalculate
artoa.controller.edit.recalculateToaGpsAndPlot();
end
...@@ -14,6 +14,7 @@ end ...@@ -14,6 +14,7 @@ end
artoaWorkspace.editTimeOfArrival = struct(); artoaWorkspace.editTimeOfArrival = struct();
artoaGui.callbacks.timeOfArrival = struct(); artoaGui.callbacks.timeOfArrival = struct();
artoaGui.callbacks.timeOfArrival.checkboxUseOffsets = @artoa.controller.edit.timeOfArrival.checkboxUseOffsets; artoaGui.callbacks.timeOfArrival.checkboxUseOffsets = @artoa.controller.edit.timeOfArrival.checkboxUseOffsets;
artoaGui.callbacks.timeOfArrival.checkboxUseEmpiricalShift = @artoa.controller.edit.timeOfArrival.checkboxUseEmpiricalShift;
%% Calculate GPS TOAs %% Calculate GPS TOAs
artoa.controller.edit.timeOfArrival.calculateGpsToas(); artoa.controller.edit.timeOfArrival.calculateGpsToas();
......
...@@ -9,8 +9,10 @@ if strcmp(questdlg('Reset all shifted values?', 'Confirmation', 'Yes', 'Cancel', ...@@ -9,8 +9,10 @@ if strcmp(questdlg('Reset all shifted values?', 'Confirmation', 'Yes', 'Cancel',
return; return;
end end
%% Subtract empirical shift %% Remove empirical shift if applied
artoaWorkspace.toaData.toa = artoaWorkspace.toaData.toa - artoaWorkspace.toaData.empiricalShift; if artoaWorkspace.trackParameter.useEmpiricalShift
artoaWorkspace.toaData.toa = artoaWorkspace.toaData.toa - artoaWorkspace.toaData.empiricalShift;
end
%% Reset empirical shift array %% Reset empirical shift array
artoaWorkspace.toaData.empiricalShift(:) = 0; artoaWorkspace.toaData.empiricalShift(:) = 0;
%% Clear selection %% Clear selection
......
...@@ -22,22 +22,28 @@ end ...@@ -22,22 +22,28 @@ end
answer = str2double(answer{1}); answer = str2double(answer{1});
if isnan(answer) if isnan(answer)
warndlg('The value entered could not be converted to a double.');
return; return;
end end
%% Update track parameter state
artoaWorkspace.trackParameter.useEmpiricalShift = true;
artoa.controller.edit.timeOfArrival.updateControls();
artoa.controller.main.updateControls();
%% Apply shift
% track empirical shift to be able to reset it % track empirical shift to be able to reset it
artoaWorkspace.toaData.empiricalShift(artoaWorkspace.editTimeOfArrival.userSelection) = ... artoaWorkspace.toaData.empiricalShift(artoaWorkspace.editTimeOfArrival.userSelection) = ...
artoaWorkspace.toaData.empiricalShift(artoaWorkspace.editTimeOfArrival.userSelection) ... artoaWorkspace.toaData.empiricalShift(artoaWorkspace.editTimeOfArrival.userSelection) ...
+ answer; + answer;
% add shift to toa
artoaWorkspace.toaData.toa(artoaWorkspace.editTimeOfArrival.userSelection) = ...
artoaWorkspace.toaData.toa(artoaWorkspace.editTimeOfArrival.userSelection) + answer;
[artoaGui.editTimeOfArrival, artoaWorkspace.editTimeOfArrival] = ... [artoaGui.editTimeOfArrival, artoaWorkspace.editTimeOfArrival] = ...
artoa.controller.edit.clearSelection(artoaGui.editTimeOfArrival, artoaWorkspace.editTimeOfArrival); artoa.controller.edit.clearSelection(artoaGui.editTimeOfArrival, artoaWorkspace.editTimeOfArrival);
artoa.controller.edit.updateAvailablePlots(); %% Update plots
artoa.controller.edit.recalculateToaGpsAndPlot();
%artoa.controller.edit.updateAvailablePlots();
end end
...@@ -11,4 +11,11 @@ else ...@@ -11,4 +11,11 @@ else
artoaGui.editTimeOfArrival.checkboxUseOffsets.Value = false; artoaGui.editTimeOfArrival.checkboxUseOffsets.Value = false;
end end
if artoa.data.hasMember(artoaWorkspace, {'trackParameter', 'useEmpiricalShift'})
artoaGui.editTimeOfArrival.checkboxUseEmpiricalShift.Value = ...
artoaWorkspace.trackParameter.useEmpiricalShift;
else
artoaGui.editTimeOfArrival.checkboxUseEmpiricalShift.Value = false;
end
end end
...@@ -11,7 +11,7 @@ end ...@@ -11,7 +11,7 @@ end
%% Recalculate TOAs %% Recalculate TOAs
% prepare toa data for recalculation % prepare toa data for recalculation
toaData = artoa.controller.prepareToaDataForCalculations(); toaData = artoa.controller.getInputToaDataWithEmpiricalShift();
if artoaWorkspace.editOffsets.useOffsets if artoaWorkspace.editOffsets.useOffsets
artoaWorkspace.toaData = artoa.toa.recalculate( ... artoaWorkspace.toaData = artoa.toa.recalculate( ...
......
...@@ -40,6 +40,7 @@ callbacks.convertProfilesToRfb = @artoa.controller.file.profile2rfb.open; ...@@ -40,6 +40,7 @@ callbacks.convertProfilesToRfb = @artoa.controller.file.profile2rfb.open;
%% Prepare callbacks for track parameter %% Prepare callbacks for track parameter
callbacks.checkboxDopplerCorrection = @artoa.controller.track.parameter.checkboxDopplerCorrection; callbacks.checkboxDopplerCorrection = @artoa.controller.track.parameter.checkboxDopplerCorrection;
callbacks.checkboxCalculateVariations = @artoa.controller.track.parameter.checkboxCalculateVariations; callbacks.checkboxCalculateVariations = @artoa.controller.track.parameter.checkboxCalculateVariations;
callbacks.checkboxUseEmpiricalShift = @artoa.controller.track.parameter.checkboxUseEmpiricalShift;
callbacks.comboboxInterpolationMethod = @artoa.controller.track.parameter.comboboxInterpolationMethod; callbacks.comboboxInterpolationMethod = @artoa.controller.track.parameter.comboboxInterpolationMethod;
callbacks.comboboxSoundspeedMethod = @artoa.controller.track.parameter.comboboxSoundspeedMethod; callbacks.comboboxSoundspeedMethod = @artoa.controller.track.parameter.comboboxSoundspeedMethod;
callbacks.inputOutputInterpolationInterval = @artoa.controller.track.parameter.inputOutputInterpolationInterval; callbacks.inputOutputInterpolationInterval = @artoa.controller.track.parameter.inputOutputInterpolationInterval;
......
...@@ -11,4 +11,11 @@ else ...@@ -11,4 +11,11 @@ else
artoaGui.editOffsets.checkboxUseOffsets.Value = false; artoaGui.editOffsets.checkboxUseOffsets.Value = false;
end end
if artoa.data.hasMember(artoaWorkspace, {'trackParameter', 'useEmpiricalShift'})
artoaGui.trackParameter.checkboxUseEmpiricalShift.Value = ...
artoaWorkspace.trackParameter.useEmpiricalShift;
else
artoaGui.trackParameter.checkboxUseEmpiricalShift.Value = false;
end
end end
function [] = checkboxUseEmpiricalShift(~, event)
%CHECKBOXAPPLYEMPIRICALSHIFT Toggles the value that decides wether to use
%empiricalShift in tracking algorithm.
% Detailed explanation goes here
global artoaWorkspace artoaGui;
if nargin == 0
newValue = logical(artoaGui.trackParameter.checkboxUseEmpiricalShift.Value);
else
newValue = logical(event.Source.Value);
end
artoaWorkspace.trackParameter.useEmpiricalShift = newValue;
%% Update gui
% Needs to be done because the checkbox has also been integrated into the TOA window.
artoa.controller.edit.timeOfArrival.updateControls();
%% Recalculate
artoa.controller.edit.recalculateToaGpsAndPlot();
end
...@@ -18,6 +18,8 @@ for i = 1:length(fieldNames) ...@@ -18,6 +18,8 @@ for i = 1:length(fieldNames)
artoaGui.trackParameter.checkboxDopplerCorrection.Value = currentValue; artoaGui.trackParameter.checkboxDopplerCorrection.Value = currentValue;
case 'calculateVariations' case 'calculateVariations'
artoaGui.trackParameter.checkboxCalculateVariations.Value = currentValue; artoaGui.trackParameter.checkboxCalculateVariations.Value = currentValue;
case 'useEmpiricalShift'
artoaGui.trackParameter.checkboxUseEmpiricalShift.Value = currentValue;
case 'trackingMethodValue' case 'trackingMethodValue'
artoaGui.trackParameter.comboboxTrackingMethod.Value = currentValue; artoaGui.trackParameter.comboboxTrackingMethod.Value = currentValue;
case 'interpolationMethodValue' case 'interpolationMethodValue'
......
...@@ -71,7 +71,17 @@ trajectoryObject.temperature(dateIndices) = artoaWorkspace.temperature(indices); ...@@ -71,7 +71,17 @@ trajectoryObject.temperature(dateIndices) = artoaWorkspace.temperature(indices);
}; };
% reset the toa data for recalculation % reset the toa data for recalculation
% in general there is no reason why you create a workspace
% and use the initial state of the data as input to
% the tracking algorithm.
% However in this case, the tracking algorithm contains
% all necessary preparations to the data and applies them.
% This was due to a design that allows to use the tracking
% algorithm in separate from the rest of the program.
% If this should be subject to change, it is required to remove all
% adjustments to the TOA data in the tracking algorithm below.
toaData = artoaWorkspace.toaData; toaData = artoaWorkspace.toaData;
toaData.toa = artoaDataInput.toaData.toa;
[ ... [ ...
trajectory, ... trajectory, ...
......
function [toaData] = prepareToaDataForCalculations() function [toaData] = getInputToaDataWithEmpiricalShift()
%PREPARETOADATAFORCALCULATIONS This function returns a toaData struct that matches the initial state including the empirical shift. %PREPARETOADATAFORCALCULATIONS This function returns a toaData struct that matches the initial state including the empirical shift.
% This function is required to recalculate the TOAs. Because toaData.toa % This function is required to recalculate the TOAs. Because toaData.toa
% is used for storing the TOAs that have been calculated, this struct is % is used for storing the TOAs that have been calculated, this struct is
...@@ -9,6 +9,12 @@ function [toaData] = prepareToaDataForCalculations() ...@@ -9,6 +9,12 @@ function [toaData] = prepareToaDataForCalculations()
global artoaWorkspace artoaDataInput; global artoaWorkspace artoaDataInput;
toaData = artoaWorkspace.toaData; toaData = artoaWorkspace.toaData;
toaData.toa = artoaDataInput.toaData.toa;
toaData.toa = artoaDataInput.toaData.toa - artoaWorkspace.toaData.empiricalShift; %% Add emprical shift if selected
if artoaWorkspace.trackParameter.useEmpiricalShift
toaData.toa = artoaDataInput.toaData.toa + artoaWorkspace.toaData.empiricalShift;
end end
end
...@@ -269,6 +269,16 @@ artoaGui.editTimeOfArrival.checkboxUseOffsets = uicontrol( ... ...@@ -269,6 +269,16 @@ artoaGui.editTimeOfArrival.checkboxUseOffsets = uicontrol( ...
'CallBack', artoaGui.callbacks.timeOfArrival.checkboxUseOffsets ... 'CallBack', artoaGui.callbacks.timeOfArrival.checkboxUseOffsets ...
); );
artoaGui.editTimeOfArrival.checkboxUseEmpiricalShift = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsMisc, ...
'String', 'Apply empirical shift', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .25 .69 .3], ...
'CallBack', artoaGui.callbacks.timeOfArrival.checkboxUseEmpiricalShift ...
);
%% Duplicate applied TOA table %% Duplicate applied TOA table
artoaGui.editTimeOfArrival.frameDuplicateAppliedToa = uipanel( ... artoaGui.editTimeOfArrival.frameDuplicateAppliedToa = uipanel( ...
......
...@@ -31,6 +31,7 @@ availableCallbacks = { ... ...@@ -31,6 +31,7 @@ availableCallbacks = { ...
'switchHideDeletedDataPoints', ... 'switchHideDeletedDataPoints', ...
'checkboxDopplerCorrection', ... % FIRST ITEM TRACK PARAMETER CALLBACKS 'checkboxDopplerCorrection', ... % FIRST ITEM TRACK PARAMETER CALLBACKS
'checkboxCalculateVariations', ... 'checkboxCalculateVariations', ...
'checkboxUseEmpiricalShift', ...
'comboboxInterpolationMethod', ... 'comboboxInterpolationMethod', ...
'comboboxSoundspeedMethod', ... 'comboboxSoundspeedMethod', ...
'inputOutputInterpolationInterval', ... 'inputOutputInterpolationInterval', ...
...@@ -504,6 +505,17 @@ artoaGui.trackParameter.checkboxCalculateVariations = uicontrol( ... ...@@ -504,6 +505,17 @@ artoaGui.trackParameter.checkboxCalculateVariations = uicontrol( ...
'CallBack', pCallbacks.checkboxCalculateVariations ... 'CallBack', pCallbacks.checkboxCalculateVariations ...
); );
artoaGui.trackParameter.checkboxUseEmpiricalShift = uicontrol( ...
'Parent', artoaGui.trackParameter.frameTrackButtons, ...
'String', 'Use empirical shift', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left+.075 .25 .20 2.5*buttonHeight], ...
'Value', 0, ...
'CallBack', pCallbacks.checkboxUseEmpiricalShift ...
);
% Combination buttons frame % Combination buttons frame
artoaGui.trackParameter.frameCombinationButtons = uipanel( ... artoaGui.trackParameter.frameCombinationButtons = uipanel( ...
......
...@@ -62,8 +62,11 @@ if pOffsetsParameter.useOffsets ...@@ -62,8 +62,11 @@ if pOffsetsParameter.useOffsets
pOffsetsParameter.offsets, ... pOffsetsParameter.offsets, ...
soundsourceStruct ... soundsourceStruct ...
); );
pToaData.toa = pToaData.toa - pToaData.empiricalShift; end
%% Use empirical shift if selected
if pTrackingParameter.useEmpiricalShift
pToaData.toa = pToaData.toa + -1 * pToaData.empiricalShift;
end end
%% Prepare data for every sound source %% Prepare data for every sound source
...@@ -411,4 +414,4 @@ for oCombination = 1:size(soundsourceCombinations, 1) ...@@ -411,4 +414,4 @@ for oCombination = 1:size(soundsourceCombinations, 1)
end end
end end
\ No newline at end of file
...@@ -50,7 +50,7 @@ try ...@@ -50,7 +50,7 @@ try
disp(['Starting migration from Version ' itmVersion ' to Version ' versionsFileNames(end).name(2:end - 2)]); disp(['Starting migration from Version ' itmVersion ' to Version ' versionsFileNames(end).name(2:end - 2)]);
%% Modify required variables %% Modify required variables
for o = 1:size(versionsFileNames) for o = 1:length(versionsFileNames)
if (versionsFileNames(o).isdir) if (versionsFileNames(o).isdir)
warning([versionsFileNames(o).name 'is a directory and will be omitted...']); warning([versionsFileNames(o).name 'is a directory and will be omitted...']);
continue; continue;
......
%% Add variable for the usage of empirical shift
if ~artoa.data.hasMember(artoaWorkspace, 'trackParameter', 'useEmpiricalShift')
artoaWorkspace.trackParameter.useEmpiricalShift = any(artoaWorkspace.toaData.empiricalShift ~= 0);
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment