python script to make plot abd bash script to collect data with diffrent thread numbers
parent
9e261709da
commit
dea7548d90
@ -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
|
||||
|
||||
|
@ -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')
|
Loading…
Reference in New Issue