Skip to content
Snippets Groups Projects
Commit 23e3eacc authored by leprob001's avatar leprob001
Browse files

Removed offsets from parameter window and inserted them in a new window. Refactoring.

parent 049d9b15
No related branches found
No related tags found
No related merge requests found
Showing
with 143 additions and 33 deletions
function [ ] = close(pSource, ~)
%CLOSE Cleans up all variables that are used by the editOffsetDetails GUI.
% Changes to the data is not being modified.
global artoaGui;
%% Setup variables
figureName = 'editOffsets';
%% Close the figure
if nargin > 1 && isvalid(pSource)
delete(pSource);
elseif isfield(artoaGui.figures, figureName) && isvalid(artoaGui.figures.(figureName))
delete(artoaGui.figures.(figureName));
end
%% Clean up variables
if artoa.data.hasMember(artoaGui, {figureName})
artoaGui = rmfield(artoaGui, figureName);
end
if artoa.data.hasMember(artoaGui, {'figures', figureName})
artoaGui.figures = rmfield(artoaGui.figures, figureName);
end
end
\ No newline at end of file
function [] = open()
%OPEN Initializes the offset details gui.
% Detailed explanation goes here
global artoaGui artoaWorkspace;
%% Check if the gui is already opened
if isfield(artoaGui.figures, 'editOffsets')
figure(artoaGui.figures.editOffsets);
return
end
%% Setup callbacks
callbacks = struct();
callbacks.tableSoundsourceOffsetsEdit = @artoa.controller.edit.offsets.tableSoundsourceOffsetsEdit;
%% Open the gui
artoa.gui.edit.offsets(callbacks);
if artoa.data.hasMember(artoaWorkspace, {'editOffsets'})
artoa.controller.edit.offsets.updateGui();
return;
end
%% Create workspace variables
artoaWorkspace.editOffsets = struct();
artoa.controller.edit.offsets.updateWorkspaceOffsetsTable();
%% Update gui
artoa.controller.edit.offsets.updateGui();
end
......@@ -6,7 +6,7 @@ function [] = tableSoundsourceOffsetsEdit(~, ~)
global artoaGui artoaWorkspace artoaDataInput;
%% Save to workspace
artoaWorkspace.trackParameter.soundsourceOffsets(:, :) = artoaGui.trackParameter.tableSoundSourceOffsets.Data;
artoaWorkspace.editOffsets.soundsourceOffsets(:, :) = artoaGui.editOffsets.tableSoundsourceOffsets.Data;
%% Update TOA
......@@ -14,10 +14,10 @@ artoaWorkspace.trackParameter.soundsourceOffsets(:, :) = artoaGui.trackParameter
toaData = artoaWorkspace.toaData;
toaData.toa = artoaDataInput.toaData.toa;
artoaWorkspace.toaData = artoa.soundsources.recalculateToaData( ...
artoaWorkspace.toaData = artoa.toa.recalculate( ...
toaData, ...
artoa.controller.getSoundsourcesWithAppliedToa(), ...
artoaWorkspace.trackParameter.soundsourceOffsets ...
artoaWorkspace.editOffsets.soundsourceOffsets ...
);
artoa.controller.edit.timeOfArrival.plot();
......
function [] = updateGui()
%UPDATEGUI Summary of this function goes here
% Detailed explanation goes here
global artoaGui artoaWorkspace;
if ~isfield(artoaWorkspace, 'editOffsets') ...
|| ~isfield(artoaGui.figures, 'editOffsets') ...
|| ~isvalid(artoaGui.figures.editOffsets)
return;
end
fields = artoaWorkspace.editOffsets;
fieldNames = fieldnames(fields);
for i = 1:length(fieldNames)
currentValue = fields.(fieldNames{i});
switch fieldNames{i}
case 'soundsourceOffsets'
artoaGui.editOffsets.tableSoundsourceOffsets.Data = table2cell( ...
currentValue ...
);
artoaGui.editOffsets.tableSoundsourceOffsets.RowName = currentValue.Properties.RowNames;
artoaGui.editOffsets.tableSoundsourceOffsets.ColumnName = currentValue.Properties.VariableNames;
end
end
end
......@@ -5,7 +5,7 @@ function [] = updateWorkspaceOffsetsTable()
global artoaWorkspace;
%% Check if track parameter already exist
if ~artoa.data.hasMember(artoaWorkspace, {'trackParameter'})
if ~artoa.data.hasMember(artoaWorkspace, {'editOffsets'})
return;
end
......@@ -13,13 +13,13 @@ end
soundsources = artoa.controller.getSoundsourcesWithAppliedToa();
%% Initialize if not available
if ~artoa.data.hasMember(artoaWorkspace, {'trackParameter', 'soundsourceOffsets'})
if ~artoa.data.hasMember(artoaWorkspace, {'editOffsets', 'soundsourceOffsets'})
% initialize sound source offsets
artoaWorkspace.trackParameter.soundsourceOffsets = ...
artoa.offsets.generateOffsetTable(soundsources);
artoaWorkspace.editOffsets.soundsourceOffsets = ...
artoa.offsets.generateOffsetTable(artoaWorkspace.float, soundsources);
end
workspaceOffsets = artoaWorkspace.trackParameter.soundsourceOffsets;
workspaceOffsets = artoaWorkspace.editOffsets.soundsourceOffsets;
%% Add every soundsource
fnames = fieldnames(soundsources);
......@@ -42,4 +42,4 @@ for i = 1:length(rowNames)
);
end
artoaWorkspace.trackParameter.soundsourceOffsets = workspaceOffsets;
\ No newline at end of file
artoaWorkspace.editOffsets.soundsourceOffsets = workspaceOffsets;
\ No newline at end of file
......@@ -54,9 +54,11 @@ artoa.controller.edit.updateAvailablePlots();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
artoa.controller.edit.offsetDetails.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
artoa.controller.edit.offsetDetails.updateGui();
end
......@@ -50,9 +50,11 @@ artoa.controller.edit.updateAvailablePlots();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
artoa.controller.edit.offsetDetails.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
artoa.controller.edit.offsetDetails.updateGui();
end
......
......@@ -31,10 +31,8 @@ artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
artoa.controller.edit.updateAvailablePlots();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
%% Clear selection
[artoaGui.editTimeOfArrival, artoaWorkspace.editTimeOfArrival] = ...
......
......@@ -74,7 +74,7 @@ for o = 1:length(fnames)
artoaDataInput.soundsources.(fnames{o}).endemis(2), ...
artoaDataInput.soundsources.(fnames{o}).endemis(1));
[gpsDates, predictedToas] = artoa.data.predictToaFromGps( ...
[gpsDates, predictedToas] = artoa.toa.predictFromGps( ...
artoaDataInput.rfb, pSoundsources.(fnames{o}), ...
struct( ...
'temperature', artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ...
......
......@@ -41,9 +41,11 @@ artoa.controller.edit.updateAvailablePlots();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
artoa.controller.edit.offsetDetails.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
artoa.controller.edit.offsetDetails.updateGui();
end
......@@ -49,9 +49,11 @@ artoa.controller.edit.updateAvailablePlots();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
artoa.controller.edit.offsetDetails.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
artoa.controller.edit.offsetDetails.updateGui();
end
......@@ -12,18 +12,6 @@ variableNames = { ...
'soundspeed2', ...
'soundspeed3' ...
};
%
% variableTypes = { ...
% 'double', ...
% 'double', ...
% 'string', ...
% 'string', ...
% 'double', ...
% 'double', ...
% 'double', ...
% 'double', ...
% 'double' ...
% };
%% Create struct for workspace
soundsourceCombinationsTable = cell2table( ...
......@@ -33,26 +21,5 @@ soundsourceCombinationsTable = cell2table( ...
);
% soundsourceCombinationsStruct = struct();
% for i = 1:size(pSoundsourceCombinationsCell, 1)
% if ~isnumeric(pSoundsourceCombinationsCell{i, 1})
% soundsourceCombinationsStruct(i).begin = str2double(pSoundsourceCombinationsCell{i, 1});
% else
% soundsourceCombinationsStruct(i).begin = pSoundsourceCombinationsCell{i, 1};
% end
% soundsourceCombinationsStruct(i).end = str2double(pSoundsourceCombinationsCell{i, 2});
% soundsourceCombinationsStruct(i).soundsources = unique(strsplit( ...
% pSoundsourceCombinationsCell{i, 3} ...
% , ' ')) ;
% soundsourceCombinationsStruct(i).referencePoint = cellfun(@str2double, strsplit( ...
% pSoundsourceCombinationsCell{i, 4}, ' ', ...
% 'CollapseDelimiters', true ...
% ));
% soundsourceCombinationsStruct(i).soundspeed = cellfun( ...
% @str2double, ...
% pSoundsourceCombinationsCell(i, 5:9) ...
% );
% end
end
......@@ -11,7 +11,7 @@ columnCount = size(artoaWorkspace.trackParameter.soundsourceCombinations, 2);
selectedRow = artoaWorkspace.trackParameter.selectedSoundsourceCombinationRow;
%% Get current data
combinationTable = ...
artoa.soundsources.createCombinationsTable( ...
artoa.controller.track.parameter.createCombinationsTable( ...
artoaGui.trackParameter.tableSoundSourceCombinations.Data ...
);
......
......@@ -23,7 +23,6 @@ callbacks.inputOutputInterpolationInterval = @artoa.controller.track.parameter.i
callbacks.inputGapSize = @artoa.controller.track.parameter.inputGapSize;
callbacks.tableSoundSourceCombinationsSelection = @artoa.controller.track.parameter.tableSoundsourceCombinationsSelection;
callbacks.tableSoundSourceCombinationsEdit = @artoa.controller.track.parameter.tableSoundsourceCombinationsEdit;
callbacks.tableSoundSourceOffsetsEdit = @artoa.controller.track.parameter.tableSoundsourceOffsetsEdit;
callbacks.buttonTrack = @artoa.controller.track.run;
callbacks.buttonAddCombination = @artoa.controller.track.parameter.addSoundsourceCombination;
callbacks.buttonAddCombinationAbove = @artoa.controller.track.parameter.addSoundsourceCombinationAbove;
......@@ -45,7 +44,7 @@ if ~isfield(artoaWorkspace, 'trackParameter')
% setup sound source combinations
artoaWorkspace.trackParameter.soundsourceCombinations = ...
artoa.soundsources.createCombinationsTable(...
artoa.controller.track.parameter.createCombinationsTable(...
artoa.controller.track.parameter.getDefaultCombinationCell() ...
);
artoaGui.trackParameter.tableSoundSourceCombinations.Data = artoa.controller.track.parameter.getDefaultCombinationCell();
......@@ -66,7 +65,7 @@ if ~isfield(artoaWorkspace, 'trackParameter')
'comboboxSoundspeedMethod', ...
'checkboxPlotResiduals', ...
'inputOutputInterpolationInterval', ...
'inputGapSize', ...'tableSoundSourceOffsetsEdit', ...
'inputGapSize', ...
'tableSoundSourceCombinationsEdit' ...
};
......
......@@ -10,7 +10,7 @@ end
%% Delete from workspace
artoaWorkspace.trackParameter.soundsourceCombinations = ...
artoa.soundsources.createCombinationsTable( ...
artoa.controller.track.parameter.createCombinationsTable( ...
artoa.controller.track.parameter.getDefaultCombinationCell() ...
);
......
......@@ -6,7 +6,7 @@ global artoaGui artoaWorkspace;
%% Save all details
artoaWorkspace.trackParameter.soundsourceCombinations = ...
artoa.soundsources.createCombinationsTable( ...
artoa.controller.track.parameter.createCombinationsTable( ...
artoaGui.trackParameter.tableSoundSourceCombinations.Data ...
);
......
......@@ -10,11 +10,6 @@ if ~isfield(artoaWorkspace, 'trackParameter') ...
return;
end
% % update soundsources
% artoaGui.trackParameter.tableSoundSourceOffsets.RowName = fieldnames( ...
% artoaWorkspace.filteredSoundsources ...
% );
fields = artoaWorkspace.trackParameter;
fieldNames = fieldnames(fields);
......@@ -35,14 +30,8 @@ for i = 1:length(fieldNames)
artoaGui.trackParameter.inputOutputInterpolationInterval.String = currentValue;
case 'gapSize'
artoaGui.trackParameter.inputGapSize.String = currentValue;
case 'soundsourceOffsets'
artoaGui.trackParameter.tableSoundSourceOffsets.Data = table2cell( ...
currentValue ...
);
artoaGui.trackParameter.tableSoundSourceOffsets.RowName = currentValue.Properties.RowNames;
artoaGui.trackParameter.tableSoundSourceOffsets.ColumnName = currentValue.Properties.VariableNames;
case 'soundsourceCombinations'
artoaGui.trackParameter.tableSoundSourceCombinations.Data = artoa.soundsources.createCombinationsCell(currentValue);
artoaGui.trackParameter.tableSoundSourceCombinations.Data = table2cell(currentValue);
end
end
......
......@@ -9,7 +9,7 @@ involvedSoundsourceNames = ...
@strsplit, pTrajectory.trackParameter.soundsourceCombinations.soundsources, 'UniformOutput', false ...
) ...
));
involvedSoundsources = artoa.data.extractSoundsourcesFromStruct( ...
involvedSoundsources = artoa.soundsources.extract( ...
involvedSoundsourceNames, ...
pSoundsources, ...
true ...
......
......@@ -10,7 +10,7 @@ involvedSoundsourceNames = ...
@strsplit, strtrim(artoaWorkspace.trackParameter.soundsourceCombinations.soundsources), 'UniformOutput', false ...
) ...
));
involvedSoundsources = artoa.data.extractSoundsourcesFromStruct( ...
involvedSoundsources = artoa.soundsources.extract( ...
involvedSoundsourceNames, ...
artoaWorkspace.filteredSoundsources ...
);
......
......@@ -70,7 +70,7 @@ pressureAndDate = { ...
trajectoryResiduals, ...
trajectoryVelocities, ...
trajectoryTimeDivergenceToGps ...
] = artoa.float.calculateTrajectory( ...
] = artoa.trajectory.calculate( ...
artoaWorkspace.float, ...
pressureAndDate, ...
artoaWorkspace.satData, ...
......
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