diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2010-05-21 05:36:13 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-05-21 05:36:13 +0000 |
commit | 082e86f7461f066f4a4e48191d44305f47860b55 (patch) | |
tree | 4739433d73ee41e6e23e31493abcef62a2d78f3f /numpy/polynomial/polytemplate.py | |
parent | 467f4fb2fe54ad979dc6c4aa3a11e7482b97fd0f (diff) | |
download | numpy-082e86f7461f066f4a4e48191d44305f47860b55.tar.gz |
CHG: Change the default domain for the fit class method of the
Chebyshev and Polynomial classes to None. Add 'default' as a possible
value of the domain argument to specify the default domain. This change
fits better with my experience with this method. I feel it is safe to
make this change at this late date because the functions seem little
used as yet and I would like to get them 'right' before folks catch on
to their presence.
Diffstat (limited to 'numpy/polynomial/polytemplate.py')
-rw-r--r-- | numpy/polynomial/polytemplate.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/numpy/polynomial/polytemplate.py b/numpy/polynomial/polytemplate.py index 835197834..08510c1ff 100644 --- a/numpy/polynomial/polytemplate.py +++ b/numpy/polynomial/polytemplate.py @@ -514,7 +514,7 @@ class $name(pu.PolyBase) : return pu.mapdomain(roots, $domain, self.domain) @staticmethod - def fit(x, y, deg, domain=$domain, rcond=None, full=False) : + def fit(x, y, deg, domain=None, rcond=None, full=False) : """Least squares fit to data. Return a `$name` instance that is the least squares fit to the data @@ -533,10 +533,11 @@ class $name(pu.PolyBase) : passing in a 2D-array that contains one dataset per column. deg : int Degree of the fitting polynomial - domain : {None, [beg, end]}, optional + domain : {None, [beg, end], 'default'}, optional Domain to use for the returned $name instance. If ``None``, - then a minimal domain that covers the points `x` is chosen. The - default value is ``$domain``. + then a minimal domain that covers the points `x` is chosen. + If ``'default'`` the default domain ``$domain`` is used. The + default value is ``None``. rcond : float, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be @@ -568,6 +569,8 @@ class $name(pu.PolyBase) : """ if domain is None : domain = pu.getdomain(x) + elif domain == 'default' : + domain = $domain xnew = pu.mapdomain(x, domain, $domain) res = ${nick}fit(xnew, y, deg, rcond=None, full=full) if full : |