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

Removed unused files.

parent 89c044b4
No related branches found
No related tags found
No related merge requests found
function [segmentPositions, segmentDates] = calculateCombinationSegmentLeastSquares(pCorrectedData, pCombinationDetails, pFloatReferenceTime, pSoundVelocity)
%CALCULATECOMBINATIONSEGMENTLEASTSQUARES Summary of this function goes here
% Detailed explanation goes here
%% Get sound sources
soundsourceNames = strsplit(pCombinationDetails.soundsources{1}, ' ');
%% Get start and end point
segmentStart = pCombinationDetails{1, 1};
segmentEnd = pCombinationDetails{1, 2};
%% Filter toa data
intersectedToaDates = pCorrectedData.(soundsourceNames{1}).toaDate;
soundsourcePositions = [pCorrectedData.(soundsourceNames{1}).position];
for i = 2:length(soundsourceNames)
[intersectedToaDates] = intersect(intersectedToaDates, pCorrectedData.(soundsourceNames{i}).toaDate);
soundsourcePositions = [soundsourcePositions; pCorrectedData.(soundsourceNames{i}).position];
end
%% Remove all dates that are out of bounds
intersectedToaDates = intersectedToaDates( ...
intersectedToaDates >= segmentStart ...
& intersectedToaDates <= segmentEnd ...
);
distanceToSoundsources = {};
%segmentPositions = [pStartposition];
segmentPositions = cellfun(@str2double, strsplit(pCombinationDetails.referencePosition{1}));
for oDates = 1:length(intersectedToaDates)
currentDateValue = intersectedToaDates(oDates);
distanceToSoundsources{oDates} = [];
for i = 1:length(soundsourceNames)
currentName = soundsourceNames{i};
selection = pCorrectedData.(currentName).toaDate == currentDateValue;
filteredValue = pCorrectedData.(currentName).toa(selection);
%filteredData.(currentName).toa(oDates) = filteredValue(1);
%filteredValue = pCorrectedData.(currentName).toaDate(selection);
%filteredData.(currentName).toaDate(oDates) = filteredValue(1);
relativeToa = ( ...
filteredValue(1) ...
+ (pFloatReferenceTime(1) * 60 + pFloatReferenceTime(2)) * 60 ...
- (pCorrectedData.(currentName).soundsourceReferenceTime(1) * 3600 + pCorrectedData.(currentName).soundsourceReferenceTime(2) * 60 - pCorrectedData.(currentName).leapseconds) ...
);
windowStartTime = ...
pFloatReferenceTime(1) * 3600 ...
+ pFloatReferenceTime(2) * 60 ...
- pCorrectedData.(currentName).soundsourceReferenceTime(1) * 3600 ...
- pCorrectedData.(currentName).soundsourceReferenceTime(2) * 60;
leapseconds = pCorrectedData.(currentName).leapseconds;
floatWindowStart = pCorrectedData.(currentName).floatWindowStart * 60;
relativeToa = filteredValue(1) ...
+ windowStartTime ...
+ leapseconds ...
- floatWindowStart;
% calculate distance to the source
distanceToSoundsources{oDates} = [ ...
distanceToSoundsources{oDates}; ...
relativeToa * (pSoundVelocity/1000)
];
% distanceToSoundsources{oDates} = [ ...
% distanceToSoundsources{oDates}; ...
% (...
% filteredValue(1) ... %filteredData.(currentName).toa(oDates) ...
% + (pFloatReferenceTime(1) * 60 + pFloatReferenceTime(2)) * 60 ...
% - (pCorrectedData.(currentName).soundsourceReferenceTime(1) * 3600 + pCorrectedData.(currentName).soundsourceReferenceTime(2) * 60 - pCorrectedData.(currentName).leapseconds) ...
% ) * (pSoundVelocity/1000)
% ];
end
end
for oDates = 1:length(intersectedToaDates)
segmentPositions = [segmentPositions; ...
rad2deg(artoa.vendor.ls_converge(segmentPositions(end, :), length(soundsourceNames), soundsourcePositions, distanceToSoundsources{oDates}, pSoundVelocity/1000)) ...
];
end
%% Store toa dates
segmentDates = intersectedToaDates;
%% Remove reference position from trajectory
segmentPositions = segmentPositions(2:end, :);
end
function [trajectory, trajectoryDates] = calculateTrajectoryLeastSquares(pPreparedData, pSoundsourceCombinations, pFloatReferenceTime, pSoundVelocity)
%CALCULATETRAJECTORYLEASTSQUARES Summary of this function goes here
% Detailed explanation goes here
trajectory = [];
trajectoryDates = [];
%trajectory = pStartPosition;
for oCombination = 1:size(pSoundsourceCombinations, 1)
[segmentPositions, segmentDates] = artoa.data.calculateCombinationSegmentLeastSquares( ...
pPreparedData, ...
pSoundsourceCombinations(oCombination, :), ...%trajectory(end, :), ...
pFloatReferenceTime, ...
pSoundVelocity.soundspeed1(oCombination) ...
);
trajectory = [ ...
trajectory; ...
segmentPositions ...
];
trajectoryDates = [trajectoryDates; segmentDates];
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