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

Bugfix, Added duplicate toa table.

Bugfix:
  When soundsource has been applied, the zoom function was not functioning
  anymore.

Toa table:
  It is now possible to select the duplicates in the toa table, and the
  the plot will zoom to it.
parent dc87e3d2
No related branches found
No related tags found
No related merge requests found
Showing
with 156 additions and 7 deletions
......@@ -46,6 +46,9 @@ artoaWorkspace.toaData.soundSource( ...
% apply status to selection
artoaWorkspace.toaData.status(selection) = 1;
%% Update duplicate toa table
artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update plots
artoa.controller.edit.updateAvailablePlots();
......
......
......@@ -41,6 +41,9 @@ artoaWorkspace.toaData.soundSource( ...
% Update status to selected
artoa.controller.edit.timeOfArrival.applyStatusToSelectedPoints(1);
%% Update duplicate toa table
artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update plots
artoa.controller.edit.updateAvailablePlots();
%artoa.controller.edit.timeOfArrival.plot();
......
......
......@@ -23,6 +23,10 @@ end
%% Set status
artoaWorkspace.toaData.status(artoaWorkspace.editTimeOfArrival.userSelection) = pStatusCode;
%% Update duplicate toa table
artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update gui
artoa.controller.edit.updateAvailablePlots();
......
......
......@@ -12,7 +12,7 @@ artoaGui.editTimeOfArrival.frameControlsSoundSourceColors = uipanel( ...
'Title', 'Soundsource colors', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [.01 .3 width .6] ...
'Position', [.01 .4 width .5] ...
);
% add label and color for every sound source that is available
......
......
......@@ -17,6 +17,9 @@ artoa.gui.edit.timeOfArrival();
%% Create workspace variables
artoaWorkspace.editTimeOfArrival = struct();
%% Update duplicate toa table
artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
end
......@@ -34,9 +34,15 @@ if isfield(artoaGui.editTimeOfArrival, 'scatterTimeOfArrival') ...
artoaGui.editTimeOfArrival.scatterTimeOfArrival.CData = c;
% update applied sound sources
artoa.controller.edit.timeOfArrival.plotAppliedSoundsources();
artoa.controller.edit.timeOfArrival.plotSoundsourceToaFromGps(artoaWorkspace.filteredSoundsources);
artoa.controller.edit.timeOfArrival.applyToaAxesToGpsAndSoundsources();
artoa.controller.edit.timeOfArrival.createSoundsourceColorsPanel();
linkaxes([ ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
artoaGui.editTimeOfArrival.axesAppliedSoundsources ...
]);
% force toa scatter to be current axes of figure
artoaGui.figures.editTimeOfArrival.CurrentAxes = artoaGui.editTimeOfArrival.axesScatterTimeOfArrival;
return
end
......
......
......@@ -27,6 +27,9 @@ artoaWorkspace.toaData.soundSource( ...
% Update status to selected
artoa.controller.edit.timeOfArrival.applyStatusToSelectedPoints(0);
%% Update duplicate toa table
artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update plot
artoa.controller.edit.updateAvailablePlots();
%artoa.controller.edit.timeOfArrival.plot();
......
......
function [] = tableDuplicateToaSelection(~, event)
%TABLESOUNDSOURCECOMBINATIONSSELECTION Summary of this function goes here
% Detailed explanation goes here
global artoaGui;
%% Get selected date
date = str2double(artoaGui.editTimeOfArrival.tableDuplicateAppliedToa.Data{event.Indices(1), 2});
toas = artoaGui.editTimeOfArrival.tableDuplicateAppliedToa.Data{event.Indices(1), 3};
toas = strsplit(toas, ' ');
%% Zoom to the selected points
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.XLim = [date - 25; date + 25];
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.YLim = [str2double(toas{1}) - 25; str2double(toas{end - 1}) + 25];
end
function [] = updateDuplicateToaTable()
%UPDATEDUPLICATETOATABLE Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace artoaGui;
%% Get required data
fnames = fieldnames(artoaWorkspace.filteredSoundsources);
toaData = artoaWorkspace.toaData;
tableData = {};
%% calculate duplicated data
for i = 1:length(fnames)
soundsource = artoaWorkspace.filteredSoundsources.(fnames{i});
[dates, toas] = artoa.data.getDuplicateAppliedDates(soundsource, toaData);
for o = 1:length(dates)
tableData{end + 1, 1} = fnames{i};
tableData{end, 2} = sprintf('%3.1f', dates{o});
tableData{end, 3} = sprintf('%3.1f ', sort(toas{o}));
end
end
%% Update table
artoaGui.editTimeOfArrival.tableDuplicateAppliedToa.Data = tableData;
end
......@@ -35,6 +35,9 @@ artoaWorkspace.toaData.soundSource(selection) = {''};
% apply status to selection
artoaWorkspace.toaData.status(selection) = 0;
%% Update duplicate toa table
artoa.controller.edit.timeOfArrival.updateDuplicateToaTable();
%% Update plots
artoa.controller.edit.updateAvailablePlots();
......
......
......@@ -6,15 +6,24 @@ global artoaGui;
%% Close the figure
try
delete(artoaGui.figures.trackParameter);
catch
delete(gcf);
end
%% Clean up variables
try
artoaGui = rmfield(artoaGui, 'trackParameter');
catch
end
try
artoaGui.figures = rmfield(artoaGui.figures, 'trackParameter');
catch
end
% Workspace is not cleaned, because we need the values after closing the
% window
%artoaWorkspace = rmfield(artoaWorkspace, 'trackParameter');
end
function [duplicateDates, duplicateToas] = getDuplicateAppliedDates(pSoundsource, pToaData)
%GETDUPLICATEAPPLIEDDATES Collects all dates that have been applied multiple times to the soundsource.
% Returns two cells with indices consistent to each other.
%
% Parameters:
% pSoundsource (struct): The soundsource details.
% pToaData (struct): The TOA data.
%
% Returns:
% duplicateDates (cell): Containing all rafos dates where
% multiple applications have been found.
% duplicateToas (cell): Contains all toas that are found.
%% Get required data
name = pSoundsource.sourcename;
selection = strcmp(pToaData.soundSource, name);
toaDates = pToaData.toaDate(selection);
toa = pToaData.toa(selection);
%% Collect duplications
[~, ind] = unique(toaDates);
duplicateIndices = setdiff(1:size(toaDates, 1), ind);
duplicateDates = cell(length(duplicateIndices), 1);
duplicateToas = cell(length(duplicateIndices), 1);
%% Get all duplicate toas
for i = 1:length(duplicateIndices)
index = duplicateIndices(i);
duplicateDates(i) = {toaDates(index)};
duplicateToas(i) = {toa(toaDates == duplicateDates{i})};
end
end
......@@ -149,6 +149,31 @@ artoaGui.editTimeOfArrival.buttonWithdrawAllVisible = uicontrol( ...
'CallBack', 'artoa.controller.edit.timeOfArrival.withdrawSoundSourceToAllVisible();' ...
);
%% Duplicate applied TOA table
artoaGui.editTimeOfArrival.frameDuplicateAppliedToa = uipanel( ...
'Title', 'Duplicates', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [.01 .25 width .15] ...
);
columns = { ...
'Soundsource', 'Date', 'TOAs' ...
};
artoaGui.editTimeOfArrival.tableDuplicateAppliedToa = uitable( ...
artoaGui.editTimeOfArrival.frameDuplicateAppliedToa, ...
'Units', 'normalized', ...
'Position', [.1, .1, .8, .8], ...
'Data', cell(1, length(columns)), ...
'ColumnName', columns, ...
'ColumnEditable', false, ...
'CellSelectionCallback', @artoa.controller.edit.timeOfArrival.tableDuplicateToaSelection,...
'CellEditCallback', '', ...
'ColumnWidth', {60, 120, 120} ...
);
clear columns;
%% Sound source color legend frame
artoa.controller.edit.timeOfArrival.createSoundsourceColorsPanel();
......
......
......@@ -38,7 +38,7 @@ for i = 1:length(availableCallbacks) % check if a callback is undefined
end
%% Initialize pressure gui
%% Initialize track parameter gui
artoaGui.figures.trackParameter = figure( ...
'Name', windowTitle, ...
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment