import numpy as np
import pylab as pl
import sys
sys.path.append('../../lablib')
import ourgui

filename = ourgui.openFile()
dtypes = {'names': ['date', 'value', 'unit'],
          'formats': ['f8', 'f4', 'S1']}
data = np.loadtxt(filename,
                  delimiter=",",
                  dtype=dtypes,
                  )
date = data['date']
date -= date[0]
scale = 60
date /= scale
pl.plot(date, data['value'], '.')
pl.xlabel("time (min)")
# pl.xlabel("time (h)")
pl.ylabel("thermistor resistance")
pl.show()

@@ -89,16 +89,788 @@
 ourgui%0A%0A
+def smoothList(list,strippedXs=False,degree=10):%0A    if strippedXs==True: return Xs%5B0:-(len(list)-(len(list)-degree+1))%5D%0A    smoothed=%5B0%5D*(len(list)-degree+1)%0A    for i in range(len(smoothed)):%0A        smoothed%5Bi%5D=sum(list%5Bi:i+degree%5D)/float(degree)%0A    return smoothed%0A%0Adef smoothListGaussian(list,strippedXs=False,degree=5):%0A     window=degree*2-1%0A     weight=np.array(%5B1.0%5D*window)%0A     weightGauss=%5B%5D%0A     for i in range(window):%0A         i=i-degree+1%0A         frac=i/float(window)%0A         gauss=1/(np.exp((4*(frac))**2))%0A         weightGauss.append(gauss)%0A     weight=np.array(weightGauss)*weight%0A     smoothed=%5B0.0%5D*(len(list)-window)%0A     for i in range(len(smoothed)):%0A         smoothed%5Bi%5D=sum(np.array(list%5Bi:i+window%5D)*weight)/sum(weight)%0A     return smoothed%0A%0A
 filename
@@ -1189,34 +1189,258 @@
 .')%0A
-pl.xlabel(%22time (min)%22)%0A# 
+degree = 200%0A%0AsdataG = smoothListGaussian(data%5B'value'%5D, degree=degree)%0AsdateG = date%5Bdegree:(-degree+1)%5D%0A%0Asdata = smoothList(data%5B'value'%5D, degree=degree)%0Asdate = date%5Bdegree/2:-degree/2+1%5D%0A%0Apl.plot(sdate, sdata, 'g-')%0Apl.plot(sdateG, sdataG, 'r-')%0A
 pl.x
@@ -1452,17 +1452,19 @@
 (%22time (
-h
+min
 )%22)%0Apl.y

add smoothing to quickplot