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

Various fixes and improvements to the TOA and main window.

Main window additions:
  - The "Reload artoa.ini" button has been introduced.

TOA window modifications:
  - The colormap of TOA now matches the nemo2profile colormap.
  - The colors of the sound sources can now be configured in artoa.ini.
  - The soundsources now are displayed as ring and in the configured color.
  - The TOA descriptions are now displayed in every third occurrence.
  - A legend with colors for the soundsources has been added to the window.
parent ed49f496
No related branches found
No related tags found
No related merge requests found
Showing
with 331 additions and 96 deletions
% ARTOA ini file for dimes first three floats
[files]
-soundsourcefile /your/filepath/here/input/HAFOS.soso
-floatfile ..\HAFOS.flo % not used in artoa4 yet
-bathyfile % not used in artoa4 yet
[directory]
-interim /your/filepath/here/
-rfb /your/filepath/here/
-soundsource /your/filepath/here/
% the following parameters are not yet used in artoa4
-argos ..
-rft ..
-cla2 ..
-trj4 /your/filepath/here/
-rfc /your/filepath/here/
-DLDargos ..
-hdr ..
-status
-surface
-ric /your/filepath/here/
[filemask]
-interim *.itm
-rfb *.rfb
-soundsource *.soso
% the following parameters are not yet used in artoa4
-session *.sel
-argos *.arg
-header *.hdr
-rft *.rft
-cla2 *.cla2
-rfc *.rfc
-trj4 *.trj4
-status *.sts
-surface *.sfc
-ric *.ric
-diaric *.diaric
[load]
% the following parameters are not yet used in artoa4
-savesession 0
-cycledelimiter -
[view]
-hidedeleteddatapoints 0
[defaults]
-pressure 9999
-temperature 9999
-toa 9999
[soundsourcecolors]
230 25 75
60 180 75
255 225 25
0 130 200
245 130 48
145 30 180
70 240 240
240 50 230
210 245 60
250 190 190
0 128 128
230 190 255
170 110 40
255 250 200
128 0 0
170 255 195
128 128 0
255 215 180
0 0 128
128 128 128
255 255 255
0 0 0
......@@ -2,7 +2,7 @@ function [] = applySoundSourceToSelectedPoints()
%APPLYSOUNDSOURCETOSELECTEDPOINTS Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace artoaDataInput;
global artoaWorkspace;
%% Check if selection exists
......@@ -18,7 +18,7 @@ if ~artoa.controller.soundSourcesLoaded()
end
%% Let the user select the sound source
soundsources = fieldnames(artoaDataInput.soundsources);
soundsources = fieldnames(artoaWorkspace.filteredSoundsources);
[index, success] = listdlg( ...
'PromptString', 'Soundsources:',...
......
......@@ -21,7 +21,7 @@ end
%% Set status
artoaWorkspace.toaData.status(artoaWorkspace.editTimeOfArrival.selectedPoints) = pStatusCode;
artoaWorkspace.toaData.status(artoaWorkspace.editTimeOfArrival.userSelection) = pStatusCode;
%% Update gui
artoa.controller.edit.updateAvailablePlots();
......
function [] = applyToaAxesToGpsAndSoundsources()
%LINKALLAXES Summary of this function goes here
% Detailed explanation goes here
global artoaGui;
% Set position
set(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'Position', [.25 .1 .58 .8]);
set(artoaGui.editTimeOfArrival.axesToaFromGps, 'Position', [.25 .1 .58 .8]);
set(artoaGui.editTimeOfArrival.axesAppliedSoundsources, 'Position', [.25 .1 .58 .8]);
% apply limits of toa to the other plots
set( ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
'Position', [.25 .1 .58 .8], ...
'YLim', artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.YLim, ...
'XLim', artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.XLim ...
);
set( ...
artoaGui.editTimeOfArrival.axesAppliedSoundsources, ...
'Position', [.25 .1 .58 .8], ...
'YLim', artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.YLim, ...
'XLim', artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.XLim ...
);
% hide top axes
artoaGui.editTimeOfArrival.axesToaFromGps.Visible = 'off';
artoaGui.editTimeOfArrival.axesToaFromGps.XTick = [];
artoaGui.editTimeOfArrival.axesToaFromGps.YTick = [];
artoaGui.editTimeOfArrival.axesAppliedSoundsources.Visible = 'off';
artoaGui.editTimeOfArrival.axesAppliedSoundsources.XTick = [];
artoaGui.editTimeOfArrival.axesAppliedSoundsources.YTick = [];
end
......@@ -24,9 +24,9 @@ artoaGui.editTimeOfArrival.userSelection = line( ...
[dx, dy, button] = ginput(1);
while button == 1
% get boundaries
bound = artoaGui.figures.editTimeOfArrival.CurrentAxes.XLim;
bound = artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.XLim;
dx = artoa.data.adjustToBoundaries(dx, bound(1), bound(2));
bound = artoaGui.figures.editTimeOfArrival.CurrentAxes.YLim;
bound = artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.YLim;
dy = artoa.data.adjustToBoundaries(dy, bound(1), bound(2));
% add values to array
x = [x; dx];
......
......@@ -8,21 +8,8 @@ global artoaGui artoaWorkspace artoaDataInput;
%% Get all required values
% create color vector
correlationHeights = artoaWorkspace.toaData.correlationHeight./artoaWorkspace.float.correlationrange(2);
%c = repmat([.5 .5 .5], length(artoaWorkspace.toaData.toaDate), 1);
c = artoaWorkspace.toaData.correlationHeight;
soundsources = fieldnames(artoaDataInput.soundsources);
for i = 1:length(soundsources)
selection = logical(artoaWorkspace.toaData.status == 1) ...
& logical(strcmp(artoaWorkspace.toaData.soundSource, soundsources{i}));
c(selection) = artoaWorkspace.soundSourceColorId(i) * 0.4 + 0.6;
end
%c(artoaWorkspace.toaData.status == 1) = correlationHeights(artoaWorkspace.toaData.status == 1) * 0.4 + 0.1;
if artoaWorkspace.hideDeletedDataPoints
% get all toa that are considered valid by temperature and pressure
% selection
......@@ -45,16 +32,20 @@ if isfield(artoaGui.editTimeOfArrival, 'scatterTimeOfArrival') ...
artoaGui.editTimeOfArrival.scatterTimeOfArrival.XData = x;
artoaGui.editTimeOfArrival.scatterTimeOfArrival.YData = y;
artoaGui.editTimeOfArrival.scatterTimeOfArrival.CData = c;
% update applied sound sources
artoa.controller.edit.timeOfArrival.plotAppliedSoundsources();
artoa.controller.edit.timeOfArrival.applyToaAxesToGpsAndSoundsources();
return
end
%% Create a new plot if non existent
hold on;
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival = axes(artoaGui.figures.editTimeOfArrival);
hold(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'on');
% get all points that are not deleted
artoaGui.editTimeOfArrival.scatterTimeOfArrival = scatter( ...
artoaGui.figures.editTimeOfArrival.CurrentAxes, ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, ...
x, ...
y, ...
[], ...
......@@ -62,22 +53,17 @@ artoaGui.editTimeOfArrival.scatterTimeOfArrival = scatter( ...
'filled' ...
);
% set colormap
artoaGui.figures.editTimeOfArrival.CurrentAxes.CLim = [0, 255];
colormap(artoaGui.figures.editTimeOfArrival.CurrentAxes, flipud(colormap));
%% Setup GPS information plot
artoa.controller.edit.timeOfArrival.plotSoundsourceToaFromGps(soundsources);
hold on;
%% Set colormap
%colormap(artoaGui.figures.editTimeOfArrival.CurrentAxes, artoa.vendor.cmocean('tarn'));
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.CLim = [0, 255];
colormap(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, flipud(colormap));
%% Setup gui
grid on;
% set background color
set(artoaGui.figures.editTimeOfArrival.CurrentAxes, 'Color', [.3 .3 .3], 'XColor', 'blue', 'YColor', 'blue');
set(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'Color', [.3 .3 .3], 'XColor', 'blue', 'YColor', 'blue');
% set plot title
titleVal = [ ...
......@@ -86,16 +72,29 @@ titleVal = [ ...
' Cycle: ' num2str(artoaWorkspace.float.cycle(1)) ...
' - Time of arrival' ...
];
titleHandle = title(artoaGui.figures.editTimeOfArrival.CurrentAxes, titleVal, 'FontSize', 10);
titleHandle = title(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, titleVal, 'FontSize', 10);
set(titleHandle, 'Color', 'blue');
% set x and y label
xlabel(artoaGui.figures.editTimeOfArrival.CurrentAxes, 'Message Date', 'FontSize', 10);
ylabel(artoaGui.figures.editTimeOfArrival.CurrentAxes, 'Time of arrival rel. to window start time', 'FontSize', 10);
xlabel(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'Message Date', 'FontSize', 10);
ylabel(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'Time of arrival rel. to window start time', 'FontSize', 10);
hold(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'off');
%% Setup GPS information plot
artoa.controller.edit.timeOfArrival.plotSoundsourceToaFromGps(artoaWorkspace.filteredSoundsources);
hold off;
%% Plot applied sound sources
artoa.controller.edit.timeOfArrival.plotAppliedSoundsources();
%% Link toa, gps information and applied sound sources plot
linkaxes([ ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
artoaGui.editTimeOfArrival.axesAppliedSoundsources ...
]);
artoa.controller.edit.timeOfArrival.applyToaAxesToGpsAndSoundsources();
end
function [] = plotAppliedSoundsources()
%PLOTAPPLIEDSOUNDSOURCES Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace artoaGui;
%% Initialize required variables
x = [];
y = [];
c = [];
%% Plot sound sources
fnames = fieldnames(artoaWorkspace.filteredSoundsources);
for i = 1:length(fnames)
selection = logical(artoaWorkspace.toaData.status == 1) ...
& logical(strcmp(artoaWorkspace.toaData.soundSource, fnames{i}));
x = [x; artoaWorkspace.toaData.toaDate(selection)];
y = [y; artoaWorkspace.toaData.toa(selection)];
c = [c; repmat(artoaWorkspace.soundsourceColors(i, :), length(artoaWorkspace.toaData.toaDate(selection)), 1)];
end
%% If the plot exists, just update the values
if isfield(artoaGui.editTimeOfArrival, 'scatterAppliedSoundsources') ...
&& isvalid(artoaGui.editTimeOfArrival.scatterAppliedSoundsources)
artoaGui.editTimeOfArrival.scatterAppliedSoundsources.XData = x;
artoaGui.editTimeOfArrival.scatterAppliedSoundsources.YData = y;
artoaGui.editTimeOfArrival.scatterAppliedSoundsources.CData = c;
return;
end
artoaGui.editTimeOfArrival.axesAppliedSoundsources = axes(artoaGui.figures.editTimeOfArrival);
hold(artoaGui.editTimeOfArrival.axesAppliedSoundsources, 'on');
artoaGui.editTimeOfArrival.scatterAppliedSoundsources = scatter( ...
artoaGui.editTimeOfArrival.axesAppliedSoundsources, ...
x, y, [], c, 'filled' ...
);
hold(artoaGui.editTimeOfArrival.axesAppliedSoundsources, 'off');
end
function [] = plotSoundsourceToaFromGps(soundsources)
%PLOTSOUNDSOURCETOAFROMGPS Summary of this function goes here
% Detailed explanation goes here
function [] = plotSoundsourceToaFromGps(pSoundsources)
%PLOTSOUNDSOURCETOAFROMGPS Plots the given sound sources to the edit time of arrival plot.
% Is called by artoa.controller.edit.timeOfArrival.plot()
% CANNOT BE USED ISOLATED.
%
% Parameters:
% pSoundsources (struct) The soundsources that are to be used.
global artoaDataInput artoaWorkspace artoaGui;
artoaGui.editTimeOfArrival.axesToaFromGps = axes(artoaGui.figures.editTimeOfArrival);
hold(artoaGui.figures.editTimeOfArrival.CurrentAxes, 'on');
hold(artoaGui.editTimeOfArrival.axesToaFromGps, 'on');
%% Collect required data
yMax = max(artoaGui.figures.editTimeOfArrival.CurrentAxes.YLim);
yMin = min(artoaGui.figures.editTimeOfArrival.CurrentAxes.YLim);
yMax = max(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.YLim);
yMin = min(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.YLim);
fnames = fieldnames(pSoundsources);
for o = 1:length(soundsources)
for o = 1:length(fnames)
% skip sound source if it went out of the water before the float range, or
% went in the water after the float range
soundSourceBegin = artoa.convert.dmy2rd(artoaDataInput.soundsources.(soundsources{o}).begemis(3), ...
artoaDataInput.soundsources.(soundsources{o}).begemis(2), ...
artoaDataInput.soundsources.(soundsources{o}).begemis(1));
soundSourceEnd = artoa.convert.dmy2rd(artoaDataInput.soundsources.(soundsources{o}).endemis(3), ...
artoaDataInput.soundsources.(soundsources{o}).endemis(2), ...
artoaDataInput.soundsources.(soundsources{o}).endemis(1));
if soundSourceEnd < min(artoaWorkspace.toaData.toaDate) ...
|| soundSourceBegin > max(artoaWorkspace.toaData.toaDate)
continue;
end
soundSourceBegin = artoa.convert.dmy2rd(artoaDataInput.soundsources.(fnames{o}).begemis(3), ...
artoaDataInput.soundsources.(fnames{o}).begemis(2), ...
artoaDataInput.soundsources.(fnames{o}).begemis(1));
soundSourceEnd = artoa.convert.dmy2rd(artoaDataInput.soundsources.(fnames{o}).endemis(3), ...
artoaDataInput.soundsources.(fnames{o}).endemis(2), ...
artoaDataInput.soundsources.(fnames{o}).endemis(1));
[gpsDates, predictedToas] = artoa.data.predictToaFromGps( ...
artoaDataInput.rfb, artoaDataInput.soundsources.(soundsources{o}), ...
artoaDataInput.rfb, pSoundsources.(fnames{o}), ...
struct( ...
'temperature', artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ...
'pressure', artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ...
......@@ -44,9 +45,9 @@ for o = 1:length(soundsources)
clear selection;
scatter( ...
artoaGui.figures.editTimeOfArrival.CurrentAxes, ...
gpsDates, predictedToas, 20, ...
'MarkerFaceColor', [1 1 1] ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
gpsDates, predictedToas, 50, ...
'MarkerEdgeColor', artoaWorkspace.soundsourceColors(o, :) ...
);
% use only every third gps date
......@@ -54,20 +55,20 @@ for o = 1:length(soundsources)
predictedToas = predictedToas(1:3:end);
text( ...
artoaGui.figures.editTimeOfArrival.CurrentAxes, ...
gpsDates, predictedToas, ['-', soundsources{o}], ...¬
artoaGui.editTimeOfArrival.axesToaFromGps, ...
gpsDates, predictedToas, ['-', fnames{o}], ...¬
'HorizontalAlignment', 'left', ...¬
'VerticalAlignment', 'top', ...¬
'FontName', 'Helvetica', ...¬
'FontSize', 10, ...¬
'FontWeight', 'demi', ...¬
'Color', [1 1 1] ...
'Color', artoaWorkspace.soundsourceColors(o, :) ...%[1 1 1] ...
);
% Soundsource lines
% define step size of the text for sound source lines
tmpSteps = floor((yMax - yMin)/10);
additionalYOffset = o*(tmpSteps/length(soundsources));
additionalYOffset = o*(tmpSteps/length(fnames));
% deployment
toaMax = max(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2));
toaMin = min(artoaWorkspace.toaData.toaDate(artoaWorkspace.toaData.status ~= 2));
......@@ -76,9 +77,9 @@ for o = 1:length(soundsources)
&& (soundSourceBegin < toaMax + toaExtension)
for textSteps = yMin:tmpSteps:(yMax-tmpSteps)
text( ...
artoaGui.figures.editTimeOfArrival.CurrentAxes, ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
soundSourceBegin, textSteps + additionalYOffset, ...
['<-- ', soundsources{o}], ...
['<-- ', fnames{o}], ...
'Color',[1 .4 .4], ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'bottom', ...
......@@ -100,9 +101,9 @@ for o = 1:length(soundsources)
&& (soundSourceEnd < toaMax + toaExtension)
for textSteps = yMin:tmpSteps:(yMax-tmpSteps)
text( ...
artoaGui.figures.editTimeOfArrival.CurrentAxes, ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
soundSourceEnd, textSteps + additionalYOffset, ...
[soundsources{o}, ' -->'], ...
[fnames{o}, ' -->'], ...
'Color',[1 .4 .4], ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'bottom', ...
......@@ -121,7 +122,7 @@ for o = 1:length(soundsources)
end
end
hold(artoaGui.figures.editTimeOfArrival.CurrentAxes, 'off');
hold(artoaGui.editTimeOfArrival.axesToaFromGps, 'off');
end
......
......@@ -20,7 +20,7 @@ end
% update sound source of selected points
artoaWorkspace.toaData.soundSource( ...
artoaWorkspace.editTimeOfArrival.selectedPoints ...
artoaWorkspace.editTimeOfArrival.userSelection ...
) = {''};
......
......@@ -84,6 +84,10 @@ artoa.data.replaceValuesWithNaN( ...
%% FLOAT DETAILS
artoaWorkspace.float = artoaDataInput.rfb.FLOAT;
%% GET SOUNDSOURCES THAT ARE ALIVE DURING THE FLOAT MISSION
artoaWorkspace.filteredSoundsources = artoa.soundsources.filter( ...
artoaDataInput.soundsources, min(artoaWorkspace.rafosDate), max(artoaWorkspace.rafosDate) ...
);
end
......@@ -40,17 +40,8 @@ artoaGui = struct();
artoaGui.figures = struct();
artoaGui.main = struct();
%% Read ini file if existent
try
artoaDataInput.ini = artoa.load.tomlini('artoa.ini');
catch ex
error([mfilename ': Reading artoa.ini failed with the following message: ' ex.message]);
end
if isempty(artoaDataInput.ini)
error([mfilename ': artoa.ini has been found but is empty. Please use a valid artoa.ini!']);
end
%% Read ini file if existent and copy required variables to workspace
artoa.controller.loadArtoaIni();
%% Read soundsource file if existent
try
......@@ -59,7 +50,6 @@ try
error([mfilename ': ' soundsourceFilepath ' is not a file. Please check your artoa.ini!']);
end
artoaDataInput.soundsources = artoa.load.soundsources(soundsourceFilepath);
artoa.soundsources.generateSoundSourceColors();
catch ex
error([mfilename ': Reading soundsource file failed with the following message: ' ex.message]);
end
......
function [] = loadArtoaIni()
%RELOADARTOAINI Loads the artoa.ini file and copies the required values to workspace.
%
global artoaDataInput artoaWorkspace;
try
artoaDataInput.ini = artoa.load.tomlini('artoa.ini');
artoaWorkspace.soundsourceColors = artoaDataInput.ini.soundsourcecolors./255;
catch ex
error([mfilename ': Reading artoa.ini failed with the following message: ' ex.message]);
end
if isempty(artoaDataInput.ini)
error([mfilename ': artoa.ini has been found but is empty. Please use a valid artoa.ini!']);
end
end
......@@ -21,15 +21,14 @@ artoaGui.editTimeOfArrival = struct();
set( ...
artoaGui.figures.editTimeOfArrival, ...
'CloseRequestFcn', ...
'artoa.controller.edit.timeOfArrival.close();' ...
'artoa.controller.edit.timeOfArrival.close();', ...
'Units', 'normalized' ...
);
%% Generate Plot
artoa.controller.edit.timeOfArrival.plot();
set(gca, 'Position', [0.13 0.11 0.706 0.815]);
%% Generate Controls
left = .85;
......@@ -107,7 +106,7 @@ artoaGui.editTimeOfArrival.frameControlsSoundSource = uipanel( ...
'Title', 'Soundsource', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .11 width .2] ...
'Position', [left .1 width .2] ...
);
artoaGui.editTimeOfArrival.buttonApply = uicontrol( ...
......@@ -130,6 +129,48 @@ artoaGui.editTimeOfArrival.buttonDelete = uicontrol( ...
'CallBack', 'artoa.controller.edit.timeOfArrival.removeSoundSourceFromSelectedPoints();' ...
);
%% Sound source color legend frame
artoaGui.editTimeOfArrival.frameControlsSoundSourceColors = uipanel( ...
'Title', 'Soundsource colors', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [.01 .1 width .8] ...
);
% add label and color for every sound source that is available
usedHeight = .8;
spaceTopAndBottom = .05;
offset = 0;
artoaGui.editTimeOfArrival.labelSoundsourcesColors = struct();
soundsources = artoaWorkspace.filteredSoundsources;
fnames = fieldnames(soundsources);
for i = 1:length(fnames)
artoaGui.editTimeOfArrival.labelSoundsourcesColors.(fnames{i}) = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSoundSourceColors, ...
'String', '', ...
'Style', 'text', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.1 (1 - spaceTopAndBottom - offset) .1 .03], ...
'Background', artoaWorkspace.soundsourceColors(i, :) ...
);
artoaGui.editTimeOfArrival.labelSoundsourcesColors.([fnames{i} 'c']) = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSoundSourceColors, ...
'String', fnames{i}, ...
'Style', 'text', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.25 (1 - spaceTopAndBottom - offset) .5 .03], ...
'Background', [1 1 1], ...
'HorizontalAlignment', 'left' ...
);
offset = offset + 0.04;
end
%% Enable zoom
zoom on;
......
......@@ -62,6 +62,12 @@ uimenu( ...
'Callback', 'artoa.controller.file.saveInterim();' ...
);
artoaGui.main.menus.fileReloadArtoaIni = uimenu( ...
artoaGui.main.menus.file, ...
'Label', 'Reload artoa.ini', ...
'Callback', 'artoa.controller.loadArtoaIni();' ...
);
% QUIT
artoaGui.main.menus.fileQuit = uimenu( ...
artoaGui.main.menus.file, ...
......
function [filteredSoundsources] = filter(pSoundsources, pBeginDate, pEndDate)
%FILTER Returns only the sound sources that fit the boundaries.
% Checks if the soundsource is alive between the given begin and end
% date. Returns only the ones that pass the test.
%
% Parameters:
% pSoundsources (struct) Each cell contains a sound source struct.
% pBeginDate (double) The begin date in rafos format.
% pEndDate (double) The end date in rafos format.
%
% Returns:
% filteredSoundsources (struct) The filtered soundsource cell.
filteredSoundsources = struct();
fnames = fieldnames(pSoundsources);
for o = 1:length(fnames)
soundSourceBegin = artoa.convert.dmy2rd(pSoundsources.(fnames{o}).begemis(3), ...
pSoundsources.(fnames{o}).begemis(2), ...
pSoundsources.(fnames{o}).begemis(1));
soundSourceEnd = artoa.convert.dmy2rd(pSoundsources.(fnames{o}).endemis(3), ...
pSoundsources.(fnames{o}).endemis(2), ...
pSoundsources.(fnames{o}).endemis(1));
if soundSourceEnd < pBeginDate ...
|| soundSourceBegin > pEndDate
continue;
end
filteredSoundsources.(fnames{o}) = pSoundsources.(fnames{o});
end
end
function [] = generateSoundSourceColors()
%GENERATESOUNDSOURCECOLORS Generates unique identifier value for a sound source.
% Generates a 1D vector with values between 0 and 1. This vector is used
% to identify sound sources by color in the timeOfArrival plot.
global artoaWorkspace artoaDataInput;
soundsourceNames = fieldnames(artoaDataInput.soundsources);
artoaWorkspace.soundSourceColorId = ...
[1:length(soundsourceNames)] / length(soundsourceNames);
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