From 381b0fc566b920056600a768217d420619f21894 Mon Sep 17 00:00:00 2001 From: Dennis Potter Date: Mon, 30 Jul 2018 18:59:14 +0200 Subject: [PATCH] Initial version of evaluate script --- tests/benchmarks/evaluate_logs.ipynb | 179 +++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 tests/benchmarks/evaluate_logs.ipynb diff --git a/tests/benchmarks/evaluate_logs.ipynb b/tests/benchmarks/evaluate_logs.ipynb new file mode 100644 index 000000000..e1f6e35bb --- /dev/null +++ b/tests/benchmarks/evaluate_logs.ipynb @@ -0,0 +1,179 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Benchmark" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Settings\n", + "root_dir = '/home/dennis/VILLASnode/tests'\n", + "benchmark_dir = 'benchmarks_20180730_17-16-39'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Load all files\n", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loaded /home/dennis/VILLASnode/tests/benchmarks_20180730_17-16-39/0_TCP-3-10-300.log\n", + "Loaded /home/dennis/VILLASnode/tests/benchmarks_20180730_17-16-39/1_TCP-3-100-300.log\n" + ] + } + ], + "source": [ + "import numpy as np\n", + "import os\n", + "\n", + "# Initialize arrays\n", + "result_files = []\n", + "result_paths = []\n", + "result_array = []\n", + "\n", + "# Save complete path of files in an array\n", + "for subdir, dirs, files in os.walk(root_dir+'/'+benchmark_dir):\n", + " for file in files:\n", + " result_paths.append(os.path.join(subdir, file))\n", + " \n", + " result_files = files\n", + "\n", + "# Loop through array with files and save the comma separated data into a new array\n", + "for file in result_paths:\n", + " print(\"Loaded {}\".format(file))\n", + " \n", + " # Load file \n", + " result_array.append(np.genfromtxt(file, delimiter=','))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Save characteristics of tests\n", + "All important settings are contained in the name of the file. We will save them in a separate array. The structure of the name is as follows:\n", + "\n", + "```bash\n", + "root_dir/benchmarks_${DATE}/${ID}_${MODE}-${VALUES IN SMP}-${RATE}-${SENT SMPS}\n", + "```\n", + "\n", + "Thus, we will structure it in the settings_array as follows:\n", + "\n", + "* `settings_array[*][0] = ID`\n", + "* `settings_array[*][1] = MODE`\n", + "* `settings_array[*][2] = VALUES IN SAMPLE`\n", + "* `settings_array[*][3] = RATE`\n", + "* `settings_array[*][4] = TOTAL NUMBER OF SAMPLES`" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import re\n", + "\n", + "# Initialize arrays\n", + "settings_array = []\n", + "\n", + "for file in result_files:\n", + " settings = []\n", + " \n", + " matchObj = re.match( r'(\\d*)_(\\w*)-(\\d*)-(\\d*)-(\\d*).log', file, re.M|re.I)\n", + "\n", + " # Fill values to array\n", + " for i in range(0,4):\n", + " settings.append(matchObj.group(i))\n", + " \n", + " # Append array to big array\n", + " settings_array.append(settings)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Process data\n", + "\n", + "### Number of samples\n", + "* First number which appears in `result_array[*][3]` will be the first sample in the benchmark. Ignore all missing samples before that entry.\n", + "* After that, check how many samples are missing." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "###" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Plot data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "###" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}