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

Added buttons for copying from measured and optimum to empirical, added fixed soundspeed option.

parent 71470d9b
No related branches found
No related tags found
No related merge requests found
115 116
\ No newline at end of file \ No newline at end of file
...@@ -24,11 +24,15 @@ satData = artoaWorkspace.satData; ...@@ -24,11 +24,15 @@ satData = artoaWorkspace.satData;
satData, ... satData, ...
artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ... artoaWorkspace.temperature(artoaWorkspace.statusTemperature == 1), ...
artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ... artoaWorkspace.pressure(artoaWorkspace.statusPressure == 1), ...
artoa.data.getMember(artoaDataInput, {'ini', 'leapseconds'}) ... artoa.data.getMember(artoaDataInput, {'ini', 'leapseconds'}), ...
artoaWorkspace.editOffsets ...
); );
%% Store offsets in table %% Store offsets in table
[offsets, drifts] = artoa.offsets.extractOffsetsDriftsFromSolved(artoaWorkspace.editOffsets.calculatedMatrixX); [offsets, drifts] = artoa.offsets.extractOffsetsDriftsFromSolved( ...
artoaWorkspace.editOffsets.calculatedMatrixX, ...
artoaWorkspace.editOffsets.useFixedSoundspeed ...
);
soundsourceNames = fieldnames(artoa.controller.getSoundsourcesWithAppliedToa()); soundsourceNames = fieldnames(artoa.controller.getSoundsourcesWithAppliedToa());
for o = 1:length(soundsourceNames) for o = 1:length(soundsourceNames)
......
function [] = buttonCopyFromMeasured(~, ~)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace;
%% Copy from optimum total offset columns to empirical columns
% store float in table
artoaWorkspace.editOffsets.offsets{:, 'EmpiricalOffset'} = artoaWorkspace.editOffsets.offsets{:, 'OffsetStart'};
artoaWorkspace.editOffsets.offsets{:, 'EmpiricalDrift'} = artoaWorkspace.editOffsets.offsets{:, 'Drift'};
%% Update GUI
artoa.controller.edit.offsets.updateGui();
end
function [] = buttonCopyFromOptimum(~, ~)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace;
%% Copy from optimum total offset columns to empirical columns
% store float in table
artoaWorkspace.editOffsets.offsets{:, 'EmpiricalOffset'} = artoaWorkspace.editOffsets.offsets{:, 'OptimumTotalOffset'};
artoaWorkspace.editOffsets.offsets{:, 'EmpiricalDrift'} = artoaWorkspace.editOffsets.offsets{:, 'OptimumTotalDrift'};
%% Update GUI
artoa.controller.edit.offsets.updateGui();
end
...@@ -19,6 +19,9 @@ callbacks.buttonCalculateOffsets = @artoa.controller.edit.offsets.buttonCalculat ...@@ -19,6 +19,9 @@ callbacks.buttonCalculateOffsets = @artoa.controller.edit.offsets.buttonCalculat
callbacks.checkboxUseOffsets = @artoa.controller.edit.offsets.checkboxUseOffsets; callbacks.checkboxUseOffsets = @artoa.controller.edit.offsets.checkboxUseOffsets;
callbacks.checkboxFixedSoundspeed = @artoa.controller.edit.offsets.checkboxFixedSoundspeed; callbacks.checkboxFixedSoundspeed = @artoa.controller.edit.offsets.checkboxFixedSoundspeed;
callbacks.inputSoundspeed = @artoa.controller.edit.offsets.inputSoundspeed; callbacks.inputSoundspeed = @artoa.controller.edit.offsets.inputSoundspeed;
callbacks.buttonCopyFromOptimum = @artoa.controller.edit.offsets.buttonCopyFromOptimum;
callbacks.buttonCopyFromMeasured = @artoa.controller.edit.offsets.buttonCopyFromMeasured;
%% Open the gui %% Open the gui
artoa.gui.edit.offsets(callbacks); artoa.gui.edit.offsets(callbacks);
......
...@@ -31,5 +31,12 @@ for i = 1:length(fieldNames) ...@@ -31,5 +31,12 @@ for i = 1:length(fieldNames)
end end
end end
%% Update soundspeed field
if artoaWorkspace.editOffsets.useFixedSoundspeed
artoaGui.editOffsets.textOptimumSoundspeedValue.String = num2str(artoaWorkspace.editOffsets.fixedSoundspeed);
elseif artoa.data.hasMember(artoaWorkspace, {'editOffsets', 'calculatedMatrixX'})
artoaGui.editOffsets.textOptimumSoundspeedValue.String = num2str(artoaWorkspace.editOffsets.calculatedMatrixX(1));
end
end end
...@@ -16,7 +16,9 @@ availableCallbacks = { ... ...@@ -16,7 +16,9 @@ availableCallbacks = { ...
'buttonCalculateOffsets', ... 'buttonCalculateOffsets', ...
'checkboxUseOffsets', ... 'checkboxUseOffsets', ...
'checkboxFixedSoundspeed', ... 'checkboxFixedSoundspeed', ...
'inputSoundspeed' ... 'inputSoundspeed', ...
'buttonCopyFromOptimum', ...
'buttonCopyFromMeasured' ...
}; };
for i = 1:length(availableCallbacks) % check if a callback is undefined for i = 1:length(availableCallbacks) % check if a callback is undefined
...@@ -90,6 +92,26 @@ artoaGui.editOffsets.checkboxUseOffsets = uicontrol( ... ...@@ -90,6 +92,26 @@ artoaGui.editOffsets.checkboxUseOffsets = uicontrol( ...
'CallBack', pCallbacks.checkboxUseOffsets ... 'CallBack', pCallbacks.checkboxUseOffsets ...
); );
artoaGui.editOffsets.buttonCopyFromMeasured = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'String', 'Copy Measured to Empirical', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .5 fullwidth/2 .2], ...
'CallBack', pCallbacks.buttonCopyFromMeasured ...
);
artoaGui.editOffsets.buttonCopyFromOptimum = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'String', 'Copy Optimum to Empirical', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .25 fullwidth/2 .2], ...
'CallBack', pCallbacks.buttonCopyFromOptimum ...
);
%% Soundspeed frame %% Soundspeed frame
artoaGui.editOffsets.frameSoundspeed = uipanel( ... artoaGui.editOffsets.frameSoundspeed = uipanel( ...
'Parent', artoaGui.figures.editOffsets, ... 'Parent', artoaGui.figures.editOffsets, ...
......
function [offsets, drifts] = extractOffsetsDriftsFromSolved(pX) function [offsets, drifts] = extractOffsetsDriftsFromSolved(pX, useFixedSoundspeed)
%EXTRACTOFFSETSDRIFTSFROMSOLVED Extracts the vectors in a specific manner. %EXTRACTOFFSETSDRIFTSFROMSOLVED Extracts the vectors in a specific manner.
% Creates for each output a vector, that first value is belonging to the % Creates for each output a vector, that first value is belonging to the
% float, and all others following are belonging to the soundsources as % float, and all others following are belonging to the soundsources as
% they are returned from the % they are returned from the
% artoa.controller.getSoundsourcesWithAppliedToa function. % artoa.controller.getSoundsourcesWithAppliedToa function.
soundsourceCount = (length(pX) - 3) / 2; if useFixedSoundspeed
additionalParameter = 2; % only float offset and drift
else
additionalParameter = 3; % float offset and drift, as well as soundspeed
end
soundsourceCount = (length(pX) - additionalParameter) / 2;
offsets = NaN(soundsourceCount + 1, 1); offsets = NaN(soundsourceCount + 1, 1);
drifts = NaN(soundsourceCount + 1, 1); drifts = NaN(soundsourceCount + 1, 1);
...@@ -13,9 +19,9 @@ drifts = NaN(soundsourceCount + 1, 1); ...@@ -13,9 +19,9 @@ drifts = NaN(soundsourceCount + 1, 1);
offsets(1) = pX(end - 1); offsets(1) = pX(end - 1);
drifts(1) = pX(end); drifts(1) = pX(end);
for i = 2:2:(soundsourceCount * 2) for i = 1:soundsourceCount
offsets(i/2 + 1) = pX(i); offsets(i + 1) = pX((i-1)*2 + 1);
drifts(i/2 + 1) = pX(i + 1); drifts(i + 1) = pX((i-1)*2 + 2);
end end
end end
......
function [unfilteredA, unfilteredB, X, A, B] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pAppliedTemperature, pAppliedPressure, pLeapsecondsMatrix) function [unfilteredA, unfilteredB, X, A, B] = solve(pRfb, pSoundsources, pTrackingParameter, pToaData, pSatData, pAppliedTemperature, pAppliedPressure, pLeapsecondsMatrix, pOffsetsParameter)
%UNTITLED Summary of this function goes here %UNTITLED Summary of this function goes here
% Detailed explanation goes here % Detailed explanation goes here
%% Construct matrices A and B %% Construct matrices A and B
[unfilteredA, unfilteredB] = artoa.offsets.createCalculationMatrices(pRfb, ... [unfilteredA, unfilteredB] = artoa.offsets.createCalculationMatrices( ...
pRfb, ...
pSoundsources, ... pSoundsources, ...
pTrackingParameter, ... pTrackingParameter, ...
pToaData, ... pToaData, ...
...@@ -16,10 +17,14 @@ function [unfilteredA, unfilteredB, X, A, B] = solve(pRfb, pSoundsources, pTrack ...@@ -16,10 +17,14 @@ function [unfilteredA, unfilteredB, X, A, B] = solve(pRfb, pSoundsources, pTrack
%% Optimize matrices for calculation %% Optimize matrices for calculation
[A, B] = artoa.offsets.filterCalculationMatrices(unfilteredA, unfilteredB); [A, B] = artoa.offsets.filterCalculationMatrices(unfilteredA, unfilteredB);
if pOffsetsParameter.useFixedSoundspeed
A = A(:, 2:end);
B = B - A(:, 1) * pOffsetsParameter.fixedSoundspeed;
end
%% Solve it! %% Solve it!
X = pinv(A) * B; X = pinv(A) * B;
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