1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
"""
Wrapper to lowess and stl routines.
:author: Pierre GF Gerard-Marchant
:contact: pierregm_at_uga_edu
:date: $Date: 2007-03-26 23:38:36 -0700 (Mon, 26 Mar 2007) $
:version: $Id: examples.py 2874 2007-03-27 06:38:36Z pierregm $
"""
__author__ = "Pierre GF Gerard-Marchant ($Author: pierregm $)"
__version__ = '1.0'
__revision__ = "$Revision: 2874 $"
__date__ = '$Date: 2007-03-26 23:38:36 -0700 (Mon, 26 Mar 2007) $'
import os
import numpy
from numpy import fromiter
from numpy import bool_, float_
#import maskedarray as MA
import pyloess
from pyloess import loess
com_example = [
"""
# Get some example data ...................................
dfile = open(os.path.join('tests','madeup_data'), 'r')
dfile.readline()
x = fromiter((float(v) for v in dfile.readline().rstrip().split()),
float_).reshape(-1,2)
dfile.readline()
y = fromiter((float(v) for v in dfile.readline().rstrip().split()),
float_)
""",
"""
# Get some additional info for prediction .................
newdata1 = numpy.array([[-2.5, 0.0, 2.5], [0., 0., 0.]])
newdata2 = numpy.array([[-0.5, 0.5], [0., 0.]])
""",
"""
# Create a new loess object ...............................
madeup = loess(x,y)
# ... and prints the parameters
print madeup.model,'\\n', madeup.control
""",
"""
# Modify some of the model parameters .....................
madeup.model.update(span=0.8, normalize=False)
print madeup.model
"""
]
if 1:
for com in com_example:
print com
exec(com)
|