From dea7548d9057ca6fc215bca039d989cbb463af3c Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Wed, 15 Apr 2020 13:18:07 +0200 Subject: [PATCH] python script to make plot abd bash script to collect data with diffrent thread numbers --- collect_data.sh | 28 ++++++++++++++++++++++++++++ makeplots.py | 19 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 collect_data.sh create mode 100755 makeplots.py diff --git a/collect_data.sh b/collect_data.sh new file mode 100755 index 0000000..1d18cd6 --- /dev/null +++ b/collect_data.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +if [ -z $1 ] +then + THREADS=4 +else + THREADS=$1 + if [ $1 -le 0 ] + then + echo "thread num must be greater then 0" + exit 1 + fi +fi + +if [ -z $2 ] +then + FILENAME=data.txt +else + FILENAME=$2 +fi + +rm $FILENAME 2> /dev/null + +for i in $(eval echo {1..$THREADS}) +do + ./run -r 100000000 -i 5 -n $i | tee -a $FILENAME +done + + diff --git a/makeplots.py b/makeplots.py new file mode 100755 index 0000000..1537a76 --- /dev/null +++ b/makeplots.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +import matplotlib.pylab as plt +import csv + + +x_values = [] +y_values = [] +y_err = [] + +with open('data.txt') as FILE: + data = csv.reader(FILE, delimiter='\t') + for row in data: + x_values.append(float(row[4])) + y_values.append(float(row[0])) + y_err.append(float(row[1])) + print(x_values) + plt.errorbar(x_values,y_values,yerr=y_err) + plt.savefig('plot.png')