Commit 841b57d3 authored by Willi's avatar Willi
Browse files

initial commit. able to run the training of the transformer

parents
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8 (Ex3_solution)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (Ex3_solution)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Ex3_solution.iml" filepath="$PROJECT_DIR$/.idea/Ex3_solution.iml" />
</modules>
</component>
</project>
\ No newline at end of file
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
\ No newline at end of file
This diff is collapsed.
from DataLoadingAPI.RecordingH5TxtMapper import mapRecordingsToFiles
from DataLoadingAPI.RecordingFlyweight import RecordingFlyweight
from DataLoadingAPI.sensorDataKeys import getIMUKeys
from tecohelper.hfilehelper import H5FileHelper
from tecohelper.anvilhelper import AnvilHelper
import pandas as pd
import time
import matplotlib.pyplot as plt
h5FilePath = 'C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\TECO_Praktikum_SS2020\\Proband5\\data_recording_clap_annotated.h5'
anvilExportFilePath = 'C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\TECO_Praktikum_SS2020\\Proband5\\17-16-05.txt'
helper = H5FileHelper(h5FilePath)
recordings = helper.recordings
recordings.sort()
anvilHelper = AnvilHelper(h5FilePath, recordings[0],anvilExportFilePath)
dct = mapRecordingsToFiles("C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\Annotationen")
rf= RecordingFlyweight(dct)
def getMeanSeriesforAllKeys():
finalDf = pd.DataFrame()
for key in getIMUKeys():
df = rf.getMergedSeriesFromLeftIMUDF(key)
finalDf[key] = df.transpose().mean().transpose()
return finalDf
testDF = getMeanSeriesforAllKeys()
correlations =getMeanSeriesforAllKeys().corr()
print(correlations)
\ No newline at end of file
from DataLoadingAPI.RecordingH5TxtMapper import mapRecordingsToFiles
from DataLoadingAPI.RecordingFlyweight import RecordingFlyweight
from tecohelper.hfilehelper import H5FileHelper
from tecohelper.anvilhelper import AnvilHelper
import time
import matplotlib.pyplot as plt
h5FilePath = 'C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\TECO_Praktikum_SS2020\\Proband5\\data_recording_clap_annotated.h5'
anvilExportFilePath = 'C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\TECO_Praktikum_SS2020\\Proband5\\17-16-05.txt'
helper = H5FileHelper(h5FilePath)
recordings = helper.recordings
recordings.sort()
anvilHelper = AnvilHelper(h5FilePath, recordings[0],anvilExportFilePath)
dct = mapRecordingsToFiles("C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\Annotationen")
rf= RecordingFlyweight(dct)
flw = rf.getMergedSeriesFromLeftIMUDF("left_acc_y")
recording_index = 20
final_graph_data = flw.iloc[:,recording_index].dropna(how='all', axis=0)
final_graph_data.plot()
start = time.time()
final_length= len(final_graph_data.index)
take, drop = rf.getLabelSubsequences(recording_index,final_length)
labels1 = rf.getAdjustedLabelSequence(recording_index,final_length)
for seq in take:
plt.axvspan(seq[0], seq[len(seq)-1], color='red', alpha=0.5)
for seq in drop:
plt.axvspan(seq[0], seq[len(seq)-1], color='magenta', alpha=0.5)
plt.show()
print(rf.getLowerLevelLabelDurations('low-level.take-piece:piece_direction_on_table').transpose().mean().transpose().describe())
print(rf.getLowerLevelLabelDurations('low-level.drop-piece:bin_number').transpose().mean().transpose().describe())
end = time.time()
print(end-start)
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"pycharm": {
"is_executing": true
}
},
"outputs": [],
"source": [
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
\ No newline at end of file
This diff is collapsed.
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from DataLoadingAPI.RecordingH5TxtMapper import mapRecordingsToFiles\n",
"from DataLoadingAPI.RecordingFlyweight import RecordingFlyweight\n",
"from DataLoadingAPI.sensorDataKeys import getIMUKeys\n",
"from tecohelper.hfilehelper import H5FileHelper\n",
"from tecohelper.anvilhelper import AnvilHelper\n",
"import pandas as pd\n",
"import time\n",
"import matplotlib.pyplot as plt\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
" \n",
" \n",
" \n",
" \n"
]
}
],
"source": [
"dct = mapRecordingsToFiles(\"/home/ubuntu/Aufgabe3/Annotationen\")\n",
"rf= RecordingFlyweight(dct)\n",
"\n",
"\n",
"df = rf.getSingleRecordingDataFrameFromHipIMUDF(1)\n"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": 7,
"outputs": [],
"source": [
"def calculateAverageCorrelationForIMU(recordingFlyWeight):\n",
" firstdf1 = recordingFlyWeight.getSingleRecordingDataFrameFromHipIMUDF(0)[getIMUKeys()]\n",
" firstdf1.reset_index(inplace=True)\n",
" firstdf1.drop(['index'], axis=1, inplace=True)\n",
" firstdf = firstdf1.corr()\n",
"\n",
" for i in range(len(rf.recordingMap)-1):\n",
" summand1 = recordingFlyWeight.getSingleRecordingDataFrameFromHipIMUDF(i)[getIMUKeys()]\n",
" summand1.reset_index(inplace=True)\n",
"\n",
" summand1.drop(['index'], axis=1, inplace=True)\n",
" summand = summand1.corr()\n",
" firstdf = firstdf.add(summand)\n",
" return firstdf/len(rf.recordingMap)"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": 8,
"outputs": [
{
"ename": "KeyError",
"evalue": "\"['index'] not found in axis\"",
"output_type": "error",
"traceback": [
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mKeyError\u001B[0m Traceback (most recent call last)",
"\u001B[0;32m<ipython-input-8-2e08ad7ef0b8>\u001B[0m in \u001B[0;36m<module>\u001B[0;34m()\u001B[0m\n\u001B[1;32m 1\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m----> 2\u001B[0;31m \u001B[0mcorrelations\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mcalculateAverageCorrelationForIMU\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mrf\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 3\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n",
"\u001B[0;32m<ipython-input-7-2099a31fcf62>\u001B[0m in \u001B[0;36mcalculateAverageCorrelationForIMU\u001B[0;34m(recordingFlyWeight)\u001B[0m\n\u001B[1;32m 3\u001B[0m \u001B[0mfirstdf1\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mrecordingFlyWeight\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mgetSingleRecordingDataFrameFromHipIMUDF\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mgetIMUKeys\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 4\u001B[0m \u001B[0mfirstdf1\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mreset_index\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minplace\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;32mTrue\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m----> 5\u001B[0;31m \u001B[0mfirstdf1\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdrop\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m'index'\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0maxis\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;36m1\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minplace\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;32mTrue\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 6\u001B[0m \u001B[0mfirstdf\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mfirstdf1\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcorr\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 7\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n",
"\u001B[0;32m~/.local/lib/python3.6/site-packages/pandas/core/frame.py\u001B[0m in \u001B[0;36mdrop\u001B[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001B[0m\n\u001B[1;32m 3995\u001B[0m \u001B[0mlevel\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mlevel\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 3996\u001B[0m \u001B[0minplace\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0minplace\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m-> 3997\u001B[0;31m \u001B[0merrors\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0merrors\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 3998\u001B[0m )\n\u001B[1;32m 3999\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n",
"\u001B[0;32m~/.local/lib/python3.6/site-packages/pandas/core/generic.py\u001B[0m in \u001B[0;36mdrop\u001B[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001B[0m\n\u001B[1;32m 3934\u001B[0m \u001B[0;32mfor\u001B[0m \u001B[0maxis\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mlabels\u001B[0m \u001B[0;32min\u001B[0m \u001B[0maxes\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mitems\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 3935\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mlabels\u001B[0m \u001B[0;32mis\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;32mNone\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m-> 3936\u001B[0;31m \u001B[0mobj\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mobj\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_drop_axis\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mlabels\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0maxis\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mlevel\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mlevel\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0merrors\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0merrors\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 3937\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 3938\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0minplace\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n",
"\u001B[0;32m~/.local/lib/python3.6/site-packages/pandas/core/generic.py\u001B[0m in \u001B[0;36m_drop_axis\u001B[0;34m(self, labels, axis, level, errors)\u001B[0m\n\u001B[1;32m 3968\u001B[0m \u001B[0mnew_axis\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0maxis\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdrop\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mlabels\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mlevel\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mlevel\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0merrors\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0merrors\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 3969\u001B[0m \u001B[0;32melse\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m-> 3970\u001B[0;31m \u001B[0mnew_axis\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0maxis\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdrop\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mlabels\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0merrors\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0merrors\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 3971\u001B[0m \u001B[0mresult\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mreindex\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0;34m{\u001B[0m\u001B[0maxis_name\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mnew_axis\u001B[0m\u001B[0;34m}\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 3972\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n",
"\u001B[0;32m~/.local/lib/python3.6/site-packages/pandas/core/indexes/base.py\u001B[0m in \u001B[0;36mdrop\u001B[0;34m(self, labels, errors)\u001B[0m\n\u001B[1;32m 5016\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mmask\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0many\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 5017\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0merrors\u001B[0m \u001B[0;34m!=\u001B[0m \u001B[0;34m\"ignore\"\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m-> 5018\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0mKeyError\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34mf\"{labels[mask]} not found in axis\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 5019\u001B[0m \u001B[0mindexer\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mindexer\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m~\u001B[0m\u001B[0mmask\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 5020\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdelete\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mindexer\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n",
"\u001B[0;31mKeyError\u001B[0m: \"['index'] not found in axis\""
]
}
],
"source": [
"correlations = calculateAverageCorrelationForIMU(rf)"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"correlations.dropna(inplace=True)\n",
"correlations\n"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"recording_index = 3\n",
"\n",
"flw = rf.getSingleRecordingDataFrameFromLeftIMUDF(recording_index)\n",
"final_graph_data = flw[\"left_acc_x\"].dropna(how='all', axis=0)\n",
"cop = final_graph_data.reset_index()\n",
"firstTimeStamp = cop['index'][0]\n",
"\n",
"\n",
"def getTimeInSec(x):\n",
" delta = x - firstTimeStamp\n",
" return delta.total_seconds()\n",
"\n",
"\n",
"cop['timeInSec'] = cop['index'].apply(lambda x: getTimeInSec(x))\n",
"cop.set_index(keys=[\"timeInSec\"], inplace=True)\n",
"cop[\"left_acc_x\"].plot()\n",
"\n",
"take, drop = rf.getLabelSubsequences(recording_index)\n",
"print(take)\n",
"for seq in take:\n",
" plt.axvspan(seq[0], seq[len(seq)-1], color='red', alpha=0.5)\n",
"\n",
"for seq in drop:\n",
" plt.axvspan(seq[0], seq[len(seq)-1], color='purple', alpha=0.5)\n",
"\n",
"plt.show()"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"recording_index = 3\n",
"\n",
"flw = rf.getSingleRecordingDataFrameFromLeftIMUDF(recording_index)\n",
"final_graph_data = flw[\"right_acc_x\"].dropna(how='all', axis=0)\n",
"cop = final_graph_data.reset_index()\n",
"firstTimeStamp = cop['index'][0]\n",
"print(firstTimeStamp)\n",
"\n",
"def getTimeInSec(x):\n",
" delta = x - firstTimeStamp\n",
" return delta.total_seconds()\n",
"\n",
"\n",
"cop['timeInSec'] = cop['index'].apply(lambda x: getTimeInSec(x))\n",
"cop.set_index(keys=[\"timeInSec\"], inplace=True)\n",
"cop[\"right_acc_x\"].plot()\n",
"\n",
"\n",
"take, drop = rf.getLabelSubsequences(recording_index)\n",
"\n",
"for seq in take:\n",
" plt.axvspan(seq[0], seq[len(seq)-1], color='red', alpha=0.5)\n",
"\n",
"for seq in drop:\n",
" plt.axvspan(seq[0], seq[len(seq)-1], color='purple', alpha=0.5)\n",
"\n",
"plt.show()\n",
"\n",
"take\n",
"\n",
"mapList = list(rf.recordingMap.items())[recording_index]\n",
"mapList[0]"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"language": "python",
"display_name": "Python 3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
\ No newline at end of file
Metadata-Version: 1.0
Name: DataLoadingAPI
Version: 1.0
Summary: API for loading h5 based files using TECO-Helpers
Home-page: UNKNOWN
Author: Willi Becker
Author-email: utdjv@student.kit.edu
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
README.md
setup.py
DataLoadingAPI/DataLoadingExample.py
DataLoadingAPI/RecordingFlyweight.py
DataLoadingAPI/RecordingH5TxtMapper.py
DataLoadingAPI/sensorDataKeys.py
DataLoadingAPI.egg-info/PKG-INFO
DataLoadingAPI.egg-info/SOURCES.txt
DataLoadingAPI.egg-info/dependency_links.txt
DataLoadingAPI.egg-info/requires.txt
DataLoadingAPI.egg-info/top_level.txt
tecohelper/__init__.py
tecohelper/anvilhelper.py
tecohelper/config.py
tecohelper/hfilehelper.py
tecohelper/recording.py
\ No newline at end of file
..\DataLoadingAPI\DataLoadingExample.py
..\DataLoadingAPI\RecordingFlyweight.py
..\DataLoadingAPI\RecordingH5TxtMapper.py
..\DataLoadingAPI\__pycache__\DataLoadingExample.cpython-38.pyc
..\DataLoadingAPI\__pycache__\RecordingFlyweight.cpython-38.pyc
..\DataLoadingAPI\__pycache__\RecordingH5TxtMapper.cpython-38.pyc
..\DataLoadingAPI\__pycache__\sensorDataKeys.cpython-38.pyc
..\DataLoadingAPI\sensorDataKeys.py
..\tecohelper\__init__.py
..\tecohelper\__pycache__\__init__.cpython-38.pyc
..\tecohelper\__pycache__\anvilhelper.cpython-38.pyc
..\tecohelper\__pycache__\config.cpython-38.pyc
..\tecohelper\__pycache__\hfilehelper.cpython-38.pyc
..\tecohelper\__pycache__\recording.cpython-38.pyc
..\tecohelper\anvilhelper.py
..\tecohelper\config.py
..\tecohelper\hfilehelper.py
..\tecohelper\recording.py
PKG-INFO
SOURCES.txt
dependency_links.txt
requires.txt
top_level.txt
cycler==0.10.0
kiwisolver==1.2.0
matplotlib==3.2.1
numexpr==2.7.1
numpy==1.18.5
pandas==1.0.4
prompt-toolkit==1.0.14
Pygments
PyInquirer==1.0.3
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.1
regex==2020.6.8
six==1.15.0
tables==3.6.1
wcwidth==0.2.4
from tecohelper import hfilehelper as hf
from tecohelper.anvilhelper import AnvilHelper
import pandas as pd
import datetime as dt
from DataLoadingAPI.RecordingFlyweight import RecordingFlyweight
from DataLoadingAPI.RecordingH5TxtMapper import mapRecordingsToFiles
import glob
import matplotlib.pyplot as plt
import time
h5FilePath = 'C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\TECO_Praktikum_SS2020\\Proband5\\data_recording_clap_annotated.h5'
anvilExportFilePath = 'C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\TECO_Praktikum_SS2020\\Proband5\\17-16-05.txt'
helper = hf.H5FileHelper(h5FilePath)
recordings = helper.recordings
recordings.sort()
anvilHelper = AnvilHelper(h5FilePath, recordings[0],anvilExportFilePath)
"""
Start from the root directory of your annotations
"""
dct = mapRecordingsToFiles("C:\\Users\\Willi\\Desktop\\PSDA\\Aufgabe_3\\Annotationen")
rf= RecordingFlyweight(dct)
"""
You can explore other sensor-data by setting the correct keys. The following link leads to a
document that lists all keys.
https://docs.google.com/document/d/1oxqseZpd7c6raixKAD2HNGJXllVYCYUSiLUGqLwEgXI/edit
"""
flw = rf.getMergedSeriesFromLeftIMUDF("left_acc_y")
"""
There are up to 30 recordings in the data-set.You can run the example on
the other examples by setting the correct index-valu in the 'recording_index' variable.
"""
recording_index = 20
final_graph_data = flw.iloc[:,recording_index].dropna(how='all', axis=0)
final_graph_data.plot()
start = time.time()
final_length= len(final_graph_data.index)
take, drop = rf.getLabelSubsequences(recording_index,final_length)
for seq in take:
plt.axvspan(seq[0], seq[len(seq)-1], color='red', alpha=0.5)
plt.show()
end = time.time()
print(end-start)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment