Compare commits

..

1 Commits

Author SHA1 Message Date
b5304a8ab8 'README.md' updaten 2021-07-03 16:16:46 +02:00
4 changed files with 8 additions and 77 deletions

View File

@@ -1,68 +0,0 @@
function [locsTurns,FilteredData] = DetermineLocationTurnsFunc(inputData,FS,ApplyRealignment,plotit,Distance)
% Description: Determine the location of turns, plot for visual inspection
% Input: Acc Data (not yet realigned)
%Realign sensor data to VT-ML-AP frame
if ApplyRealignment % apply relignment as described in Rispens S, Pijnappels M, van Schooten K, Beek PJ, Daffertshofer A, van Die?n JH (2014).
data = inputData(:,[3,2,4]); % reorder data to 1 = V; 2 = ML; 3 = AP
% Consistency of gait characteristics as determined from acceleration data collected at different trunk locations. Gait Posture 2014;40(1):187-92.
[RealignedAcc, ~] = RealignSensorSignalHRAmp(data, FS);
dataAcc = RealignedAcc;
end
% Filter data
[B,A] = butter(2,3/(FS/2),'low'); % Filters data very strongly which is needed to determine turns correctly
dataStepDetection = filtfilt(B,A,dataAcc);
% Determine steps
% Explanation of method: https://nl.mathworks.com/help/supportpkg/beagleboneblue/ref/counting-steps-using-beagleboneblue-hardware-example.html
% From website: To convert the XYZ acceleration vectors at each point in time into scalar values,
% calculate the magnitude of each vector. This way, you can detect large changes in overall acceleration,
% such as steps taken while walking, regardless of device orientation.
magfilt = sqrt(sum((dataStepDetection(:,1).^2) + (dataStepDetection(:,2).^2) + (dataStepDetection(:,3).^2), 2));
magNoGfilt = magfilt - mean(magfilt);
minPeakHeight2 = 1.2*std(magNoGfilt); % based on visual inspection, parameter tuning was performed on standard deviation from MInPeak (used to be 1 SD)
[pks, locs] = findpeaks(magNoGfilt, 'MINPEAKHEIGHT', minPeakHeight2); % for step detection
numStepsOption2_filt = numel(pks); % counts number of steps;
diffLocs = diff(locs); % calculates difference in step location
avg_diffLocs = mean(diffLocs); % average distance between steps
std_diffLocs = std(diffLocs); % standard deviation of distance between steps
figure;
findpeaks(diffLocs, 'MINPEAKHEIGHT', avg_diffLocs, 'MINPEAKDISTANCE',9); % these values have been chosen based on visual inspection of the signal
line([1 length(diffLocs)],[avg_diffLocs avg_diffLocs])
[pks_diffLocs, locs_diffLocs] = findpeaks(diffLocs, 'MINPEAKHEIGHT', avg_diffLocs,'MINPEAKDISTANCE',10); % values were initially 5
locsTurns = [locs(locs_diffLocs), locs(locs_diffLocs+1)];
magNoGfilt_copy = magNoGfilt;
for k = 1: size(locsTurns,1);
magNoGfilt_copy(locsTurns(k,1):locsTurns(k,2)) = NaN;
end
% Visualising signal;
if plotit
figure;
subplot(2,1,1)
hold on;
plot(magNoGfilt,'b')
plot(magNoGfilt_copy, 'r');
title('Inside Straight: Filtered data with turns highlighted in blue')
line([6000,12000,18000,24000,30000,36000;6000,12000,18000,24000,30000,36000],[-4,-4,-4,-4,-4,-4;4,4,4,4,4,4],'LineWidth',2,'Linestyle','--','color','k')
% hold on;
% for m = 1:size(locsTurns,1)
% plot(locsTurns(m),DataStraight.([char(Participants(i))]).LyapunovPerStrideRosen_ML(:,m),'--gs',...
% 'LineWidth',2,...
% 'MarkerSize',10,...
% 'MarkerEdgeColor','g',...
% 'MarkerFaceColor',[0.5,0.5,0.5])
% end
hold off;
end
% Check if number of turns * 20 m are making sense based on total
% distance measured by researcher.
disp(['Number of turns detected = ' num2str(size(locsTurns,1))])
disp(['Total distance measured by researcher was = ' num2str(Distance)])
FilteredData = dataAcc;
end

View File

@@ -2,7 +2,7 @@ function [ResultStruct] = GaitOutcomesTrunkAccFuncIH(inputData,FS,LegLength,Wind
% DESCRIPTON: Trunk analysis of Iphone data without the need for step detection % DESCRIPTON: Trunk analysis of Iphone data without the need for step detection
% CL Nov 2019 % CL Nov 2019
% Adapted LD feb 2021 (IH feb 2020) % Adapted IH feb-april 2020
% koloms data of smartphone % koloms data of smartphone
% 1st column is time data; % 1st column is time data;
@@ -73,7 +73,7 @@ end
%% Step dectection %% Step dectection
% Determines the number of steps in the signal so that the first 1 and last step in the signal can be removed % Determines the number of steps in the signal so that the first 30 and last 30 steps in the signal can be removed
if ApplyRemoveSteps if ApplyRemoveSteps
@@ -90,9 +90,9 @@ if ApplyRemoveSteps
LocsSteps = PksAndLocsCorrected(1:2:end,2); LocsSteps = PksAndLocsCorrected(1:2:end,2);
%% Cut data & remove currents results %% Cut data & remove currents results
% Remove 1 step in the beginning and end of data % Remove 20 steps in the beginning and end of data
dataAccCut = dataAcc(LocsSteps(1):LocsSteps(end-1),:); dataAccCut = dataAcc(LocsSteps(31):LocsSteps(end-30),:);
dataAccCut_filt = dataAcc_filt(LocsSteps(1):LocsSteps(end-1),:); dataAccCut_filt = dataAcc_filt(LocsSteps(31):LocsSteps(end-30),:);
% Clear currently saved results from Autocorrelation Analysis % Clear currently saved results from Autocorrelation Analysis
@@ -100,9 +100,6 @@ if ApplyRemoveSteps
clear PksAndLocsCorrected; clear PksAndLocsCorrected;
clear LocsSteps; clear LocsSteps;
% Change window length if ApplyRemoveSteps (16-2-2021 LD)
WindowLen = size(dataAccCut,1);
else; else;
dataAccCut = dataAcc; dataAccCut = dataAcc;
dataAccCut_filt = dataAcc_filt; dataAccCut_filt = dataAcc_filt;

Binary file not shown.

View File

@@ -1,3 +1,5 @@
# MAP_Gait_Dynamics # MAP_Gait_Dynamics
This GIT respository contains all files needed for an adequate analysis of the gait (6MWT) accelerometer data. This GIT respository contains all files needed for the analysis of the gait (6MWT) accelerometer data.
Main file (including all comments) = 'Main_GaitVariabilityAnalysis_LD'