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

The new empirical values are pulled from the soundsource file.

parent 067a7b6f
No related branches found
No related tags found
No related merge requests found
233 234
\ No newline at end of file \ No newline at end of file
...@@ -68,8 +68,11 @@ if iscell(pSoundsources) ...@@ -68,8 +68,11 @@ if iscell(pSoundsources)
offsetTable{i + 1, variableNames{2}}, ... offsetTable{i + 1, variableNames{2}}, ...
offsetTable{i + 1, variableNames{3}}, ... offsetTable{i + 1, variableNames{3}}, ...
offsetTable{i + 1, variableNames{4}}, ... offsetTable{i + 1, variableNames{4}}, ...
offsetTable{i + 1, variableNames{5}} ... offsetTable{i + 1, variableNames{5}}, ...
offsetTable{i + 1, variableNames{6}} ...
] = extract(pSoundsources{i}); ] = extract(pSoundsources{i});
offsetTable{i + 1, variableNames{7}} = ...
artoa.data.getMember(pSoundsources{i}, {'empiric_drift'}, NaN);
end end
end end
...@@ -88,12 +91,13 @@ if isstruct(pSoundsources) ...@@ -88,12 +91,13 @@ if isstruct(pSoundsources)
end end
end end
function [startDate, startOffset, endDate, endOffset, drift] = extract(pSoundsource) function [startDate, startOffset, endDate, endOffset, drift, empiric_offset] = extract(pSoundsource)
startDate = NaN; startDate = NaN;
startOffset = NaN; startOffset = NaN;
endDate = NaN; endDate = NaN;
endOffset = NaN; endOffset = NaN;
drift = NaN; drift = NaN;
empiric_offset = NaN;
% start date and offset % start date and offset
paramOffset = artoa.data.getMember(pSoundsource, {'offset'}, false); paramOffset = artoa.data.getMember(pSoundsource, {'offset'}, false);
if ~islogical(paramOffset) if ~islogical(paramOffset)
...@@ -129,6 +133,10 @@ end ...@@ -129,6 +133,10 @@ end
end end
end end
end end
% check if empiric offset is available
if length(pSoundsource.empiric_offset) == 4
empiric_offset = pSoundsource.empiric_offset(4);
end
end end
end end
......
...@@ -2,7 +2,7 @@ function [defaultRow] = getDefaultRowValues() ...@@ -2,7 +2,7 @@ function [defaultRow] = getDefaultRowValues()
%GETDEFAULTROW Summary of this function goes here %GETDEFAULTROW Summary of this function goes here
% Detailed explanation goes here % Detailed explanation goes here
defaultRow = {NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN}; defaultRow = {NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN};
end end
...@@ -8,6 +8,8 @@ defaultVariableNames = { ... ...@@ -8,6 +8,8 @@ defaultVariableNames = { ...
'DateEnd', ... 'DateEnd', ...
'OffsetEnd', ... 'OffsetEnd', ...
'Drift', ... 'Drift', ...
'EmpiricalOffset', ...
'EmpiricalDrift', ...
'OptimumTotalOffset', ... 'OptimumTotalOffset', ...
'OptimumTotalDrift', ... 'OptimumTotalDrift', ...
'AppliedOffset', ... 'AppliedOffset', ...
......
%% Rename Empirical to Applied
if ~artoa.data.hasMember(artoaWorkspace, 'editOffsets', 'offsets', 'EmpiricalOffset')
artoaWorkspace.editOffsets.offsets = addvars( ...
artoaWorkspace.editOffsets.offsets, ...
getEmpiricOffset4234(artoaWorkspace.editOffsets.offsets), ...
'NewVariableNames', {'EmpiricOffset'}, ...
'After', 5 ...
);
end
if ~artoa.data.hasMember(artoaWorkspace, 'editOffsets', 'offsets', 'EmpiricalDrift')
artoaWorkspace.editOffsets.offsets = addvars( ...
artoaWorkspace.editOffsets.offsets, ...
getEmpiricDrift4234(artoaWorkspace.editOffsets.offsets), ...
'NewVariableNames', {'EmpiricDrift'}, ...
'After', 6 ...
);
end
%% Helper functions
function [empiricalOffset] = getEmpiricOffset4234(pOffsetTable)
soundsources = artoa.controller.getSoundsourcesWithAppliedToa();
fnames = fieldnames(soundsources);
empiricalOffset = NaN(size(pOffsetTable, 1), 1);
% get all empirical offsets of soundsources
for i = 1:length(fnames)
if length(soundsources.(fnames{i}).empiric_offset) < 4
continue;
end
end
end
function [empiricalDrift] = getEmpiricDrift4234(pOffsetTable)
soundsources = artoa.controller.getSoundsourcesWithAppliedToa();
fnames = fieldnames(soundsources);
empiricalDrift = NaN(size(pOffsetTable, 1), 1);
% get all empirical offsets of soundsources
for i = 1:length(fnames)
empiricalDrift(i+1) = artoa.data.getMember(soundsources, {fnames{i}, 'empiric_drift'}, NaN);
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