Daten in Text-Editor eingeben:
# Messung 28. Apr. 2016
# h[cm]
xx.xx
yy.yy
….
liveData.dat
import numpy as np
import matplotlib.pyplot as plt
#read columns from file:
infile="Data.dat"
A=np.loadtxt(infile,unpack=True)
print A # check input
# visualize as histogram (with matplotlib)
fig=plt.figure(figsize=(10,10))
plt.hist(A,100)
plt.title('Distribution of Data')
print "Mittelwert: %.3f" % np.mean(A)
print "Standardabweichung: %.3f" % np.std(A)
print "Unsicherheit auf Mittelwert: %.3f" \
% (np.std(A)/np.sqrt(len(A)))
plt.show()
read_array.py
Mit kleinem Python-script darstellen und auswerten →
s. auch liveDisplay.py
(in der Vorlesung verwendet)