rpirena/datalogger/position.py
stephan d4b3a9b350 datalogger: holiday work
git-svn-id: svn+ssh://asterix.ieap.uni-kiel.de/home/subversion/stephan/solo/eda/cospi/host@6936 bc5caf13-1734-44f8-af43-603852e9ee25
2018-08-07 04:50:37 +00:00

28 lines
923 B
Python
Executable file

#! /usr/bin/python
import numpy, fileinput
sigma = 20
weights = (numpy.arange(4*sigma+1)-2*sigma)/sigma
weights = numpy.exp(-weights**2/2)
A = []
for l in fileinput.input():
A.append(map(float, l.split()))
A = numpy.array(A)
W = A[:,6]/(A[:,4]/100+1)
N = numpy.convolve(W, weights, 'same')
T = numpy.convolve(A[:,0]*W, weights, 'same')/N
Lon1 = numpy.convolve(A[:,1]*W, weights, 'same')
Lon2 = numpy.convolve(A[:,1]**2*W, weights, 'same')
Lat1 = numpy.convolve(A[:,2]*W, weights, 'same')
Lat2 = numpy.convolve(A[:,2]**2*W, weights, 'same')
Alt1 = numpy.convolve(A[:,3]*W, weights, 'same')
Alt2 = numpy.convolve(A[:,3]**2*W, weights, 'same')
Lon = Lon1/N
Lat = Lat1/N
Alt = Alt1/N
sLon = numpy.sqrt((Lon2-Lon1**2/N)/N)
sLat = numpy.sqrt((Lat2-Lat1**2/N)/N)
sAlt = numpy.sqrt((Alt2-Alt1**2/N)/N)
for i,a in enumerate(A):
print(("%.12g "*(len(a)+7)) % (tuple(a)+(T[i],Lon[i],Lat[i],Alt[i],sLon[i],sLat[i],sAlt[i])))