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

The soundsource offsets and drifts are now calculated into the SAT TOAs.

parent 52e09efa
No related branches found
No related tags found
No related merge requests found
107
\ No newline at end of file
108
\ No newline at end of file
......@@ -37,6 +37,9 @@ artoaWorkspace.toaData = artoa.toa.recalculate( ...
artoaWorkspace.editOffsets.selectedOffsets ...
);
%% Calculate GPS TOAs
artoa.controller.edit.timeOfArrival.calculateGpsToas();
artoa.controller.edit.timeOfArrival.plot();
end
function [] = calculateGpsToas()
%CALCULATEGPSTOAS Calculates the SAT TOAs of all soundsources.
% Calculates the SAT TOAs by artoa.toa.predictFromGps. Adds the
% soundsource offset and drift if already selected.
global artoaWorkspace artoaDataInput;
%% Get all soundsources
fnames = fieldnames(artoaWorkspace.filteredSoundsources);
artoaWorkspace.editTimeOfArrival.satToa = struct();
%% Calculate GPS TOAs for every soundsource
for o = 1:length(fnames)
% initialize data storage
artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}) = struct();
% calculate rafos dates of soundsource
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.toa.predictFromGps( ...
artoaDataInput.rfb, artoaWorkspace.filteredSoundsources.(fnames{o}), ...
struct( ...
'temperature', artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ...
'pressure', artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ...
'method', 'del grosso', ...
'soundSource', NaN ...
), ...
artoa.data.getMember(artoaDataInput, {'ini', 'leapseconds'}) ...
);
% add soundsource drift
if artoa.data.hasMember(artoaWorkspace, {'editOffsets', 'selectedOffsets'}) ...
&& any(contains(artoaWorkspace.editOffsets.selectedOffsets.Properties.RowNames, fnames{o}))
offset = artoaWorkspace.editOffsets.selectedOffsets{fnames{o}, 'offset'};
drift = artoaWorkspace.editOffsets.selectedOffsets{fnames{o}, 'drift'};
% no sorting required, because fourth parameter contains timesteps
predictedToas = artoa.toa.addDrift( ...
predictedToas, ...
offset, ...
drift, ...
floor(gpsDates - soundSourceBegin) ...
);
end
% remove gps dates that are past end mission of sound source
selection = (gpsDates > soundSourceEnd);
gpsDates(selection) = NaN;
predictedToas(selection) = NaN;
% remove gps dates before deployment of soundsource
selection = (gpsDates < soundSourceBegin);
gpsDates(selection) = NaN;
predictedToas(selection) = NaN;
clear selection;
% save to workspace
artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsDate = gpsDates;
artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsToa = predictedToas;
end
end
......@@ -14,6 +14,8 @@ end
%% Create workspace variables
artoaWorkspace.editTimeOfArrival = struct();
%% Calculate GPS TOAs
artoa.controller.edit.timeOfArrival.calculateGpsToas();
%% Open the gui
artoa.gui.edit.timeOfArrival();
......
......@@ -6,38 +6,47 @@ function [] = plotSoundsourceToaFromGps(pSoundsources)
% Parameters:
% pSoundsources (struct) The soundsources that are to be used.
global artoaDataInput artoaWorkspace artoaGui;
global artoaWorkspace artoaGui;
%% Initialize required variables
unappliedSoundsourcesColor = [0 0 0];
if isfield(artoaGui.editTimeOfArrival, 'axesToaFromGps') ...
&& isvalid(artoaGui.editTimeOfArrival.axesToaFromGps)
% update color
fnames = fieldnames(pSoundsources);
for o = 1:length(fnames)
% get color
if artoa.soundsources.hasAppliedToa(fnames{o}, artoaWorkspace.toaData.soundSource)
[colorIndex, artoaWorkspace.soundsourceColorRegister] = ...
artoa.soundsources.colorregister.add(fnames{o}, artoaWorkspace.soundsourceColorRegister);
for t = 1:length(artoaGui.editTimeOfArrival.textToaFromGps.(fnames{o}))
current = artoaGui.editTimeOfArrival.textToaFromGps.(fnames{o})(t);
current.Color = artoaWorkspace.soundsourceColors(colorIndex, :);
end
clear current;
% update scatter
artoaGui.editTimeOfArrival.scatterToaFromGps.(fnames{o}).MarkerEdgeColor = ...
artoaWorkspace.soundsourceColors(colorIndex, :);
[colorIndex, artoaWorkspace.soundsourceColorRegister] = ...
artoa.soundsources.colorregister.add(fnames{o}, artoaWorkspace.soundsourceColorRegister);
soundsourceColor = artoaWorkspace.soundsourceColors(colorIndex, :);
else
% update text
for t = 1:length(artoaGui.editTimeOfArrival.textToaFromGps.(fnames{o}))
current = artoaGui.editTimeOfArrival.textToaFromGps.(fnames{o})(t);
current.Color = unappliedSoundsourcesColor;
soundsourceColor = unappliedSoundsourcesColor;
end
% get values
xData = artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsDate;
yData = artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsToa;
% update scatter
artoaGui.editTimeOfArrival.scatterToaFromGps.(fnames{o}).MarkerEdgeColor = soundsourceColor;
artoaGui.editTimeOfArrival.scatterToaFromGps.(fnames{o}).XData = xData';
artoaGui.editTimeOfArrival.scatterToaFromGps.(fnames{o}).YData = yData';
for t = 1:length(artoaGui.editTimeOfArrival.textToaFromGps.(fnames{o}))
current = artoaGui.editTimeOfArrival.textToaFromGps.(fnames{o})(t);
current.Color = soundsourceColor; % update text color
if isnan(current.Position(1))
continue;
end
xIndex = find(xData == current.Position(1));
if xIndex >= 0 && ~isnan(xIndex)
current.Position(2) = yData(xIndex);
end
clear current;
% update scatter
artoaGui.editTimeOfArrival.scatterToaFromGps.(fnames{o}).MarkerEdgeColor = ...
unappliedSoundsourcesColor;
end
end
end
return
end
......@@ -65,49 +74,21 @@ for o = 1:length(fnames)
else
soundsourceColor = unappliedSoundsourcesColor;
end
% 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.(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.toa.predictFromGps( ...
artoaDataInput.rfb, pSoundsources.(fnames{o}), ...
struct( ...
'temperature', artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ...
'pressure', artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ...
'method', 'del grosso', ...
'soundSource', NaN ...
), ...
artoa.data.getMember(artoaDataInput, {'ini', 'leapseconds'}) ...
);
% remove gps dates that are past end mission of sound source
selection = (gpsDates > soundSourceEnd);
gpsDates(selection) = NaN;
predictedToas(selection) = NaN;
% remove gps dates before deployment of soundsource
selection = (gpsDates < soundSourceBegin);
gpsDates(selection) = NaN;
predictedToas(selection) = NaN;
clear selection;
artoaGui.editTimeOfArrival.scatterToaFromGps.(fnames{o}) = scatter( ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
gpsDates, predictedToas, 50, ...
artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsDate, ...
artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsToa, ...
50, ...
'MarkerEdgeColor', soundsourceColor ...
);
% use only every third gps date
gpsDates = gpsDates(1:3:end);
predictedToas = predictedToas(1:3:end);
% use only every third gps date for text
artoaGui.editTimeOfArrival.textToaFromGps.(fnames{o}) = text( ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
gpsDates, predictedToas, [' ' fnames{o}], ...
artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsDate(1:3:end), ...
artoaWorkspace.editTimeOfArrival.satToa.(fnames{o}).gpsToa(1:3:end), ...
[' ' fnames{o}], ...
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'top', ...
'FontName', 'Helvetica', ...¬
......
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