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

If changes to the applied soundsource are made, the track parameter get updated as well.

parent 7103a3e4
No related branches found
No related tags found
No related merge requests found
Showing with 131 additions and 4 deletions
......@@ -52,5 +52,11 @@ artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update plots
artoa.controller.edit.updateAvailablePlots();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
end
......@@ -48,6 +48,12 @@ artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
artoa.controller.edit.updateAvailablePlots();
%artoa.controller.edit.timeOfArrival.plot();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
end
......@@ -30,6 +30,13 @@ artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update gui
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] = ...
artoa.controller.edit.clearSelection(artoaGui.editTimeOfArrival, artoaWorkspace.editTimeOfArrival);
end
......
......@@ -39,6 +39,11 @@ artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
artoa.controller.edit.updateAvailablePlots();
%artoa.controller.edit.timeOfArrival.plot();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
end
......@@ -47,5 +47,11 @@ artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update plots
artoa.controller.edit.updateAvailablePlots();
%% Update offsets table
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
%% Update track parameter window if available
artoa.controller.track.parameter.updateGui();
end
......@@ -50,9 +50,8 @@ if ~isfield(artoaWorkspace, 'trackParameter')
);
artoaGui.trackParameter.tableSoundSourceCombinations.Data = artoa.controller.track.parameter.getDefaultCombinationCell();
% initialize sound source offsets
artoaWorkspace.trackParameter.soundsourceOffsets = ...
artoa.offsets.generateOffsetTable(artoa.controller.getSoundsourcesWithAppliedToa());
%% Update offsets table in workspace
artoa.controller.track.parameter.updateWorkspaceOffsetsTable();
% initialize settings
availableCallbacks = { ...
......
......@@ -3,10 +3,24 @@ function [] = tableSoundsourceOffsetsEdit(~, ~)
% Detailed explanation goes here
global artoaGui artoaWorkspace;
global artoaGui artoaWorkspace artoaDataInput;
%% Save to workspace
artoaWorkspace.trackParameter.soundsourceOffsets(:, :) = artoaGui.trackParameter.tableSoundSourceOffsets.Data;
%% Update TOA
% combine initial toa and current applied soundsources
toaData = artoaWorkspace.toaData;
toaData.toa = artoaDataInput.toaData.toa;
artoaWorkspace.toaData = artoa.soundsources.recalculateToaData( ...
toaData, ...
artoa.controller.getSoundsourcesWithAppliedToa(), ...
artoaWorkspace.trackParameter.soundsourceOffsets ...
);
artoa.controller.edit.timeOfArrival.plot();
end
function [] = updateWorkspaceOffsetsTable()
%UPDATEOFFSETSTABLE Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace;
%% Check if track parameter already exist
if ~artoa.data.hasMember(artoaWorkspace, {'trackParameter'})
return;
end
%% Prepare required variables
soundsources = artoa.controller.getSoundsourcesWithAppliedToa();
workspaceOffsets = artoaWorkspace.trackParameter.soundsourceOffsets;
%% Initialize if not available
if ~artoa.data.hasMember(artoaWorkspace, {'trackParameter', 'soundsourceOffsets'})
% initialize sound source offsets
artoaWorkspace.trackParameter.soundsourceOffsets = ...
artoa.offsets.generateOffsetTable(soundsources);
end
%% Add every soundsource
fnames = fieldnames(soundsources);
for i = 1:length(fnames)
workspaceOffsets = artoa.offsets.addSoundsource( ...
workspaceOffsets, ...
soundsources.(fnames{i}) ...
);
end
%% Check if there are soundsources that should be removed
rowNames = workspaceOffsets.Properties.RowNames;
for i = 1:length(rowNames)
if any(strcmp(rowNames{i}, fnames)) || strcmp(rowNames{i}, 'Float')
continue;
end
workspaceOffsets = artoa.offsets.removeSoundsource( ...
workspaceOffsets, ...
rowNames{i} ...
);
end
artoaWorkspace.trackParameter.soundsourceOffsets = workspaceOffsets;
\ No newline at end of file
function [toaData] = recalculateToaData(pToaData, pAppliedSoundsources, pOffsetsTable)
%RECALCULATETOADATA Summary of this function goes here
% Detailed explanation goes here
%% Prepare return variable
toaData = pToaData;
%% Add float offset
toaData = artoa.data.addFloatDrift( ...
toaData, ...
pOffsetsTable{'Float', 'Begin'}, ...
pOffsetsTable{'Float', 'End'} ...
);
%% Calculate soundsources
fnames = fieldnames(pAppliedSoundsources);
for i = 1:length(fnames)
toaLogical = strcmp(fnames{i}, toaData.soundSource);
toaDate = toaData.toaDate(toaLogical);
toa = toaData.toa(toaLogical);
% calculate drift of soundsource
drift = artoa.soundsources.calculateDrift( ...
min(toaDate), ...
max(toaDate), ...
pOffsetsTable{fnames{i}, 'Begin'}, ...
pOffsetsTable{fnames{i}, 'End'} ...
);
for o = 1:length(toa)
toa(o) = artoa.soundsources.calculateToaAtTimestep( ...
toa(o), ...
toaDate(o) - min(toaDate), ...
pOffsetsTable{fnames{i}, 'Begin'}, ...
drift ...
);
end
toaData.toa(toaLogical) = toa;
end
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