{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tremor analysis" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This tutorial shows how to run the tremor pipeline on prepared IMU or gyroscope data to obtain aggregated tremor measures." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load example data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Example IMU data (8 minutes) from a participant of the Personalized Parkinson Project is loaded. The data was prepared as explained in the data preparation tutorial. The prepared data contains both accelerometer and gyroscope data, but only gyroscope data is necessary for running the tremor pipeline." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | time | \n", "accelerometer_x | \n", "accelerometer_y | \n", "accelerometer_z | \n", "gyroscope_x | \n", "gyroscope_y | \n", "gyroscope_z | \n", "
---|---|---|---|---|---|---|---|
0 | \n", "0.00000 | \n", "0.550718 | \n", "0.574163 | \n", "-0.273684 | \n", "-115.670732 | \n", "32.012195 | \n", "-26.097561 | \n", "
1 | \n", "0.01004 | \n", "0.535885 | \n", "0.623445 | \n", "-0.254545 | \n", "-110.609757 | \n", "34.634146 | \n", "-24.695122 | \n", "
2 | \n", "0.02008 | \n", "0.504306 | \n", "0.651675 | \n", "-0.251675 | \n", "-103.231708 | \n", "36.768293 | \n", "-22.926829 | \n", "
3 | \n", "0.03012 | \n", "0.488517 | \n", "0.686603 | \n", "-0.265550 | \n", "-96.280488 | \n", "38.719512 | \n", "-21.158537 | \n", "
4 | \n", "0.04016 | \n", "0.494258 | \n", "0.725359 | \n", "-0.278469 | \n", "-92.560976 | \n", "41.280488 | \n", "-20.304878 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
72942 | \n", "730.74468 | \n", "0.234928 | \n", "-0.516268 | \n", "-0.802871 | \n", "0.975610 | \n", "-2.256098 | \n", "2.256098 | \n", "
72943 | \n", "730.75472 | \n", "0.245455 | \n", "-0.514354 | \n", "-0.806699 | \n", "0.304878 | \n", "-1.707317 | \n", "1.768293 | \n", "
72944 | \n", "730.76476 | \n", "0.243541 | \n", "-0.511005 | \n", "-0.807177 | \n", "0.304878 | \n", "-1.585366 | \n", "1.890244 | \n", "
72945 | \n", "730.77480 | \n", "0.240191 | \n", "-0.514354 | \n", "-0.808134 | \n", "0.000000 | \n", "-1.280488 | \n", "1.585366 | \n", "
72946 | \n", "730.78484 | \n", "0.243541 | \n", "-0.511005 | \n", "-0.808134 | \n", "-0.060976 | \n", "-1.036585 | \n", "1.219512 | \n", "
72947 rows × 7 columns
\n", "\n", " | time | \n", "gyroscope_x | \n", "gyroscope_y | \n", "gyroscope_z | \n", "
---|---|---|---|---|
0 | \n", "0.00 | \n", "-115.670732 | \n", "32.012195 | \n", "-26.097561 | \n", "
1 | \n", "0.01 | \n", "-110.636301 | \n", "34.624710 | \n", "-24.701537 | \n", "
2 | \n", "0.02 | \n", "-103.292766 | \n", "36.753000 | \n", "-22.942002 | \n", "
3 | \n", "0.03 | \n", "-96.349062 | \n", "38.692931 | \n", "-21.175227 | \n", "
4 | \n", "0.04 | \n", "-92.585735 | \n", "41.237328 | \n", "-20.311531 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
73074 | \n", "730.74 | \n", "1.150220 | \n", "-2.561552 | \n", "2.440945 | \n", "
73075 | \n", "730.75 | \n", "0.588721 | \n", "-1.917765 | \n", "1.948620 | \n", "
73076 | \n", "730.76 | \n", "0.270257 | \n", "-1.626831 | \n", "1.813725 | \n", "
73077 | \n", "730.77 | \n", "0.185022 | \n", "-1.451942 | \n", "1.793145 | \n", "
73078 | \n", "730.78 | \n", "-0.133645 | \n", "-1.112332 | \n", "1.347580 | \n", "
73079 rows × 4 columns
\n", "\n", " | time | \n", "mfcc_1 | \n", "mfcc_2 | \n", "mfcc_3 | \n", "mfcc_4 | \n", "mfcc_5 | \n", "mfcc_6 | \n", "mfcc_7 | \n", "mfcc_8 | \n", "mfcc_9 | \n", "mfcc_10 | \n", "mfcc_11 | \n", "mfcc_12 | \n", "freq_peak | \n", "below_tremor_power | \n", "tremor_power | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0.0 | \n", "11.407993 | \n", "1.854440 | \n", "0.335866 | \n", "0.319960 | \n", "0.026209 | \n", "0.071381 | \n", "0.118471 | \n", "0.116478 | \n", "-0.029843 | \n", "0.052588 | \n", "-0.053722 | \n", "0.012292 | \n", "1.00 | \n", "13277.614531 | \n", "1020.094627 | \n", "
1 | \n", "4.0 | \n", "10.043115 | \n", "2.011087 | \n", "0.462899 | \n", "0.468260 | \n", "-0.110635 | \n", "0.151994 | \n", "-0.078799 | \n", "0.112665 | \n", "0.081837 | \n", "0.037202 | \n", "-0.034632 | \n", "-0.042053 | \n", "1.25 | \n", "1310.703842 | \n", "87.538668 | \n", "
2 | \n", "8.0 | \n", "8.877666 | \n", "2.008945 | \n", "0.485860 | \n", "0.274370 | \n", "0.064770 | \n", "-0.149113 | \n", "-0.130340 | \n", "0.050427 | \n", "0.023477 | \n", "0.096070 | \n", "0.074539 | \n", "0.020284 | \n", "3.50 | \n", "215.567337 | \n", "56.805816 | \n", "
3 | \n", "12.0 | \n", "10.554189 | \n", "2.206457 | \n", "0.528599 | \n", "0.410778 | \n", "0.012854 | \n", "0.101787 | \n", "0.085519 | \n", "0.102281 | \n", "0.073039 | \n", "0.094114 | \n", "-0.044519 | \n", "0.073097 | \n", "1.00 | \n", "7808.868582 | \n", "566.219495 | \n", "
4 | \n", "16.0 | \n", "11.051087 | \n", "1.628075 | \n", "0.159574 | \n", "0.268279 | \n", "0.110523 | \n", "0.146418 | \n", "0.176130 | \n", "0.087930 | \n", "-0.038643 | \n", "0.035997 | \n", "-0.017965 | \n", "0.020223 | \n", "1.00 | \n", "3945.127377 | \n", "174.899788 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
177 | \n", "708.0 | \n", "6.180462 | \n", "1.558660 | \n", "0.520806 | \n", "0.407299 | \n", "-0.126574 | \n", "0.131888 | \n", "0.040739 | \n", "-0.007852 | \n", "-0.034759 | \n", "-0.012127 | \n", "-0.048380 | \n", "0.056300 | \n", "2.50 | \n", "4.952011 | \n", "0.397532 | \n", "
178 | \n", "712.0 | \n", "8.949686 | \n", "1.759538 | \n", "0.146314 | \n", "0.258097 | \n", "0.012388 | \n", "0.210405 | \n", "0.096675 | \n", "0.086521 | \n", "0.094405 | \n", "0.086109 | \n", "0.081392 | \n", "0.072370 | \n", "1.00 | \n", "570.735779 | \n", "32.044727 | \n", "
179 | \n", "716.0 | \n", "6.618968 | \n", "1.476363 | \n", "0.332030 | \n", "-0.039835 | \n", "-0.085920 | \n", "0.072537 | \n", "0.069817 | \n", "0.130373 | \n", "-0.043866 | \n", "0.003158 | \n", "-0.052160 | \n", "0.038509 | \n", "1.00 | \n", "3.990732 | \n", "1.261435 | \n", "
180 | \n", "720.0 | \n", "6.274967 | \n", "1.592159 | \n", "0.146655 | \n", "0.111758 | \n", "-0.087665 | \n", "-0.046542 | \n", "0.111900 | \n", "0.018244 | \n", "-0.041603 | \n", "-0.097095 | \n", "-0.061765 | \n", "0.045770 | \n", "2.50 | \n", "3.638188 | \n", "1.217930 | \n", "
181 | \n", "724.0 | \n", "6.384021 | \n", "1.438339 | \n", "0.099644 | \n", "0.061810 | \n", "-0.184136 | \n", "-0.016639 | \n", "-0.052482 | \n", "0.006177 | \n", "0.099365 | \n", "-0.059942 | \n", "-0.016524 | \n", "-0.010869 | \n", "3.00 | \n", "1.664200 | \n", "1.054432 | \n", "
182 rows × 16 columns
\n", "\n", " | time | \n", "pred_tremor_proba | \n", "pred_tremor_logreg | \n", "pred_arm_at_rest | \n", "pred_tremor_checked | \n", "
---|---|---|---|---|---|
0 | \n", "0.0 | \n", "0.001765 | \n", "0 | \n", "0 | \n", "0 | \n", "
1 | \n", "4.0 | \n", "0.001402 | \n", "0 | \n", "0 | \n", "0 | \n", "
2 | \n", "8.0 | \n", "0.001146 | \n", "0 | \n", "0 | \n", "0 | \n", "
3 | \n", "12.0 | \n", "0.001356 | \n", "0 | \n", "0 | \n", "0 | \n", "
4 | \n", "16.0 | \n", "0.001618 | \n", "0 | \n", "0 | \n", "0 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
177 | \n", "708.0 | \n", "0.000136 | \n", "0 | \n", "1 | \n", "0 | \n", "
178 | \n", "712.0 | \n", "0.003822 | \n", "0 | \n", "0 | \n", "0 | \n", "
179 | \n", "716.0 | \n", "0.001298 | \n", "0 | \n", "1 | \n", "0 | \n", "
180 | \n", "720.0 | \n", "0.001217 | \n", "0 | \n", "1 | \n", "0 | \n", "
181 | \n", "724.0 | \n", "0.005037 | \n", "0 | \n", "1 | \n", "0 | \n", "
182 rows × 5 columns
\n", "