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

Added new matrix D to the offset calculation.

parent 91372a7f
No related branches found
No related tags found
No related merge requests found
220
\ No newline at end of file
221
\ No newline at end of file
......@@ -20,7 +20,8 @@ toaData.toa = artoaDataInput.toaData.toa;
artoaWorkspace.editOffsets.B, ...
artoaWorkspace.editOffsets.X, ...
artoaWorkspace.editOffsets.unfilteredA, ...
artoaWorkspace.editOffsets.unfilteredB ...
artoaWorkspace.editOffsets.unfilteredB, ...
artoaWorkspace.editOffsets.D, ...
] = artoa.offsets.solve( ...
artoaDataInput.rfb, ...
soundsources, ...
......
......@@ -10,11 +10,12 @@ unfilteredB = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'unfilteredB'
A = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'A'}, false);
B = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'B'}, false);
X = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'X'}, false);
D = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'D'}, false);
offsets = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'offsets'}, false);
soundspeed = artoa.data.getMember(artoaWorkspace, {'editOffsets', 'soundspeed'}, false);
if islogical(unfilteredA) || islogical(unfilteredB) ...
|| islogical(A) || islogical(B) || islogical(X) ...
|| islogical(A) || islogical(B) || islogical(X) || islogical(D) ...
|| islogical(offsets) || islogical(soundspeed)
errordlg('At least one of the matrices to save is not available. Please recalculate!', 'Matrices not found');
return;
......@@ -29,7 +30,7 @@ filter = artoa.data.getMember(artoaDataInput, {'ini', 'filemask', 'optimumtables
filepath = fullfile(pathname, filename);
save(filepath, 'unfilteredA', 'unfilteredB', 'A', 'B', 'X', 'offsets', 'soundspeed');
save(filepath, 'unfilteredA', 'unfilteredB', 'A', 'B', 'X', 'D', 'offsets', 'soundspeed');
end
......
function [a, b, c] = createCalculationTables(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pSoundvelocity, pLeapsecondsMatrix)
function [a, b, c, d] = createCalculationTables(pRfb, pSoundsources, pTrackingParameter, pOffsetsParameter, pToaData, pSatData, pSoundvelocity, pLeapsecondsMatrix)
%CREATECALCULATIONMATRICES Summary of this function goes here
% Detailed explanation goes here
......@@ -125,6 +125,49 @@ aSoundsources = table();
%b = zeros(rowCount, 1);
b = table(zeros(rowCount, 1), 'VariableNames', {'toa'});
c = table(zeros(rowCount, 1), 'VariableNames', {'ReferenceTime'});
variablesD = { ...
'Toa', ...
'DifferenceSosoFloatWindow', ...
'DateSatFix', ...
'DistanceSatFix', ...
'SoundsourceName', ...
'MeasuredSosoOffsetDate', ...
'MeasuredSosoOffset', ...
'MeasuredSosoDrift', ...
'EmpiricalSosoOffsetDate', ...
'EmpiricalSosoOffset', ...
'EmpiricalSosoDrift', ...
'Float', ...
'MeasuredFloatOffsetDate', ...
'MeasuredFloatOffset', ...
'MeasuredFloatDrift' ...
};
typesD = [ ...
"double", ...
"double", ...
"double", ...
"double", ...
"string", ...
"double", ...
"double", ...
"double", ...
"double", ...
"double", ...
"double", ...
"string", ...
"double", ...
"double", ...
"double" ...
];
d = table( ...
'Size', [rowCount length(variablesD)], ...
'VariableTypes', typesD, ...
'VariableNames', variablesD ...
);
d{:, :} = NaN;
Distances = zeros(rowCount, 1);
daysSinceFloatStart = NaN(rowCount, 1);
......@@ -145,6 +188,36 @@ for i = 1:length(fnames)
(pSoundsources.(fnames{i}).reftime(1) * 3600 + pSoundsources.(fnames{i}).reftime(2) * 60) ...
- (floatDetails.phasereftime(1) * 3600 + floatDetails.phasereftime(2) * 60 + floatDetails.windowstart * 60);
% d construction
d.Toa(rowIndices) = results.(fnames{i}).measuredToa;
d.DifferenceSosoFloatWindow(rowIndices) = ...
(floatDetails.phasereftime(1) * 3600 + floatDetails.phasereftime(2) * 60) ...
- (pSoundsources.(fnames{i}).reftime(1) * 3600 + pSoundsources.(fnames{i}).reftime(2) * 60);
d.DateSatFix(rowIndices) = results.(fnames{i}).satDate;
d.DistanceSatFix(rowIndices) = results.(fnames{i}).satDistances;
d.SoundsourceName(rowIndices) = fnames{i};
if any(strcmp(pOffsetsParameter.offsets.Properties.RowNames, fnames{i}))
d.MeasuredSosoOffsetDate(rowIndices) = pOffsetsParameter.offsets.DateEnd(fnames{i});
d.MeasuredSosoOffset(rowIndices) = pOffsetsParameter.offsets.OffsetEnd(fnames{i}) - pOffsetsParameter.offsets.OffsetStart(fnames{i});
d.MeasuredSosoDrift(rowIndices) = pOffsetsParameter.offsets.Drift(fnames{i});
else
d.MeasuredSosoOffsetDate(rowIndices) = NaN;
d.MeasuredSosoOffset(rowIndices) = NaN;
d.MeasuredSosoDrift(rowIndices) = NaN;
end
d.EmpiricalSosoOffsetDate(rowIndices) = artoa.convert.dmy2rd( ...
pSoundsources.(fnames{i}).empiric_offset(3), ...
pSoundsources.(fnames{i}).empiric_offset(2), ...
pSoundsources.(fnames{i}).empiric_offset(1) ...
);
d.EmpiricalSosoOffset(rowIndices) = pSoundsources.(fnames{i}).empiric_offset(4);
d.EmpiricalSosoDrift(rowIndices) = pSoundsources.(fnames{i}).empiric_drift;
d.Float(rowIndices) = num2str(floatDetails.floatname);
d.MeasuredFloatOffsetDate(rowIndices) = pOffsetsParameter.offsets.DateEnd('Float');
d.MeasuredFloatOffset(rowIndices) = pOffsetsParameter.offsets.OffsetEnd('Float') - pOffsetsParameter.offsets.OffsetStart('Float');
d.MeasuredFloatDrift(rowIndices) = pOffsetsParameter.offsets.Drift('Float');
daysSinceFloatStart(rowIndices, 1) = ...
results.(fnames{i}).satDate ...
- artoa.convert.dmy2rd( ...
......@@ -162,12 +235,14 @@ a.Float = daysSinceFloatStart; % append float days since start
% Distances, aCore{:, :}, ones(size(daysSinceFloatStart)), daysSinceFloatStart ...
% ];
% remove all NaN from matrix
indicesToUse = all(~isnan(a{:, :}), 2) & all(aSoundsources{:, :} >= 0, 2) & ~isnan(b{:, :});
a = a(indicesToUse, :);
b = b(indicesToUse, :);
c = c(indicesToUse, :);
d = d(indicesToUse, :);
% reenable warning
warning('on');
......
function [A, B, X, unfilteredA, unfilteredB] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pLeapsecondsMatrix, pOffsetsParameter, pSoundvelocity)
function [A, B, X, unfilteredA, unfilteredB, D] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pLeapsecondsMatrix, pOffsetsParameter, pSoundvelocity)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%% Construct matrices A, B and C
[unfilteredA, unfilteredB, unfilteredC] = artoa.offsets.createCalculationTables( ...
[unfilteredA, unfilteredB, unfilteredC, D] = artoa.offsets.createCalculationTables( ...
pRfb, ...
pSoundsources, ...
pTrackingParameter, ...
pOffsetsParameter, ...
pToaData, ...
pSatData, ...
pSoundvelocity, ...
......
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