[Scipy-svn] r2874 - in trunk/Lib/sandbox/pyloess: . src tests
scipy-svn@scip...
scipy-svn@scip...
Tue Mar 27 01:39:04 CDT 2007
Author: pierregm
Date: 2007-03-27 01:38:36 -0500 (Tue, 27 Mar 2007)
New Revision: 2874
Added:
trunk/Lib/sandbox/pyloess/examples.py
trunk/Lib/sandbox/pyloess/mpyloess.py
trunk/Lib/sandbox/pyloess/src/_mloess.c
trunk/Lib/sandbox/pyloess/src/_mloess.pyx
trunk/Lib/sandbox/pyloess/tests/test_mpyloess.py
Modified:
trunk/Lib/sandbox/pyloess/pyloess.py
trunk/Lib/sandbox/pyloess/setup.py
trunk/Lib/sandbox/pyloess/src/_loess.c
trunk/Lib/sandbox/pyloess/src/_loess.pyx
trunk/Lib/sandbox/pyloess/src/c_python.pxd
trunk/Lib/sandbox/pyloess/tests/test_pyloess.py
Log:
pyloess : lowess now an object w/ inputs/parameters/outputs, to match loess
pyloess : in lowess, renamed the f parameter to 'span' for readability
_loess.pyx : Fixed a bug w/ model.degree
_loess.pyx : Forced inputs to float_
mpyloess/_mloess.pyx : Add loess support for masked array
Added: trunk/Lib/sandbox/pyloess/examples.py
===================================================================
--- trunk/Lib/sandbox/pyloess/examples.py 2007-03-26 19:37:12 UTC (rev 2873)
+++ trunk/Lib/sandbox/pyloess/examples.py 2007-03-27 06:38:36 UTC (rev 2874)
@@ -0,0 +1,63 @@
+"""
+Wrapper to lowess and stl routines.
+
+:author: Pierre GF Gerard-Marchant
+:contact: pierregm_at_uga_edu
+:date: $Date$
+:version: $Id$
+"""
+__author__ = "Pierre GF Gerard-Marchant ($Author$)"
+__version__ = '1.0'
+__revision__ = "$Revision$"
+__date__ = '$Date$'
+
+
+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)
Property changes on: trunk/Lib/sandbox/pyloess/examples.py
___________________________________________________________________
Name: svn:keywords
+ Date
Author
Revision
Id
Added: trunk/Lib/sandbox/pyloess/mpyloess.py
===================================================================
--- trunk/Lib/sandbox/pyloess/mpyloess.py 2007-03-26 19:37:12 UTC (rev 2873)
+++ trunk/Lib/sandbox/pyloess/mpyloess.py 2007-03-27 06:38:36 UTC (rev 2874)
@@ -0,0 +1,843 @@
+# pylint: disable-msg=E1101
+"""
+Wrapper to lowess, loess and stl routines, with support for masked arrays.
+
+LOWESS:
+Initial Fortran code available at:
+http://netlib.bell-labs.com/netlib/go/lowess.f.gz
+
+initial author: W. S. Cleveland, 1979.
+Simple to double precision conversion of the Fortran code by Pierre
+Gerard-Marchant, 2007/03.
+
+STL:
+Initial Fortran code available at:
+http://netlib.bell-labs.com/netlib/a/stl.gz
+Initial Authors: R. B. Cleveland, W. S. Cleveland, J. E. McRae, and
+I. Terpenning, 1990.
+Simple-to-double precision conversion of the Fortran code by Pierre
+Gerard-Marchant, 2007/03.
+
+LOESS:
+Initial C/Fortran package avialable at
+http://netlib.bell-labs.com/netlib/a/dloess.gz
+Initial authors: W. S. Cleveland, E. Grosse and Shyu
+Adaptation to Pyrex/Python by Pierre Gerard-Marchant, 2007/03
+
+:author: Pierre GF Gerard-Marchant
+:contact: pierregm_at_uga_edu
+:date: $Date$
+:version: $Id$
+"""
+__author__ = "Pierre GF Gerard-Marchant ($Author$)"
+__version__ = '1.0'
+__revision__ = "$Revision$"
+__date__ = '$Date$'
+
+import numpy
+from numpy import bool_, complex_, float_, int_, str_, object_
+import numpy.core.numeric as numeric
+from numpy.core.records import recarray
+narray = numeric.array
+nempty = numeric.empty
+nlogical_not = numpy.logical_not
+
+import maskedarray.core
+from maskedarray.core import masked, nomask, mask_or
+from maskedarray.core import masked_array as marray
+
+import _lowess, _stl, _mloess
+
+
+#####---------------------------------------------------------------------------
+#--- --- STL ---
+#####---------------------------------------------------------------------------
+class lowess:
+ """An object for robust locally weighted regression.
+
+:IVariables:
+ inputs :
+ parameters :
+ outputs :
+
+
+Method
+------
+ The fitted values are computed by using the nearest neighbor
+ routine and robust locally weighted regression of degree 1
+ with the tricube weight function. A few additional features
+ have been added. Suppose r is FN truncated to an integer.
+ Let h be the distance to the r-th nearest neighbor
+ from X[i]. All points within h of X[i] are used. Thus if
+ the r-th nearest neighbor is exactly the same distance as
+ other points, more than r points can possibly be used for
+ the smooth at X[i]. There are two cases where robust
+ locally weighted regression of degree 0 is actually used at
+ X[i]. One case occurs when h is 0.0. The second case
+ occurs when the weighted standard error of the X[i] with
+ respect to the weights w[j] is less than .001 times the
+ range of the X[i], where w[j] is the weight assigned to the
+ j-th point of X (the tricube weight times the robustness
+ weight) divided by the sum of all of the weights. Finally,
+ if the w[j] are all zero for the smooth at X[i], the fitted
+ value is taken to be Y[i].
+
+References
+----------
+ W. S. Cleveland. 1978. Visual and Computational Considerations in
+ Smoothing Scatterplots by Locally Weighted Regression. In
+ Computer Science and Statistics: Eleventh Annual Symposium on the
+ Interface, pages 96-100. Institute of Statistics, North Carolina
+ State University, Raleigh, North Carolina, 1978.
+
+ W. S. Cleveland, 1979. Robust Locally Weighted Regression and
+ Smoothing Scatterplots. Journal of the American Statistical
+ Association, 74:829-836, 1979.
+
+ W. S. Cleveland, 1981. LOWESS: A Program for Smoothing Scatterplots
+ by Robust Locally Weighted Regression. The American Statistician,
+ 35:54.
+ """
+ #............................................
+ class _inputs(object):
+ """Inputs of the lowess fit.
+
+:IVariables:
+ x : ndarray
+ A (n,) float ndarray of observations (sorted by increasing values).
+ y : ndarray
+ A (n,) float ndarray of responses (sorted by increasing x).
+
+ """
+ def __init__(self, x, y):
+ x = marray(x, copy=False, subok=True, dtype=float_, order='F').ravel()
+ y = marray(y, copy=False, subok=True, dtype=float_, order='F').ravel()
+ if x.size != y.size:
+ msg = "Incompatible size between observations (%s) and response (%s)!"
+ raise ValueError(msg % (x.size, y.size))
+ idx = x.argsort()
+ self._x = x[idx]
+ self._y = y[idx]
+ self._mask = mask_or(self._x._mask, self._y._mask,
+ copy=False, small_mask=False)
+ #.....
+ x = property(fget=lambda self:self._x)
+ y = property(fget=lambda self:self._y)
+ #............................................
+ class _parameters(object):
+ """Parameters of the lowess fit.
+
+:IVariables:
+ span : float *[0.5]*
+ Fraction of the total number of points used to compute each fitted value.
+ As f increases the smoothed values become smoother. Choosing f in the range
+ .2 to .8 usually results in a good fit.
+ nsteps : integer *[2]*
+ Number of iterations in the robust fit. If nsteps=0, the nonrobust fit
+ is returned; setting nsteps=2 should serve most purposes.
+ delta : integer *[0]*
+ Nonnegative parameter which may be used to save computations.
+ If N (the number of observations) is less than 100, set delta=0.0;
+ if N is greater than 100 you should find out how delta works by reading
+ the additional instructions section.
+ """
+ def __init__(self, span, nsteps, delta, caller):
+ self.activated = False
+ self._span = span
+ self._nsteps = nsteps
+ self._delta = delta
+ self._caller = caller
+ #.....
+ def _get_span(self):
+ "Gets the current span."
+ return self._span
+ def _set_span(self, span):
+ "Sets the current span, and refit if needed."
+ if span <= 0 or span > 1:
+ raise ValueError("span should be between zero and one!")
+ self._span = span
+ if self.activated:
+ self._caller.fit()
+ span = property(fget=_get_span, fset=_set_span)
+ #.....
+ def _get_nsteps(self):
+ "Gets the current number of iterations."
+ return self._nsteps
+ def _set_nsteps(self, nsteps):
+ "Sets the current number of iterations, and refit if needed."
+ if nsteps < 0:
+ raise ValueError("nsteps should be positive!")
+ self._nsteps = nsteps
+ if self.activated:
+ self._caller.fit()
+ nsteps = property(fget=_get_nsteps, fset=_set_nsteps)
+ #.....
+ def _get_delta(self):
+ "Gets the current delta."
+ return self._delta
+ def _set_delta(self, delta):
+ "Sets the current delta, and refit if needed."
+ if delta < 0:
+ raise ValueError("delta should be positive!")
+ self._delta = delta
+ if self.activated:
+ self._caller.fit()
+ delta = property(fget=_get_delta, fset=_set_delta)
+ #............................................
+ class _outputs(object):
+ """Outputs of the lowess fit.
+
+:IVariables:
+ fitted_values : ndarray
+ A (n,) ndarray of fitted values (readonly).
+ fitted_residuals : ndarray
+ A (n,) ndarray of residuals (readonly).
+ weights : ndarray
+ A (n,) ndarray of robust weights (readonly).
+ """
+ def __init__(self, n):
+ self._fval = marray(nempty((n,), dtype=float_, order='F'))
+ self._rw = marray(nempty((n,), dtype=float_, order='F'))
+ self._fres = marray(nempty((n,), dtype=float_, order='F'))
+ #.....
+ fitted_values = property(fget=lambda self:self._fval)
+ robust_weights = property(fget=lambda self:self._rw)
+ fitted_residuals = property(fget=lambda self:self._fres)
+ #............................................
+ def __init__(self, x, y, span=0.5, nsteps=2, delta=0):
+ """
+:Parameters:
+ x : ndarray
+ Abscissas of the points on the scatterplot; the values in X must be
+ ordered from smallest to largest.
+ y : ndarray
+ Ordinates of the points on the scatterplot.
+ span : Float *[0.5]*
+ Fraction of the total number of points used to compute each fitted value.
+ As span increases the smoothed values become smoother. Choosing span in
+ the range .2 to .8 usually results in a good fit.
+ nsteps : Integer *[2]*
+ Number of iterations in the robust fit. If nsteps=0, the nonrobust fit
+ is returned; setting nsteps=2 should serve most purposes.
+ delta : Integer *[0]*
+ Nonnegative parameter which may be used to save computations.
+ If N (the number of elements in x) is less than 100, set delta=0.0;
+ if N is greater than 100 you should find out how delta works by reading
+ the additional instructions section.
+ """
+ # Chek the input data .........
+ # Initialize the attributes ...
+ self.inputs = lowess._inputs(x,y)
+ self.parameters = lowess._parameters(span, nsteps, delta, self)
+ self.outputs = self._outputs(self.inputs._x.size)
+ # Force a fit .................
+ self.fit()
+
+ #............................................
+ def fit(self):
+ # Check the mask .........
+ mask = self.inputs._mask
+ if mask.any():
+ unmask = nlogical_not(mask)
+ (x, y) = (self.inputs._x[unmask], self.inputs._y[unmask])
+ else:
+ unmask = slice(None,None)
+ (x, y) = (self.inputs._x, self.inputs._y)
+ # Get the parameters .....
+ self.parameters.activated = True
+ f = self.parameters._span
+ nsteps = self.parameters._nsteps
+ delta = self.parameters._delta
+ (tmp_s, tmp_w, tmp_r) = _lowess.lowess(x, y, f, nsteps, delta)
+ # Process the outputs .....
+ #... set the values
+ self.outputs._fval[unmask] = tmp_s[:]
+ self.outputs._rw[unmask] = tmp_w[:]
+ self.outputs._fres[unmask] = tmp_r[:]
+ #... set the masks
+ self.outputs._fval._set_mask(mask)
+ self.outputs._rw._set_mask(mask)
+ self.outputs._fres._set_mask(mask)
+ # Clean up the mess .......
+ del(tmp_s, tmp_w, tmp_r)
+ return self.outputs
+
+#####---------------------------------------------------------------------------
+#--- --- STL ---
+#####---------------------------------------------------------------------------
+class stl:
+ class _inputs:
+ def __init__(self, y):
+ self.y = marray(y, subok=True, copy=False).ravel()
+ self._mask = self.y._mask
+ if self._mask.any():
+ raise ValueError("Masked arrays should be filled first!")
+ self.y_eff = self.y.compressed()
+ #............................................
+ class _model(object):
+ """Model parameters of the STL fit.
+
+:IVariables:
+ np : Integer *[12]*
+ Period of the seasonal component.
+ For example, if the time series is monthly with a yearly cycle, then
+ np=12.
+ ns : Integer *[7]*
+ Length of the seasonal smoother.
+ The value of ns should be an odd integer greater than or equal to 3.
+ A value ns>6 is recommended. As ns increases the values of the
+ seasonal component at a given point in the seasonal cycle (e.g., January
+ values of a monthly series with a yearly cycle) become smoother.
+ nt : Integer *[None]*
+ Length of the trend smoother.
+ The value of nt should be an odd integer greater than or equal to 3.
+ A value of nt between 1.5*np and 2*np is recommended. As nt increases,
+ the values of the trend component become smoother.
+ If nt is None, it is estimated as the smallest odd integer greater
+ or equal to (1.5*np)/[1-(1.5/ns)]
+ nl : Integer *[None]*
+ Length of the low-pass filter.
+ The value of nl should be an odd integer greater than or equal to 3.
+ The smallest odd integer greater than or equal to np is used by default.
+ isdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in seasonal smoothing.
+ The value is 0 or 1.
+ itdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in trend smoothing.
+ The value is 0 or 1.
+ ildeg : Integer *[1]*
+ Degree of locally-fitted polynomial in low-pass smoothing.
+ The value is 0 or 1.
+ """
+ def __init__(self,
+ np=12, ns=7, nt=None, nl=13,
+ isdeg=1, itdeg=1, ildeg=1, caller=None):
+ self._np = np
+ self._ns = ns
+ #
+ self._nt = nt
+ if nt is None:
+ self._nt = max(int((1.5*np/(1.-1.5/ns))+0.5), 3)
+ else:
+ self._nt = nt
+ if not self._nt % 2:
+ self._nt += 1
+ #
+ if nl is None:
+ self._nl = max(np, 3)
+ else:
+ self._nl = nl
+ if not self._nl % 2:
+ self._nl += 1
+ #
+ self._isdeg = isdeg
+ self._itdeg = itdeg
+ self._ildeg = ildeg
+ self.activated = False
+ self.caller = caller
+ #.....
+ def _get_np(self):
+ "Gets the current seasonal period."
+ return self._np
+ def _set_np(self, np):
+ "Sets the current seasonal period."
+ self._np = max(np,2)
+ if self.activated:
+ self.caller.fit()
+ np = property(fget=_get_np, fset=_set_np)
+ #.....
+ def _get_ns(self):
+ "Gets the length of the seasonal smoother."
+ return self._ns
+ def _set_ns(self, ns):
+ "Sets the length of the seasonal smoother."
+ self._ns = max(ns, 3)
+ if self._ns %2 == 0:
+ self._ns += 1
+ if self.activated:
+ self.caller.fit()
+ ns = property(fget=_get_ns, fset=_set_ns)
+ #.....
+ def _get_nt(self):
+ "Gets the length of the trend smoother."
+ return self._nt
+ def _set_nt(self, nt):
+ "Sets the length of the trend smoother."
+ self._nt = nt
+ if self.activated:
+ self.caller.fit()
+ nt = property(fget=_get_nt, fset=_set_nt)
+ #.....
+ def _get_nl(self):
+ "Gets the length of the trend smoother."
+ return self._nl
+ def _set_nl(self, nl):
+ "Sets the length of the trend smoother."
+ self._nl = nl
+ if self.activated:
+ self.caller.fit()
+ nl = property(fget=_get_nl, fset=_set_nl)
+ #.....
+ def _get_isdeg(self):
+ "Gets the degree of the seasonal smoother."
+ return self._isdeg
+ def _set_isdeg(self, isdeg):
+ "Sets the degree of the seasonal smoother."
+ if isdeg > 2 or isdeg < 0:
+ raise ValueError("The degree of the seasonal smoother should be 1 or 0.")
+ self._isdeg = int(isdeg)
+ if self.activated:
+ self.caller.fit()
+ isdeg = property(fget=_get_isdeg, fset=_set_isdeg)
+ #.....
+ def _get_itdeg(self):
+ "Gets the degree of the trend smoother."
+ return self._itdeg
+ def _set_itdeg(self, itdeg):
+ "Sets the degree of the trend smoother."
+ if itdeg > 2 or itdeg < 0:
+ raise ValueError("The degree of the trend smoother should be 1 or 0.")
+ self._itdeg = int(itdeg)
+ if self.activated:
+ self.caller.fit()
+ itdeg = property(fget=_get_itdeg, fset=_set_itdeg)
+ #.....
+ def _get_ildeg(self):
+ "Gets the degree of the low-pass smoother."
+ return self._ildeg
+ def _set_ildeg(self, ildeg):
+ "Sets the degree of the low-pass smoother."
+ if ildeg > 2 or ildeg < 0:
+ raise ValueError("The degree of the low-pass smoother should be 1 or 0.")
+ self._ildeg = int(ildeg)
+ if self.activated:
+ self.caller.fit()
+ ildeg = property(fget=_get_ildeg, fset=_set_ildeg)
+
+ #............................................
+ class _control(object):
+ """Control parameters of the STL fit.
+
+:IVariables:
+ nsjump : Integer *[None]*
+ Skipping value for seasonal smoothing.
+ The seasonal smoother skips ahead nsjump points and then linearly
+ interpolates in between. The value of nsjump should be a positive
+ integer; if nsjump=1, a seasonal smooth is calculated at all n points.
+ To make the procedure run faster, a reasonable choice for nsjump is
+ 10%-20% of ns. By default, nsjump= 0.1*ns.
+ ntjump : Integer *[1]*
+ Skipping value for trend smoothing. If None, ntjump= 0.1*nt
+ nljump : Integer *[1]*
+ Skipping value for low-pass smoothing. If None, nljump= 0.1*nl
+ robust : Boolean *[True]*
+ Flag indicating whether robust fitting should be performed.
+ ni : Integer *[None]*
+ Number of loops for updating the seasonal and trend components.
+ The value of ni should be a positive integer.
+ See the next argument for advice on the choice of ni.
+ If ni is None, ni is set to 1 for robust fitting, to 5 otherwise.
+ no : Integer *[0]*
+ Number of iterations of robust fitting. The value of no should
+ be a nonnegative integer. If the data are well behaved without
+ outliers, then robustness iterations are not needed. In this case
+ set no=0, and set ni=2 to 5 depending on how much security
+ you want that the seasonal-trend looping converges.
+ If outliers are present then no=3 is a very secure value unless
+ the outliers are radical, in which case no=5 or even 10 might
+ be better. If no>0 then set ni to 1 or 2.
+ If None, then no is set to 15 for robust fitting, to 0 otherwise.
+ """
+ def __init__(self,
+ nsjump=None,ntjump=None,nljump=None,
+ robust=True, ni=None,no=None, caller=None):
+ (self._nsjump, self._ntjump, self._nljump) = (nsjump, ntjump, nljump)
+ #...
+ if robust:
+ if ni is None:
+ ni = 1
+ if no is None:
+ no = 15
+ else:
+ if ni is None:
+ ni = 5
+ if no is None:
+ no = 0
+ (self._robust, self._ni, self._no) = (robust, ni, no)
+ #...
+ self.activated = False
+ self.caller = caller
+ #....
+ def _get_nsjump(self):
+ "Gets the skipping value for seasonal smoothing."
+ return self._nsjump
+ def _set_nsjump(self, nsjump):
+ "Sets the skipping value for seasonal smoothing."
+ self._nsjump = nsjump
+ if self.activated:
+ self.caller.fit()
+ nsjump = property(fget=_get_nsjump, fset=_set_nsjump)
+ #....
+ def _get_ntjump(self):
+ "Gets the skipping value for trend smoothing."
+ return self._ntjump
+ def _set_ntjump(self, ntjump):
+ "Sets the skipping value for trend smoothing."
+ self._ntjump = ntjump
+ if self.activated:
+ self.caller.fit()
+ ntjump = property(fget=_get_ntjump, fset=_set_ntjump)
+ #....
+ def _get_nljump(self):
+ "Gets the skipping value for low-pass smoothing."
+ return self._nljump
+ def _set_nljump(self, nljump):
+ "Set the skipping value for low-pass smoothings"
+ self._nljump = nljump
+ if self.activated:
+ self.caller.fit()
+ nljump = property(fget=_get_nljump, fset=_set_nljump)
+ #....
+ def _get_robust(self):
+ "Gets whether robust fitting should be performed."
+ return self._robust
+ def _set_robust(self, robust):
+ "Sets whether robust fitting should be performed."
+ self._robust = robust
+ if self.activated:
+ self.caller.fit()
+ robust = property(fget=_get_robust, fset=_set_robust)
+ #....
+ def _get_ni(self):
+ "Gets the number of loops."
+ return self._ni
+ def _set_ni(self, ni):
+ "Sets the number of loops."
+ if ni < 0:
+ raise ValueError("The number of loops should be positive!")
+ self._ni = ni
+ if self.activated:
+ self.caller.fit()
+ ni = property(fget=_get_ni, fset=_set_ni)
+ #....
+ def _get_no(self):
+ "Gets the number of iterations for robust fitting."
+ return self._no
+ def _set_no(self, no):
+ "Sets the number of iterations for robust fitting."
+ if no < 0 :
+ raise ValueError("The number of iterations should be positive!")
+ self._no = no
+ if self.activated:
+ self.caller.fit()
+ no = property(fget=_get_no, fset=_set_no)
+ #............................................
+ class _outputs(object):
+ """Outputs of the STL fit.
+
+:IVariables:
+ seasonal : ndarray
+ Seasonal fitted values.
+ trend : ndarray
+ Trend fitted values.
+ residuals : ndarray
+ Fitted residuals.
+ weights : ndarray
+ Local robust weights. The final local robust weights are all 1 if no=0.
+ """
+ def __init__(self, n):
+ self._seasonal = marray(nempty((n,), float_))
+ self._trend = marray(nempty((n,), float_))
+ self._weights = marray(nempty((n,), float_))
+ self._residuals = marray(nempty((n,), float_))
+ #.....
+ seasonal = property(fget=lambda self:self._seasonal)
+ trend = property(fget=lambda self:self._trend)
+ weights = property(fget=lambda self:self._weights)
+ residuals = property(fget=lambda self:self._residuals)
+ #.............................................
+ def __init__(self, y, **options):
+ """Decomposes a time series into seasonal and trend components.
+
+:Parameters:
+ y : ndarray
+ Time series to be decomposed.
+ np : Integer *[12]*
+ Period of the seasonal component.
+ For example, if the time series is monthly with a yearly cycle, then
+ np=12.
+ ns : Integer *[7]*
+ Length of the seasonal smoother.
+ The value of ns should be an odd integer greater than or equal to 3.
+ A value ns>6 is recommended. As ns increases the values of the
+ seasonal component at a given point in the seasonal cycle (e.g., January
+ values of a monthly series with a yearly cycle) become smoother.
+ nt : Integer *[None]*
+ Length of the trend smoother.
+ The value of nt should be an odd integer greater than or equal to 3.
+ A value of nt between 1.5*np and 2*np is recommended. As nt increases,
+ the values of the trend component become smoother.
+ If nt is None, it is estimated as the smallest odd integer greater
+ or equal to (1.5*np)/[1-(1.5/ns)]
+ nl : Integer *[None]*
+ Length of the low-pass filter.
+ The value of nl should be an odd integer greater than or equal to 3.
+ The smallest odd integer greater than or equal to np is used by default.
+ isdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in seasonal smoothing.
+ The value is 0 or 1.
+ itdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in trend smoothing.
+ The value is 0 or 1.
+ ildeg : Integer *[1]*
+ Degree of locally-fitted polynomial in low-pass smoothing.
+ The value is 0 or 1.
+ nsjump : Integer *[None]*
+ Skipping value for seasonal smoothing.
+ The seasonal smoother skips ahead nsjump points and then linearly
+ interpolates in between. The value of nsjump should be a positive
+ integer; if nsjump=1, a seasonal smooth is calculated at all n points.
+ To make the procedure run faster, a reasonable choice for nsjump is
+ 10%-20% of ns. By default, nsjump= 0.1*ns.
+ ntjump : Integer *[1]*
+ Skipping value for trend smoothing. If None, ntjump= 0.1*nt
+ nljump : Integer *[1]*
+ Skipping value for low-pass smoothing. If None, nljump= 0.1*nl
+ robust : Boolean *[True]*
+ Flag indicating whether robust fitting should be performed.
+ ni : Integer *[None]*
+ Number of loops for updating the seasonal and trend components.
+ The value of ni should be a positive integer.
+ See the next argument for advice on the choice of ni.
+ If ni is None, ni is set to 1 for robust fitting, to 5 otherwise.
+ no : Integer *[0]*
+ Number of iterations of robust fitting. The value of no should
+ be a nonnegative integer. If the data are well behaved without
+ outliers, then robustness iterations are not needed. In this case
+ set no=0, and set ni=2 to 5 depending on how much security
+ you want that the seasonal-trend looping converges.
+ If outliers are present then no=3 is a very secure value unless
+ the outliers are radical, in which case no=5 or even 10 might
+ be better. If no>0 then set ni to 1 or 2.
+ If None, then no is set to 15 for robust fitting, to 0 otherwise.
+ """
+ self.inputs = stl._inputs(y)
+ self.model = stl._model(**dict(np=options.get('np',12),
+ ns=options.get('ns',7),
+ nt=options.get('nt',None),
+ nl=options.get('nl',13),
+ isdeg=options.get('isdeg',1),
+ itdeg=options.get('itdeg',1),
+ ildeg=options.get('ildeg',1),
+ caller=self))
+ optcontrol = dict(
+ nsjump=options.get('nsjump',int(0.1*self.model.ns+0.9)),
+ ntjump=options.get('ntjump',int(0.1*self.model.nt+0.9)),
+ nljump=options.get('nljump',int(0.1*self.model.nl+0.9)),
+ robust=options.get('robust',True),
+ ni=options.get('ni',None),
+ no=options.get('no',None),)
+ self.control = stl._control(**optcontrol)
+ self.outputs = stl._outputs(len(self.inputs.y))
+ # Force a fit .................
+ self.fit()
+
+ #............................................
+ def fit(self):
+ # Get the input ...............
+ y = self.inputs.y_eff
+ mask = self.inputs._mask
+ if mask is nomask:
+ unmask = slice(None,None)
+ else:
+ unmask = nlogical_not(mask)
+ # Get the parameters ..........
+ model = self.model
+ (np, ns, nt, nl) = (model.np, model.ns, model.nt, model.nl)
+ (isdeg, itdeg, ildeg) = (model.isdeg, model.itdeg, model.ildeg)
+ control = self.control
+ (nsjump, ntjump, nljump) = (control.nsjump, control.ntjump, control.nljump)
+ (ni, no) = (control.ni, control.no)
+ # Compute the fit .............
+ (rw,szn,trn,work) = _stl.stl(y,np,ns,nt,nl,isdeg,itdeg,ildeg,
+ nsjump,ntjump,nljump,ni,no,)
+ # Process the outputs .....
+ #... set the values
+ self.outputs.trend[unmask] = trn.flat
+ self.outputs.seasonal[unmask] = szn.flat
+ self.outputs.weights[unmask] = rw.flat
+ self.outputs.residuals[unmask] = (y-trn-szn)
+ #... set the masks
+ self.outputs.trend._set_mask(mask)
+ self.outputs.seasonal._set_mask(mask)
+ self.outputs.weights._set_mask(mask)
+ self.outputs.residuals._set_mask(mask)
+ # Clean up the mess .......
+ self.model.activated = self.control.activated = True
+ del(trn, rw, szn)
+ return self.outputs
+
+
+
+
+
+def fstl(y, np=12, ns=7, nt=None, nl=13, isdeg=1, itdeg=1, ildeg=1,
+ nsjump=None,ntjump=None,nljump=None, robust=True, ni=None,no=None):
+ """Decomposes a time series into seasonal and trend components.
+
+:Parameters:
+ y : Numerical array
+ Time Series to be decomposed.
+ np : Integer *[12]*
+ Period of the seasonal component.
+ For example, if the time series is monthly with a yearly cycle, then
+ np=12.
+ ns : Integer *[7]*
+ Length of the seasonal smoother.
+ The value of ns should be an odd integer greater than or equal to 3.
+ A value ns>6 is recommended. As ns increases the values of the
+ seasonal component at a given point in the seasonal cycle (e.g., January
+ values of a monthly series with a yearly cycle) become smoother.
+ nt : Integer *[None]*
+ Length of the trend smoother.
+ The value of nt should be an odd integer greater than or equal to 3.
+ A value of nt between 1.5*np and 2*np is recommended. As nt increases,
+ the values of the trend component become smoother.
+ If nt is None, it is estimated as the smallest odd integer greater
+ or equal to (1.5*np)/[1-(1.5/ns)]
+ nl : Integer *[None]*
+ Length of the low-pass filter.
+ The value of nl should be an odd integer greater than or equal to 3.
+ The smallest odd integer greater than or equal to np is used by default.
+ isdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in seasonal smoothing.
+ The value is 0 or 1.
+ itdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in trend smoothing.
+ The value is 0 or 1.
+ ildeg : Integer *[1]*
+ Degree of locally-fitted polynomial in low-pass smoothing.
+ The value is 0 or 1.
+ nsjump : Integer *[None]*
+ Skipping value for seasonal smoothing.
+ The seasonal smoother skips ahead nsjump points and then linearly
+ interpolates in between. The value of nsjump should be a positive
+ integer; if nsjump=1, a seasonal smooth is calculated at all n points.
+ To make the procedure run faster, a reasonable choice for nsjump is
+ 10%-20% of ns. By default, nsjump= 0.1*ns.
+ ntjump : Integer *[1]*
+ Skipping value for trend smoothing. If None, ntjump= 0.1*nt
+ nljump : Integer *[1]*
+ Skipping value for low-pass smoothing. If None, nljump= 0.1*nl
+ robust : Boolean *[True]*
+ Flag indicating whether robust fitting should be performed.
+ ni : Integer *[None]*
+ Number of loops for updating the seasonal and trend components.
+ The value of ni should be a positive integer.
+ See the next argument for advice on the choice of ni.
+ If ni is None, ni is set to 1 for robust fitting, to 5 otherwise.
+ no : Integer *[0]*
+ Number of iterations of robust fitting. The value of no should
+ be a nonnegative integer. If the data are well behaved without
+ outliers, then robustness iterations are not needed. In this case
+ set no=0, and set ni=2 to 5 depending on how much security
+ you want that the seasonal-trend looping converges.
+ If outliers are present then no=3 is a very secure value unless
+ the outliers are radical, in which case no=5 or even 10 might
+ be better. If no>0 then set ni to 1 or 2.
+ If None, then no is set to 15 for robust fitting, to 0 otherwise.
+
+Returns:
+ A recarray of estimated trend values ('trend'), estimated seasonal
+ components ('seasonal'), local robust weights ('weights') and fit
+ residuals ('residuals').
+ The final local robust weights are all 1 if no=0.
+
+Reference
+---------
+
+ R. B. Cleveland, W. S. Cleveland, J. E. McRae and I. Terpenning.
+ 1990. STL: A Seasonal-Trend Decomposition Procedure Based on LOESS
+ (with Discussion). Journal of Official Statistics, 6:3-73.
+
+
+ """
+ ns = max(ns, 3)
+ if ns % 2 == 0:
+ ns += 1
+ np = max(2, np)
+ if nt is None:
+ nt = max(int((1.5*np/(1.-1.5/ns))+0.5), 3)
+ if not nt % 2:
+ nt += 1
+ if nl is None:
+ nl = max(3,np)
+ if not nl % 2:
+ nl += 1
+ if nsjump is None:
+ nsjump = int(0.1*ns + 0.9)
+ if ntjump is None:
+ ntjump = int(0.1*nt + 0.9)
+ if nljump is None:
+ nljump = int(0.1*nl + 0.9)
+ if robust:
+ if ni is None:
+ ni = 1
+ if no is None:
+ no = 15
+ else:
+ if ni is None:
+ ni = 5
+ if no is None:
+ no = 0
+
+ if hasattr(y,'_mask') and numpy.any(y._mask):
+ raise ValueError,"Missing values should first be filled !"
+ y = numeric.array(y, subok=True, copy=False).ravel()
+ (rw,szn,trn,work) = _stl.stl(y,np,ns,nt,nl,isdeg,itdeg,ildeg,
+ nsjump,ntjump,nljump,ni,no,)
+ dtyp = [('trend', float_), ('seasonal', float_),
+ ('residuals', float_), ('weights', float_)]
+ result = numeric.fromiter(zip(trn,szn,y-trn-szn,rw), dtype=dtyp)
+ return result.view(recarray)
+
+#####---------------------------------------------------------------------------
+#--- --- Loess ---
+#####---------------------------------------------------------------------------
+loess = _mloess.loess
+loess_anova = _mloess.anova
+
+################################################################################
+if __name__ == '__main__':
+ from maskedarray.testutils import assert_almost_equal
+ from maskedarray import masked_values
+ from numpy import fromiter
+ import os
+
+ if 1:
+ NOx = marray([4.818, 2.849, 3.275, 4.691, 4.255, 5.064, 2.118, 4.602,
+ 2.286, 0.970, 3.965, 5.344, 3.834, 1.990, 5.199, 5.283,
+ -9999, -9999, 3.752, 0.537, 1.640, 5.055, 4.937, 1.561])
+ NOx = maskedarray.masked_values(NOx, -9999)
+ E = marray([0.831, 1.045, 1.021, 0.970, 0.825, 0.891, 0.71, 0.801,
+ 1.074, 1.148, 1.000, 0.928, 0.767, 0.701, 0.807, 0.902,
+ -9999, -9999, 0.997, 1.224, 1.089, 0.973, 0.980, 0.665])
+ gas_fit_E = numpy.array([0.665, 0.949, 1.224])
+ newdata = numpy.array([0.6650000, 0.7581667, 0.8513333, 0.9445000,
+ 1.0376667, 1.1308333, 1.2240000])
+ coverage = 0.99
+
+ rfile = open(os.path.join('tests','gas_result'), 'r')
+ results = []
+ for i in range(8):
+ rfile.readline()
+ z = fromiter((float(v) for v in rfile.readline().rstrip().split()),
+ float_)
+ results.append(z)
+ #
+ gas = loess(E,NOx)
+ gas.model.span = 2./3.
+ gas.fit()
+ assert_almost_equal(gas.outputs.fitted_values.compressed(), results[0], 6)
+ assert_almost_equal(gas.outputs.enp, 5.5, 1)
+ assert_almost_equal(gas.outputs.s, 0.3404, 4)
\ No newline at end of file
Property changes on: trunk/Lib/sandbox/pyloess/mpyloess.py
___________________________________________________________________
Name: svn:keywords
+ Date
Author
Revision
Id
Modified: trunk/Lib/sandbox/pyloess/pyloess.py
===================================================================
--- trunk/Lib/sandbox/pyloess/pyloess.py 2007-03-26 19:37:12 UTC (rev 2873)
+++ trunk/Lib/sandbox/pyloess/pyloess.py 2007-03-27 06:38:36 UTC (rev 2874)
@@ -39,13 +39,16 @@
import numpy.core.numeric as numeric
from numpy.core.records import recarray
+from numpy.core import array as narray
+from numpy.core import empty as nempty
+
import _lowess, _stl, _loess
#####---------------------------------------------------------------------------
#--- --- STL ---
#####---------------------------------------------------------------------------
-def lowess(x,y,f=0.5,nsteps=2,delta=0):
+def flowess(x,y,span=0.5,nsteps=2,delta=0):
"""Performs a robust locally weighted regression (lowess).
Outputs a *3xN* array of fitted values, residuals and fit weights.
@@ -57,7 +60,7 @@
ordered from smallest to largest.
y : ndarray
Ordinates of the points on the scatterplot.
- f : Float *[0.5]*
+ span : Float *[0.5]*
Fraction of the total number of points used to compute each fitted value.
As f increases the smoothed values become smoother. Choosing f in the range
.2 to .8 usually results in a good fit.
@@ -145,10 +148,224 @@
35:54.
"""
- dtyp = [('smooth',float_), ('weigths', float_), ('residuals', float_)]
- return numeric.fromiter(zip(*_lowess.lowess(x,y,f,nsteps,delta,)),
- dtype=dtyp).view(recarray)
+ x = narray(x, copy=False, subok=True, dtype=float_)
+ y = narray(y, copy=False, subok=True, dtype=float_)
+ if x.size != y.size:
+ raise ValueError("Incompatible size between observations and response!")
+
+
+ out_dtype = [('smooth',float_), ('weigths', float_), ('residuals', float_)]
+ return numeric.fromiter(zip(*_lowess.lowess(x,y,span,nsteps,delta,)),
+ dtype=out_dtype).view(recarray)
+
+class lowess:
+ """An object for robust locally weighted regression.
+
+:IVariables:
+ inputs : An object storing the inputs.
+ x : A (n,) ndarray of observations (sorted by increasing values).
+ y : A (n,) ndarray of responses (sorted by increasing x).
+ parameters : An object storing the control parameters.
+ span : Fraction of the total number of points used in the smooth.
+ nsteps : Number of iterations of the robust fit.
+ delta : Parameter used to save computation time
+ outputs : An object storing the outputs.
+ smooth : A (n,) ndarray of fitted values.
+ residuals : A (n,) ndarray of fitted residuals.
+ weights : A (n,) ndarray of robust weights.
+
+
+Method
+------
+ The fitted values are computed by using the nearest neighbor
+ routine and robust locally weighted regression of degree 1
+ with the tricube weight function. A few additional features
+ have been added. Suppose r is FN truncated to an integer.
+ Let h be the distance to the r-th nearest neighbor
+ from X[i]. All points within h of X[i] are used. Thus if
+ the r-th nearest neighbor is exactly the same distance as
+ other points, more than r points can possibly be used for
+ the smooth at X[i]. There are two cases where robust
+ locally weighted regression of degree 0 is actually used at
+ X[i]. One case occurs when h is 0.0. The second case
+ occurs when the weighted standard error of the X[i] with
+ respect to the weights w[j] is less than .001 times the
+ range of the X[i], where w[j] is the weight assigned to the
+ j-th point of X (the tricube weight times the robustness
+ weight) divided by the sum of all of the weights. Finally,
+ if the w[j] are all zero for the smooth at X[i], the fitted
+ value is taken to be Y[i].
+
+References
+----------
+ W. S. Cleveland. 1978. Visual and Computational Considerations in
+ Smoothing Scatterplots by Locally Weighted Regression. In
+ Computer Science and Statistics: Eleventh Annual Symposium on the
+ Interface, pages 96-100. Institute of Statistics, North Carolina
+ State University, Raleigh, North Carolina, 1978.
+
+ W. S. Cleveland, 1979. Robust Locally Weighted Regression and
+ Smoothing Scatterplots. Journal of the American Statistical
+ Association, 74:829-836, 1979.
+
+ W. S. Cleveland, 1981. LOWESS: A Program for Smoothing Scatterplots
+ by Robust Locally Weighted Regression. The American Statistician,
+ 35:54.
+ """
+ #............................................
+ class _inputs(object):
+ """Inputs of the lowess fit.
+
+:IVariables:
+ x : ndarray
+ A (n,) float ndarray of observations (sorted by increasing values).
+ y : ndarray
+ A (n,) float ndarray of responses (sorted by increasing x).
+ """
+ def __init__(self, x, y):
+ x = narray(x, copy=False, subok=True, dtype=float_).ravel()
+ y = narray(y, copy=False, subok=True, dtype=float_).ravel()
+ if x.size != y.size:
+ msg = "Incompatible size between observations (%s) and response (%s)!"
+ raise ValueError(msg % (x.size, y.size))
+ idx = x.argsort()
+ self._x = x[idx]
+ self._y = y[idx]
+ #.....
+ x = property(fget=lambda self:self._x)
+ y = property(fget=lambda self:self._y)
+ #............................................
+ class _parameters(object):
+ """Parameters of the lowess fit.
+
+:IVariables:
+ span : float *[0.5]*
+ Fraction of the total number of points used to compute each fitted value.
+ As f increases the smoothed values become smoother. Choosing f in the range
+ .2 to .8 usually results in a good fit.
+ nsteps : integer *[2]*
+ Number of iterations in the robust fit. If nsteps=0, the nonrobust fit
+ is returned; setting nsteps=2 should serve most purposes.
+ delta : integer *[0]*
+ Nonnegative parameter which may be used to save computations.
+ If N (the number of observations) is less than 100, set delta=0.0;
+ if N is greater than 100 you should find out how delta works by reading
+ the additional instructions section.
+ """
+ def __init__(self, span, nsteps, delta, caller):
+ self.activated = False
+ self._span = span
+ self._nsteps = nsteps
+ self._delta = delta
+ self._caller = caller
+ #.....
+ def _get_span(self):
+ "Gets the current span."
+ return self._span
+ def _set_span(self, span):
+ "Sets the current span, and refit if needed."
+ if span <= 0 or span > 1:
+ raise ValueError("span should be between zero and one!")
+ self._span = span
+ if self.activated:
+ self._caller.fit()
+ span = property(fget=_get_span, fset=_set_span)
+ #.....
+ def _get_nsteps(self):
+ "Gets the current number of iterations."
+ return self._nsteps
+ def _set_nsteps(self, nsteps):
+ "Sets the current number of iterations, and refit if needed."
+ if nsteps < 0:
+ raise ValueError("nsteps should be positive!")
+ self._nsteps = nsteps
+ if self.activated:
+ self._caller.fit()
+ nsteps = property(fget=_get_nsteps, fset=_set_nsteps)
+ #.....
+ def _get_delta(self):
+ "Gets the current delta."
+ return self._delta
+ def _set_delta(self, delta):
+ "Sets the current delta, and refit if needed."
+ if delta < 0:
+ raise ValueError("delta should be positive!")
+ self._delta = delta
+ if self.activated:
+ self._caller.fit()
+ delta = property(fget=_get_delta, fset=_set_delta)
+ #............................................
+ class _outputs(object):
+ """Outputs of the lowess fit.
+
+:IVariables:
+ fitted_values : ndarray
+ A (n,) ndarray of fitted values (readonly).
+ fitted_residuals : ndarray
+ A (n,) ndarray of residuals (readonly).
+ weights : ndarray
+ A (n,) ndarray of robust weights (readonly).
+ """
+ def __init__(self, n):
+ self._fval = nempty((n,), float_)
+ self._rw = nempty((n,), float_)
+ self._fres = nempty((n,), float_)
+ #.....
+ fitted_values = property(fget=lambda self:self._fval)
+ robust_weights = property(fget=lambda self:self._rw)
+ fitted_residuals = property(fget=lambda self:self._fres)
+
+ #............................................
+ def __init__(self, x, y, span=0.5, nsteps=2, delta=0):
+ """
+:Parameters:
+ x : ndarray
+ Abscissas of the points on the scatterplot; the values in X must be
+ ordered from smallest to largest.
+ y : ndarray
+ Ordinates of the points on the scatterplot.
+ span : Float *[0.5]*
+ Fraction of the total number of points used to compute each fitted value.
+ As span increases the smoothed values become smoother. Choosing span in
+ the range .2 to .8 usually results in a good fit.
+ nsteps : Integer *[2]*
+ Number of iterations in the robust fit. If nsteps=0, the nonrobust fit
+ is returned; setting nsteps=2 should serve most purposes.
+ delta : Integer *[0]*
+ Nonnegative parameter which may be used to save computations.
+ If N (the number of elements in x) is less than 100, set delta=0.0;
+ if N is greater than 100 you should find out how delta works by reading
+ the additional instructions section.
+ """
+ # Chek the input data .........
+ # Initialize the attributes ...
+ self.inputs = lowess._inputs(x,y)
+ self.parameters = lowess._parameters(span, nsteps, delta, self)
+ self.outputs = lowess._outputs(self.inputs._x.size)
+ # Force a fit .................
+ self.fit()
+
+ #............................................
+ def fit(self):
+ """Computes the lowess fit. Returns a lowess.outputs object."""
+ (x, y) = (self.inputs._x, self.inputs._y)
+ # Get the parameters .....
+ self.parameters.activated = True
+ f = self.parameters._span
+ nsteps = self.parameters._nsteps
+ delta = self.parameters._delta
+ (tmp_s, tmp_w, tmp_r) = _lowess.lowess(x, y, f, nsteps, delta)
+ # Process the outputs .....
+ #... set the values
+ self.outputs.fitted_values[:] = tmp_s.flat
+ self.outputs.robust_weights[:] = tmp_w.flat
+ self.outputs.fitted_residuals[:] = tmp_r.flat
+ # Clean up the mess .......
+ del(tmp_s, tmp_w, tmp_r)
+ return self.outputs
+
+
#####---------------------------------------------------------------------------
#--- --- STL ---
#####---------------------------------------------------------------------------
@@ -393,3 +610,9 @@
"""
loess_anova = _loess.anova
+
+################################################################################
+if __name__ == '__main__':
+ from maskedarray.testutils import assert_almost_equal
+ from maskedarray import masked_values
+
Modified: trunk/Lib/sandbox/pyloess/setup.py
===================================================================
--- trunk/Lib/sandbox/pyloess/setup.py 2007-03-26 19:37:12 UTC (rev 2873)
+++ trunk/Lib/sandbox/pyloess/setup.py 2007-03-27 06:38:36 UTC (rev 2874)
@@ -29,15 +29,25 @@
build_info = {}
dict_append(build_info, **blas_info)
dict_append(build_info, libraries=['floess'])
- c_sources = ['_loess.c', 'loess.c', 'loessc.c', 'misc.c', 'predict.c',]
+ c_sources = ['loess.c', 'loessc.c', 'misc.c', 'predict.c',]
confgr.add_extension('_loess',
- sources=[join('src', x) for x in c_sources],
+ sources=[join('src','_loess.c')] + \
+ [join('src', x) for x in c_sources],
depends = [join('src','*.h'),
join('src','*.pyx'),
join('src','*.pxd')
],
**build_info
)
+ confgr.add_extension('_mloess',
+ sources=[join('src','_mloess.c')] + \
+ [join('src', x) for x in c_sources],
+ depends = [join('src','*.h'),
+ join('src','*.pyx'),
+ join('src','*.pxd')
+ ],
+ **build_info
+ )
confgr.add_data_dir('tests')
return confgr
Modified: trunk/Lib/sandbox/pyloess/src/_loess.c
===================================================================
--- trunk/Lib/sandbox/pyloess/src/_loess.c 2007-03-26 19:37:12 UTC (rev 2873)
+++ trunk/Lib/sandbox/pyloess/src/_loess.c 2007-03-27 06:38:36 UTC (rev 2874)
@@ -1,4 +1,4 @@
-/* Generated by Pyrex 0.9.5.1a on Wed Mar 21 17:37:22 2007 */
+/* Generated by Pyrex 0.9.5.1a on Sun Mar 25 18:15:15 2007 */
#include "Python.h"
#include "structmember.h"
@@ -71,6 +71,14 @@
struct __pyx_obj_6_loess_loess_inputs {
PyObject_HEAD
loess_inputs (*_base);
+ PyArrayObject *w_ndr;
+ PyArrayObject *x;
+ PyArrayObject *y;
+ PyArrayObject *masked;
+ PyArrayObject *x_eff;
+ PyArrayObject *y_eff;
+ int nobs;
+ int npar;
};
@@ -101,13 +109,19 @@
struct __pyx_obj_6_loess_loess_outputs {
PyObject_HEAD
+ struct __pyx_vtabstruct_6_loess_loess_outputs *__pyx_vtab;
loess_outputs (*_base);
long nobs;
long npar;
int activated;
};
+struct __pyx_vtabstruct_6_loess_loess_outputs {
+ PyObject *((*setup)(struct __pyx_obj_6_loess_loess_outputs *,loess_outputs (*),long ,long ));
+};
+static struct __pyx_vtabstruct_6_loess_loess_outputs *__pyx_vtabptr_6_loess_loess_outputs;
+
struct __pyx_obj_6_loess_conf_intervals {
PyObject_HEAD
struct __pyx_vtabstruct_6_loess_conf_intervals *__pyx_vtab;
@@ -146,8 +160,6 @@
struct __pyx_obj_6_loess_loess_kd_tree *kd_tree;
struct __pyx_obj_6_loess_loess_outputs *outputs;
struct __pyx_obj_6_loess_loess_predicted *predicted;
- long nobs;
- long npar;
};
@@ -168,9 +180,9 @@
static PyTypeObject *__pyx_ptype_6_loess_loess_predicted = 0;
static PyTypeObject *__pyx_ptype_6_loess_loess = 0;
static PyTypeObject *__pyx_ptype_6_loess_anova = 0;
-static PyObject *__pyx_k32;
-static PyObject *__pyx_k33;
-static PyObject *__pyx_k34;
+static PyObject *__pyx_k9;
+static PyObject *__pyx_k10;
+static PyObject *__pyx_k11;
static PyObject *(__pyx_f_6_loess_floatarray_from_data(int ,int ,double (*))); /*proto*/
static PyObject *(__pyx_f_6_loess_boolarray_from_data(int ,int ,int (*))); /*proto*/
@@ -178,40 +190,18 @@
/* Implementation of _loess */
static char (__pyx_k1[]) = "A (n,) ndarray of weights to be given to individual observations in the \n sum of squared residuals that forms the local fitting criterion. If not\n None, the weights should be non negative. If the different observations\n have non-equal variances, the weights should be inversely proportional \n to the variances.\n By default, an unweighted fit is carried out (all the weights are one).\n ";
-static char (__pyx_k2[]) = "Number of observations.";
-static char (__pyx_k3[]) = "Number of independent variables.";
-static char (__pyx_k4[]) = "\n surface : string [\"interpolate\"]\n Determines whether the fitted surface is computed directly at all points\n (\"direct\") or whether an interpolation method is used (\"interpolate\").\n The default (\"interpolate\") is what most users should use unless special \n circumstances warrant.\n ";
-static char (__pyx_k5[]) = "\n statistics : string [\"approximate\"]\n Determines whether the statistical quantities are computed exactly \n (\"exact\") or approximately (\"approximate\"). \"exact\" should only be used \n for testing the approximation in statistical development and is not meant \n for routine usage because computation time can be horrendous.\n ";
-static char (__pyx_k6[]) = "\n trace_hat : string [\"wait.to.decide\"]\n Determines how the trace of the hat matrix should be computed. The hat\n matrix is used in the computation of the statistical quantities. \n If \"exact\", an exact computation is done; this could be slow when the\n number of observations n becomes large. If \"wait.to.decide\" is selected, \n then a default is \"exact\" for n < 500 and \"approximate\" otherwise. \n This option is only useful when the fitted surface is interpolated. If \n surface is \"exact\", an exact computation is always done for the trace. \n Setting trace_hat to \"approximate\" for large dataset will substantially \n reduce the computation time.\n ";
-static char (__pyx_k7[]) = "\n iterations : integer\n Number of iterations of the robust fitting method. If the family is \n \"gaussian\", the number of iterations is set to 0.\n ";
-static char (__pyx_k8[]) = "\n cell : integer\n Maximum cell size of the kd-tree. Suppose k = floor(n*cell*span),\n where n is the number of observations, and span the smoothing parameter.\n Then, a cell is further divided if the number of observations within it \n is greater than or equal to k. This option is only used if the surface \n is interpolated.\n ";
-static char (__pyx_k9[]) = "\n normalize : boolean [True]\n Determines whether the independent variables should be normalized. \n If True, the normalization is performed by setting the 10% trimmed \n standard deviation to one. If False, no normalization is carried out. \n This option is only useful for more than one variable. For spatial\n coordinates predictors or variables with a common scale, it should be \n set to False.\n ";
-static char (__pyx_k10[]) = "Smoothing factor, as a fraction of the number of points to take into\n account. By default, span=0.75.";
-static char (__pyx_k11[]) = "\n degree : integer [2]\n Overall degree of locally-fitted polynomial. 1 is locally-linear \n fitting and 2 is locally-quadratic fitting. Degree should be 2 at most.\n ";
-static char (__pyx_k12[]) = "\n family : string [\"gaussian\"]\n Determines the assumed distribution of the errors. The values are \n \"gaussian\" or \"symmetric\". If \"gaussian\" is selected, the fit is \n performed with least-squares. If \"symmetric\" is selected, the fit\n is performed robustly by redescending M-estimators.\n ";
-static char (__pyx_k13[]) = "\n parametric_flags : sequence [ [False]*p ]\n Indicates which independent variables should be conditionally-parametric\n (if there are two or more independent variables). The argument should \n be a sequence of booleans, with the same size as the number of independent \n variables, specified in the order of the predictor group ordered in x. \n ";
-static char (__pyx_k14[]) = "\n drop_square : sequence [ [False]* p]\n When there are two or more independent variables and when a 2nd order\n polynomial is used, \"drop_square_flags\" specifies those numeric predictors \n whose squares should be dropped from the set of fitting variables. \n The method of specification is the same as for parametric. \n ";
-static char (__pyx_k15[]) = "\n fitted_values : ndarray\n The (n,) ndarray of fitted values.\n ";
-static char (__pyx_k16[]) = "\n fitted_residuals : ndarray\n The (n,) ndarray of fitted residuals (observations - fitted values).\n ";
-static char (__pyx_k17[]) = "\n pseudovalues : ndarray\n The (n,) ndarray of adjusted values of the response when robust estimation \n is used.\n ";
-static char (__pyx_k18[]) = "\n diagonal :\n Diagonal of the operator hat matrix.\n ";
-static char (__pyx_k19[]) = "\n robust : ndarray\n The (n,) ndarray of robustness weights for robust fitting.\n ";
-static char (__pyx_k20[]) = "Equivalent number of parameters.";
-static char (__pyx_k21[]) = "\n enp : float\n Equivalent number of parameters.\n ";
-static char (__pyx_k22[]) = "\n s : float\n Estimate of the scale of residuals.\n ";
-static char (__pyx_k23[]) = "\n one_delta: float\n Statistical parameter used in the computation of standard errors.\n ";
-static char (__pyx_k24[]) = "\n two_delta : float\n Statistical parameter used in the computation of standard errors.\n ";
-static char (__pyx_k25[]) = "\n trace_hat : float \n Trace of the operator hat matrix.\n ";
-static char (__pyx_k26[]) = "\n values : ndarray\n The (m,) ndarray of loess values evaluated at newdata\n ";
-static char (__pyx_k27[]) = "\n stderr : ndarray\n The (m,) ndarray of the estimates of the standard error on the estimated\n values.\n ";
-static char (__pyx_k28[]) = "\n residual_scale : float\n Estimate of the scale of the residuals\n ";
-static char (__pyx_k29[]) = "\n df : integer\n Degrees of freedom of the t-distribution used to compute pointwise \n confidence intervals for the evaluated surface.\n ";
-static char (__pyx_k31[]) = "\n:Keywords:\n x : ndarray\n A (n,p) ndarray of independent variables, with n the number of observations\n and p the number of variables.\n y : ndarray\n A (n,) ndarray of observations\n weights : ndarray\n A (n,) ndarray of weights to be given to individual observations in the \n sum of squared residuals that forms the local fitting criterion. If not\n None, the weights should be non negative. If the different observations\n have non-equal variances, the weights should be inversely proportional \n to the variances.\n By default, an unweighted fit is carried out (all the weights are one).\n surface : string [\"interpolate\"]\n Determines whether the fitted surface is computed directly at all points\n (\"direct\") or whether an interpolation method is used (\"interpolate\").\n The default (\"interpolate\") is what most users should use unless special \n circumstances warrant.\n statistics : string [\"approximate\"]\n Determines whether the statistical quantities are computed exactly \n (\"exact\") or approximately (\"approximate\"). \"exact\" should only be used \n for testing the approximation in statistical development and is not meant \n for routine usage because computation time can be horrendous.\n trace_hat : string [\"wait.to.decide\"]\n Determines how the trace of the hat matrix should be computed. The hat\n matrix is used in the computation of the statistical quantities. \n If \"exact\", an exact computation is done; this could be slow when the\n number of observations n becomes large. If \"wait.to.decide\" is selected, \n then a default is \"exact\" for n < 500 and \"approximate\" otherwise. \n This option is only useful when the fitted surface is interpolated. If \n surface is \"exact\", an exact computation is always done for the trace. \n Setting trace_hat to \"approximate\" for large dataset will substantially \n reduce the computation time.\n iterations : integer\n Number of iterations of the robust fitting method. If the family is \n \"gaussian\", the number of iterations is set to 0.\n cell : integer\n Maximum cell size of the kd-tree. Suppose k = floor(n*cell*span),\n where n is the number of observations, and span the smoothing parameter.\n Then, a cell is further divided if the number of observations within it \n is greater than or equal to k. This option is only used if the surface \n is interpolated.\n span : float [0.75]\n Smoothing factor, as a fraction of the number of points to take into\n account. \n degree : integer [2]\n Overall degree of locally-fitted polynomial. 1 is locally-linear \n fitting and 2 is locally-quadratic fitting. Degree should be 2 at most.\n normalize : boolean [True]\n Determines whether the independent variables should be normalized. \n If True, the normalization is performed by setting the 10% trimmed \n standard deviation to one. If False, no normalization is carried out. \n This option is only useful for more than one variable. For spatial\n coordinates predictors or variables with a common scale, it should be \n set to False.\n family : string [\"gaussian\"]\n Determines the assumed distribution of the errors. The values are \n \"gaussian\" or \"symmetric\". If \"gaussian\" is selected, the fit is \n performed with least-squares. If \"symmetric\" is selected, the fit\n is performed robustly by redescending M-estimators.\n parametric_flags : sequence [ [False]*p ]\n Indicates which independent variables should be conditionally-parametric\n (if there are two or more independent variables). The argument should \n be a sequence of booleans, with the same size as the number of independent \n variables, specified in the order of the predictor group ordered in x. \n drop_square : sequence [ [False]* p]\n When there are two or more independent variables and when a 2nd order\n polynomial is used, \"drop_square_flags\" specifies those numeric predictors \n whose squares should be dropped from the set of fitting variables. \n The method of specification is the same as for parametric. \n \n:Outputs:\n fitted_values : ndarray\n The (n,) ndarray of fitted values.\n fitted_residuals : ndarray\n The (n,) ndarray of fitted residuals (observations - fitted values).\n enp : float\n Equivalent number of parameters.\n s : float\n Estimate of the scale of residuals.\n one_delta: float\n Statistical parameter used in the computation of standard errors.\n two_delta : float\n Statistical parameter used in the computation of standard errors.\n pseudovalues : ndarray\n The (n,) ndarray of adjusted values of the response when robust estimation \n is used.\n trace_hat : float \n Trace of the operator hat matrix.\n diagonal :\n Diagonal of the operator hat matrix.\n robust : ndarray\n The (n,) ndarray of robustness weights for robust fitting.\n divisor : ndarray\n The (p,) array of normalization divisors for numeric predictors.\n \n\n newdata : ndarray\n The (m,p) array of independent variables where the surface must be estimated.\n values : ndarray\n The (m,) ndarray of loess values evaluated at newdata\n stderr : ndarray\n The (m,) ndarray of the estimates of the standard error on the estimated\n values.\n residual_scale : float\n Estimate of the scale of the residuals\n df : integer\n Degrees of freedom of the t-distribution used to compute pointwise \n confidence intervals for the evaluated surface.\n nest : integer\n Number of new observations.\n \n \n";
+static char (__pyx_k2[]) = "\n surface : string [\"interpolate\"]\n Determines whether the fitted surface is computed directly at all points\n (\"direct\") or whether an interpolation method is used (\"interpolate\").\n The default (\"interpolate\") is what most users should use unless special \n circumstances warrant.\n ";
+static char (__pyx_k3[]) = "\n statistics : string [\"approximate\"]\n Determines whether the statistical quantities are computed exactly \n (\"exact\") or approximately (\"approximate\"). \"exact\" should only be used \n for testing the approximation in statistical development and is not meant \n for routine usage because computation time can be horrendous.\n ";
+static char (__pyx_k4[]) = "\n trace_hat : string [\"wait.to.decide\"]\n Determines how the trace of the hat matrix should be computed. The hat\n matrix is used in the computation of the statistical quantities. \n If \"exact\", an exact computation is done; this could be slow when the\n number of observations n becomes large. If \"wait.to.decide\" is selected, \n then a default is \"exact\" for n < 500 and \"approximate\" otherwise. \n This option is only useful when the fitted surface is interpolated. If \n surface is \"exact\", an exact computation is always done for the trace. \n Setting trace_hat to \"approximate\" for large dataset will substantially \n reduce the computation time.\n ";
+static char (__pyx_k5[]) = "\n iterations : integer\n Number of iterations of the robust fitting method. If the family is \n \"gaussian\", the number of iterations is set to 0.\n ";
+static char (__pyx_k6[]) = "\n cell : integer\n Maximum cell size of the kd-tree. Suppose k = floor(n*cell*span),\n where n is the number of observations, and span the smoothing parameter.\n Then, a cell is further divided if the number of observations within it \n is greater than or equal to k. This option is only used if the surface \n is interpolated.\n ";
+static char (__pyx_k8[]) = "\n \n\n newdata : ndarray\n The (m,p) array of independent variables where the surface must be estimated.\n values : ndarray\n The (m,) ndarray of loess values evaluated at newdata\n stderr : ndarray\n The (m,) ndarray of the estimates of the standard error on the estimated\n values.\n residual_scale : float\n Estimate of the scale of the residuals\n df : integer\n Degrees of freedom of the t-distribution used to compute pointwise \n confidence intervals for the evaluated surface.\n nest : integer\n Number of new observations.\n \n \n";
static PyObject *__pyx_n_c_python;
static PyObject *__pyx_n_c_numpy;
static PyObject *__pyx_n_numpy;
static PyObject *__pyx_n_narray;
+static PyObject *__pyx_n_float_;
static PyObject *__pyx_n_c_loess;
static PyObject *__pyx_n_array;
static PyObject *__pyx_n_False;
@@ -228,36 +218,36 @@
PyObject *__pyx_4 = 0;
__pyx_v_a_ndr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":19 */
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":20 */
__pyx_v_size = (__pyx_v_rows * __pyx_v_cols);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":20 */
- __pyx_1 = PyArray_SimpleNewFromData(1,(&__pyx_v_size),NPY_DOUBLE,__pyx_v_data); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
- if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":21 */
+ __pyx_1 = PyArray_SimpleNewFromData(1,(&__pyx_v_size),NPY_DOUBLE,__pyx_v_data); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
Py_INCREF(((PyObject *)__pyx_1));
Py_DECREF(((PyObject *)__pyx_v_a_ndr));
__pyx_v_a_ndr = ((PyArrayObject *)((PyObject *)__pyx_1));
Py_DECREF(__pyx_1); __pyx_1 = 0;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":21 */
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":22 */
__pyx_2 = (__pyx_v_cols > 1);
if (__pyx_2) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":22 */
- __pyx_1 = PyInt_FromLong(__pyx_v_rows); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
- __pyx_3 = PyInt_FromLong(__pyx_v_cols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
- __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":23 */
+ __pyx_1 = PyInt_FromLong(__pyx_v_rows); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
+ __pyx_3 = PyInt_FromLong(__pyx_v_cols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
__pyx_1 = 0;
__pyx_3 = 0;
- if (PyObject_SetAttr(((PyObject *)__pyx_v_a_ndr), __pyx_n_shape, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
+ if (PyObject_SetAttr(((PyObject *)__pyx_v_a_ndr), __pyx_n_shape, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":23 */
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":24 */
Py_INCREF(((PyObject *)__pyx_v_a_ndr));
__pyx_r = ((PyObject *)__pyx_v_a_ndr);
goto __pyx_L0;
@@ -288,44 +278,44 @@
PyObject *__pyx_4 = 0;
__pyx_v_a_ndr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":28 */
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":29 */
__pyx_v_size = (__pyx_v_rows * __pyx_v_cols);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":29 */
- __pyx_1 = PyArray_SimpleNewFromData(1,(&__pyx_v_size),NPY_DOUBLE,__pyx_v_data); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
- if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":30 */
+ __pyx_1 = PyArray_SimpleNewFromData(1,(&__pyx_v_size),NPY_DOUBLE,__pyx_v_data); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
Py_INCREF(((PyObject *)__pyx_1));
Py_DECREF(((PyObject *)__pyx_v_a_ndr));
__pyx_v_a_ndr = ((PyArrayObject *)((PyObject *)__pyx_1));
Py_DECREF(__pyx_1); __pyx_1 = 0;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":30 */
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":31 */
__pyx_2 = (__pyx_v_cols > 1);
if (__pyx_2) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":31 */
- __pyx_1 = PyInt_FromLong(__pyx_v_rows); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
- __pyx_3 = PyInt_FromLong(__pyx_v_cols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
- __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":32 */
+ __pyx_1 = PyInt_FromLong(__pyx_v_rows); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_3 = PyInt_FromLong(__pyx_v_cols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
__pyx_1 = 0;
__pyx_3 = 0;
- if (PyObject_SetAttr(((PyObject *)__pyx_v_a_ndr), __pyx_n_shape, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ if (PyObject_SetAttr(((PyObject *)__pyx_v_a_ndr), __pyx_n_shape, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":32 */
- __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_a_ndr), __pyx_n_astype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
- __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_numpy); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
- __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_bool); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":33 */
+ __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_a_ndr), __pyx_n_astype); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_numpy); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
+ __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_bool); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
__pyx_4 = 0;
- __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_r = __pyx_4;
@@ -345,135 +335,299 @@
return __pyx_r;
}
-static PyObject *__pyx_f_6_loess_12loess_inputs_1x___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6_loess_12loess_inputs_1x___get__(PyObject *__pyx_v_self) {
- PyObject *__pyx_r;
- PyObject *__pyx_1 = 0;
- Py_INCREF(__pyx_v_self);
+static PyObject *__pyx_n_copy;
+static PyObject *__pyx_n_True;
+static PyObject *__pyx_n_subok;
+static PyObject *__pyx_n_dtype;
+static PyObject *__pyx_n_order;
+static PyObject *__pyx_n_C;
+static PyObject *__pyx_n_ndim;
+static PyObject *__pyx_n_ValueError;
+static PyObject *__pyx_n_len;
+static PyObject *__pyx_n_ravel;
+static PyObject *__pyx_n_ones;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":198 */
- __pyx_1 = __pyx_f_6_loess_floatarray_from_data(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->n,((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->p,((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->x); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;}
- __pyx_r = __pyx_1;
- __pyx_1 = 0;
- goto __pyx_L0;
+static PyObject *__pyx_k22p;
- __pyx_r = Py_None; Py_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1:;
- Py_XDECREF(__pyx_1);
- __Pyx_AddTraceback("_loess.loess_inputs.x.__get__");
- __pyx_r = 0;
- __pyx_L0:;
- Py_DECREF(__pyx_v_self);
- return __pyx_r;
-}
+static char (__pyx_k22[]) = "The array of indepedent varibales should be 2D at most!";
-static PyObject *__pyx_f_6_loess_12loess_inputs_1y___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6_loess_12loess_inputs_1y___get__(PyObject *__pyx_v_self) {
- PyObject *__pyx_r;
+static int __pyx_f_6_loess_12loess_inputs___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6_loess_12loess_inputs___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_x_data = 0;
+ PyObject *__pyx_v_y_data = 0;
+ int __pyx_r;
PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ int __pyx_5;
+ static char *__pyx_argnames[] = {"x_data","y_data",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_x_data, &__pyx_v_y_data)) return -1;
Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_x_data);
+ Py_INCREF(__pyx_v_y_data);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":202 */
- __pyx_1 = __pyx_f_6_loess_floatarray_from_data(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->n,1,((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->y); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
- __pyx_r = __pyx_1;
- __pyx_1 = 0;
- goto __pyx_L0;
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":89 */
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_narray); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_x_data);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x_data);
+ __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_copy, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_subok, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_float_); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_dtype, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (PyDict_SetItem(__pyx_3, __pyx_n_order, __pyx_n_C) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x));
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x = ((PyArrayObject *)__pyx_4);
+ __pyx_4 = 0;
- __pyx_r = Py_None; Py_INCREF(Py_None);
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":90 */
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_narray); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_y_data);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_y_data);
+ __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_copy, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_subok, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_float_); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_dtype, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (PyDict_SetItem(__pyx_3, __pyx_n_order, __pyx_n_C) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->y));
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->y = ((PyArrayObject *)__pyx_4);
+ __pyx_4 = 0;
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":92 */
+ __pyx_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x), __pyx_n_ndim); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_5 = __pyx_5 == 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_5) {
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":93 */
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->npar = 1;
+ goto __pyx_L2;
+ }
+ __pyx_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x), __pyx_n_ndim); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
+ __pyx_4 = PyInt_FromLong(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_3, __pyx_4, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
+ __pyx_5 = __pyx_5 == 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_5) {
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":95 */
+ __pyx_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x), __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong((-1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_5 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->npar = __pyx_5;
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":97 */
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ Py_INCREF(__pyx_k22p);
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k22p);
+ __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __Pyx_Raise(__pyx_2, 0, 0);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+ }
+ __pyx_L2:;
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":98 */
+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x));
+ PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x));
+ __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->nobs = __pyx_5;
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":100 */
+ __pyx_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x), __pyx_n_ravel); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
+ __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x_eff));
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->x_eff = ((PyArrayObject *)__pyx_3);
+ __pyx_3 = 0;
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":101 */
+ Py_INCREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->y));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->y_eff));
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->y_eff = ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->y;
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":102 */
+ __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_numpy); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_ones); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = PyInt_FromLong(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->nobs); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
+ __pyx_2 = 0;
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_2 = PyDict_New(); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_float_); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_2, __pyx_n_dtype, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_3 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->w_ndr));
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->w_ndr = ((PyArrayObject *)__pyx_3);
+ __pyx_3 = 0;
+
+ __pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
- __Pyx_AddTraceback("_loess.loess_inputs.y.__get__");
- __pyx_r = 0;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("_loess.loess_inputs.__init__");
+ __pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_x_data);
+ Py_DECREF(__pyx_v_y_data);
return __pyx_r;
}
static PyObject *__pyx_f_6_loess_12loess_inputs_7weights___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_loess_12loess_inputs_7weights___get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r;
- PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":213 */
- __pyx_1 = __pyx_f_6_loess_floatarray_from_data(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->n,1,((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->weights); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
- __pyx_r = __pyx_1;
- __pyx_1 = 0;
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":114 */
+ Py_INCREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->w_ndr));
+ __pyx_r = ((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->w_ndr);
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1:;
- Py_XDECREF(__pyx_1);
- __Pyx_AddTraceback("_loess.loess_inputs.weights.__get__");
- __pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
-static PyObject *__pyx_n_ndim;
static PyObject *__pyx_n_size;
-static PyObject *__pyx_n_ValueError;
-static PyObject *__pyx_k35p;
+static PyObject *__pyx_k26p;
-static char (__pyx_k35[]) = "Invalid size of the 'weights' vector!";
+static char (__pyx_k26[]) = "Invalid size of the 'weights' vector!";
static int __pyx_f_6_loess_12loess_inputs_7weights___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_w); /*proto*/
static int __pyx_f_6_loess_12loess_inputs_7weights___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_w) {
PyArrayObject *__pyx_v_w_ndr;
int __pyx_r;
PyObject *__pyx_1 = 0;
- int __pyx_2;
+ PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ int __pyx_5;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_w);
__pyx_v_w_ndr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":218 */
- __pyx_1 = PyArray_FROMANY(__pyx_v_w,NPY_DOUBLE,1,1,NPY_OWNDATA); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
- Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":119 */
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_narray); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_w);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_w);
+ __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_copy, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ if (PyDict_SetItem(__pyx_3, __pyx_n_subok, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_w_ndr));
- __pyx_v_w_ndr = ((PyArrayObject *)__pyx_1);
- Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_v_w_ndr = ((PyArrayObject *)__pyx_4);
+ __pyx_4 = 0;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":219 */
- __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_w_ndr), __pyx_n_ndim); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
- __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
- if (PyObject_Cmp(__pyx_1, __pyx_3, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
- __pyx_2 = __pyx_2 > 0;
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":120 */
+ __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_w_ndr), __pyx_n_ndim); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+ __pyx_5 = __pyx_5 > 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- if (!__pyx_2) {
- __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_w_ndr), __pyx_n_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
- __pyx_3 = PyInt_FromLong(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->n); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
- if (PyObject_Cmp(__pyx_1, __pyx_3, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
- __pyx_2 = __pyx_2 != 0;
- Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (!__pyx_5) {
+ __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_w_ndr), __pyx_n_size); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+ __pyx_4 = PyInt_FromLong(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->nobs); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_3, __pyx_4, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+ __pyx_5 = __pyx_5 != 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
}
- if (__pyx_2) {
+ if (__pyx_5) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":220 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
- __Pyx_Raise(__pyx_1, __pyx_k35p, 0);
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":121 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
+ __Pyx_Raise(__pyx_1, __pyx_k26p, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":221 */
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":122 */
+ Py_INCREF(((PyObject *)__pyx_v_w_ndr));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->w_ndr));
+ ((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->w_ndr = __pyx_v_w_ndr;
+
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":123 */
((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->weights = ((double (*))__pyx_v_w_ndr->data);
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("_loess.loess_inputs.weights.__set__");
__pyx_r = -1;
__pyx_L0:;
@@ -483,60 +637,14 @@
return __pyx_r;
}
-static PyObject *__pyx_f_6_loess_12loess_inputs_4nobs___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6_loess_12loess_inputs_4nobs___get__(PyObject *__pyx_v_self) {
- PyObject *__pyx_r;
- PyObject *__pyx_1 = 0;
- Py_INCREF(__pyx_v_self);
-
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":226 */
- __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->n); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
- __pyx_r = __pyx_1;
- __pyx_1 = 0;
- goto __pyx_L0;
-
- __pyx_r = Py_None; Py_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1:;
- Py_XDECREF(__pyx_1);
- __Pyx_AddTraceback("_loess.loess_inputs.nobs.__get__");
- __pyx_r = 0;
- __pyx_L0:;
- Py_DECREF(__pyx_v_self);
- return __pyx_r;
-}
-
-static PyObject *__pyx_f_6_loess_12loess_inputs_4npar___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6_loess_12loess_inputs_4npar___get__(PyObject *__pyx_v_self) {
- PyObject *__pyx_r;
- PyObject *__pyx_1 = 0;
- Py_INCREF(__pyx_v_self);
-
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":231 */
- __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6_loess_loess_inputs *)__pyx_v_self)->_base->p); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
- __pyx_r = __pyx_1;
- __pyx_1 = 0;
- goto __pyx_L0;
-
- __pyx_r = Py_None; Py_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1:;
- Py_XDECREF(__pyx_1);
- __Pyx_AddTraceback("_loess.loess_inputs.npar.__get__");
- __pyx_r = 0;
- __pyx_L0:;
- Py_DECREF(__pyx_v_self);
- return __pyx_r;
-}
-
static PyObject *__pyx_f_6_loess_13loess_control_7surface___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6_loess_13loess_control_7surface___get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":248 */
- __pyx_1 = PyString_FromString(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->surface); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":174 */
+ __pyx_1 = PyString_FromString(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->surface); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
@@ -556,11 +664,11 @@
static PyObject *__pyx_n_interpolate;
static PyObject *__pyx_n_direct;
-static PyObject *__pyx_k38p;
-static PyObject *__pyx_k39p;
+static PyObject *__pyx_k29p;
+static PyObject *__pyx_k30p;
-static char (__pyx_k38[]) = "Invalid value for the 'surface' argument: ";
-static char (__pyx_k39[]) = "should be in ('interpolate', 'direct').";
+static char (__pyx_k29[]) = "Invalid value for the 'surface' argument: ";
+static char (__pyx_k30[]) = "should be in ('interpolate', 'direct').";
static int __pyx_f_6_loess_13loess_control_7surface___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_surface); /*proto*/
static int __pyx_f_6_loess_13loess_control_7surface___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_surface) {
@@ -575,47 +683,47 @@
Py_INCREF(__pyx_v_surface);
__pyx_v_tmpx = Py_None; Py_INCREF(Py_None);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":250 */
- __pyx_1 = PyObject_GetAttr(__pyx_v_surface, __pyx_n_lower); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
- __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":176 */
+ __pyx_1 = PyObject_GetAttr(__pyx_v_surface, __pyx_n_lower); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
+ __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
Py_INCREF(__pyx_n_interpolate);
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_n_interpolate);
Py_INCREF(__pyx_n_direct);
PyTuple_SET_ITEM(__pyx_1, 1, __pyx_n_direct);
- __pyx_3 = PySequence_Contains(__pyx_1, __pyx_2); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
+ __pyx_3 = PySequence_Contains(__pyx_1, __pyx_2); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
__pyx_3 = !__pyx_3;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_3) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":251 */
- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
- __pyx_1 = PyNumber_Add(__pyx_k38p, __pyx_k39p); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
- __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":177 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
+ __pyx_1 = PyNumber_Add(__pyx_k29p, __pyx_k30p); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
__pyx_1 = 0;
- __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
+ __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
__Pyx_Raise(__pyx_1, 0, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":253 */
- __pyx_2 = PyObject_GetAttr(__pyx_v_surface, __pyx_n_lower); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;}
- __pyx_4 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":179 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_surface, __pyx_n_lower); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
+ __pyx_4 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_v_tmpx);
__pyx_v_tmpx = __pyx_4;
__pyx_4 = 0;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":254 */
- __pyx_5 = PyString_AsString(__pyx_v_tmpx); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":180 */
+ __pyx_5 = PyString_AsString(__pyx_v_tmpx); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->surface = __pyx_5;
__pyx_r = 0;
@@ -639,8 +747,8 @@
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":265 */
- __pyx_1 = PyString_FromString(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->statistics); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":191 */
+ __pyx_1 = PyString_FromString(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->statistics); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
@@ -659,9 +767,9 @@
static PyObject *__pyx_n_approximate;
static PyObject *__pyx_n_exact;
-static PyObject *__pyx_k42p;
+static PyObject *__pyx_k33p;
-static char (__pyx_k42[]) = "Invalid value for the 'statistics' argument: should be in ('approximate', 'exact').";
+static char (__pyx_k33[]) = "Invalid value for the 'statistics' argument: should be in ('approximate', 'exact').";
static int __pyx_f_6_loess_13loess_control_10statistics___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_statistics); /*proto*/
static int __pyx_f_6_loess_13loess_control_10statistics___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_statistics) {
@@ -676,46 +784,46 @@
Py_INCREF(__pyx_v_statistics);
__pyx_v_tmpx = Py_None; Py_INCREF(Py_None);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":267 */
- __pyx_1 = PyObject_GetAttr(__pyx_v_statistics, __pyx_n_lower); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; goto __pyx_L1;}
- __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":193 */
+ __pyx_1 = PyObject_GetAttr(__pyx_v_statistics, __pyx_n_lower); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
+ __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
Py_INCREF(__pyx_n_approximate);
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_n_approximate);
Py_INCREF(__pyx_n_exact);
PyTuple_SET_ITEM(__pyx_1, 1, __pyx_n_exact);
- __pyx_3 = PySequence_Contains(__pyx_1, __pyx_2); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; goto __pyx_L1;}
+ __pyx_3 = PySequence_Contains(__pyx_1, __pyx_2); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
__pyx_3 = !__pyx_3;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_3) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":268 */
- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
- Py_INCREF(__pyx_k42p);
- PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k42p);
- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":194 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
+ Py_INCREF(__pyx_k33p);
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k33p);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
__Pyx_Raise(__pyx_4, 0, 0);
Py_DECREF(__pyx_4); __pyx_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":270 */
- __pyx_2 = PyObject_GetAttr(__pyx_v_statistics, __pyx_n_lower); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
- __pyx_1 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":196 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_statistics, __pyx_n_lower); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
+ __pyx_1 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_v_tmpx);
__pyx_v_tmpx = __pyx_1;
__pyx_1 = 0;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":271 */
- __pyx_5 = PyString_AsString(__pyx_v_tmpx); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":197 */
+ __pyx_5 = PyString_AsString(__pyx_v_tmpx); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->statistics = __pyx_5;
__pyx_r = 0;
@@ -739,8 +847,8 @@
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":287 */
- __pyx_1 = PyString_FromString(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->trace_hat); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":213 */
+ __pyx_1 = PyString_FromString(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->trace_hat); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
@@ -756,9 +864,9 @@
return __pyx_r;
}
-static PyObject *__pyx_k45p;
+static PyObject *__pyx_k36p;
-static char (__pyx_k45[]) = "Invalid value for the 'trace_hat' argument: should be in ('approximate', 'exact').";
+static char (__pyx_k36[]) = "Invalid value for the 'trace_hat' argument: should be in ('approximate', 'exact').";
static int __pyx_f_6_loess_13loess_control_9trace_hat___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_trace_hat); /*proto*/
static int __pyx_f_6_loess_13loess_control_9trace_hat___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_trace_hat) {
@@ -773,46 +881,46 @@
Py_INCREF(__pyx_v_trace_hat);
__pyx_v_tmpx = Py_None; Py_INCREF(Py_None);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":289 */
- __pyx_1 = PyObject_GetAttr(__pyx_v_trace_hat, __pyx_n_lower); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
- __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":215 */
+ __pyx_1 = PyObject_GetAttr(__pyx_v_trace_hat, __pyx_n_lower); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
+ __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
- __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
Py_INCREF(__pyx_n_approximate);
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_n_approximate);
Py_INCREF(__pyx_n_exact);
PyTuple_SET_ITEM(__pyx_1, 1, __pyx_n_exact);
- __pyx_3 = PySequence_Contains(__pyx_1, __pyx_2); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
+ __pyx_3 = PySequence_Contains(__pyx_1, __pyx_2); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
__pyx_3 = !__pyx_3;
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_3) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":290 */
- __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
- __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
- Py_INCREF(__pyx_k45p);
- PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k45p);
- __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":216 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
+ Py_INCREF(__pyx_k36p);
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k36p);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
__Pyx_Raise(__pyx_4, 0, 0);
Py_DECREF(__pyx_4); __pyx_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":292 */
- __pyx_2 = PyObject_GetAttr(__pyx_v_trace_hat, __pyx_n_lower); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; goto __pyx_L1;}
- __pyx_1 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":218 */
+ __pyx_2 = PyObject_GetAttr(__pyx_v_trace_hat, __pyx_n_lower); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
+ __pyx_1 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_v_tmpx);
__pyx_v_tmpx = __pyx_1;
__pyx_1 = 0;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":293 */
- __pyx_5 = PyString_AsString(__pyx_v_tmpx); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":219 */
+ __pyx_5 = PyString_AsString(__pyx_v_tmpx); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->trace_hat = __pyx_5;
__pyx_r = 0;
@@ -836,8 +944,8 @@
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":302 */
- __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->iterations); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":228 */
+ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->iterations); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
@@ -853,9 +961,9 @@
return __pyx_r;
}
-static PyObject *__pyx_k46p;
+static PyObject *__pyx_k37p;
-static char (__pyx_k46[]) = "Invalid number of iterations: should be positive";
+static char (__pyx_k37[]) = "Invalid number of iterations: should be positive";
static int __pyx_f_6_loess_13loess_control_10iterations___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_iterations); /*proto*/
static int __pyx_f_6_loess_13loess_control_10iterations___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_iterations) {
@@ -867,30 +975,30 @@
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_iterations);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":304 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
- if (PyObject_Cmp(__pyx_v_iterations, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":230 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_v_iterations, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
__pyx_2 = __pyx_2 < 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_2) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":305 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}
- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}
- Py_INCREF(__pyx_k46p);
- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k46p);
- __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":231 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
+ Py_INCREF(__pyx_k37p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k37p);
+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__Pyx_Raise(__pyx_4, 0, 0);
Py_DECREF(__pyx_4); __pyx_4 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":306 */
- __pyx_2 = PyInt_AsLong(__pyx_v_iterations); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":232 */
+ __pyx_2 = PyInt_AsLong(__pyx_v_iterations); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->iterations = __pyx_2;
__pyx_r = 0;
@@ -913,8 +1021,8 @@
PyObject *__pyx_1 = 0;
Py_INCREF(__pyx_v_self);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":318 */
- __pyx_1 = PyFloat_FromDouble(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->cell); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":244 */
+ __pyx_1 = PyFloat_FromDouble(((struct __pyx_obj_6_loess_loess_control *)__pyx_v_self)->_base->cell); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
@@ -930,9 +1038,9 @@
return __pyx_r;
}
-static PyObject *__pyx_k47p;
+static PyObject *__pyx_k38p;
-static char (__pyx_k47[]) = "Invalid value for the cell argument: should be positive";
+static char (__pyx_k38[]) = "Invalid value for the cell argument: should be positive";
static int __pyx_f_6_loess_13loess_control_4cell___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cell); /*proto*/
static int __pyx_f_6_loess_13loess_control_4cell___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_cell) {
@@ -945,30 +1053,30 @@
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_cell);
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":320 */
- __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
- if (PyObject_Cmp(__pyx_v_cell, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":246 */
+ __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_v_cell, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; goto __pyx_L1;}
__pyx_2 = __pyx_2 <= 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_2) {
- /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":321 */
- __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; goto __pyx_L1;}
- __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; goto __pyx_L1;}
- Py_INCREF(__pyx_k47p);
- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k47p);
- __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; goto __pyx_L1;}
+ /* "/home/backtopop/workspace/pyloess/src/_loess.pyx":247 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;}
+ Py_INCREF(__pyx_k38p);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k38p);
+ __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__Pyx_Raise(__pyx_4, 0, 0);
Py_DECR