summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix typos found by copdespellDimitri Papadopoulos2023-02-111-1/+1
|
* MAINT: Fix stacklevels for the new C dispatcher not adding oneSebastian Berg2023-01-171-1/+1
|
* MAINT: Move set_module to numpy.core to use without C importSebastian Berg2022-11-241-1/+2
|
* MAINT: fix typo (#20862)Ruben Garcia2022-01-201-1/+1
| | | [ci skip]
* DOC: Do not leave space between directive name and double colon.Matthias Bussonnier2021-11-031-1/+1
| | | | | | | | | | | From my regular expression foo, those are the only 9 case whereas there are about ~2000 usage that do not have spaces. While this is ok with docutils/sphinx, it does not seem to be documented, and that means that other parsers will see that as comments, leading to for example improper syntax highlighting. This make it also a tiny bit harder to develop alternative rst parsers.
* DOC: fix formatting of a return value of polynomial fit methodsSamyak S Sarnayak2021-09-211-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #19897 The 2nd return value of the following methods/functions were badly formatted and the list was all appearing in a single line. Changed them to separate points which are rendered nicely. - numpy.polyfit - numpy.ma.polyfit - numpy.polynomial.polynomial.polyfit - numpy.polynomial.polynomial.Polynomial.fit - numpy.polynomial.chebyshev.chebfit - numpy.polynomial.chebyshev.Chebyshev.fit - numpy.polynomial.hermite.hermfit - numpy.polynomial.hermite.Hermite.fit - numpy.polynomial.hermite_e.hermefit - numpy.polynomial.hermite_e.HermiteE.fit - numpy.polynomial.laguerre.lagfit - numpy.polynomial.laguerre.Laguerre.fit - numpy.polynomial.legendre.legfit - numpy.polynomial.legendre.Legendre.fit Also fixed erroneous links to `numpy.full` which were actually referring to the `full` argument. Changed those to code strings (double backticks) from single backticks. Also fixed formatting issues in the 3rd return value of numpy.polyfit (and hence also numpy.ma.polyfit).
* MAINT: refactor "for ... in range(len(" statementsMike Taves2021-09-011-12/+11
|
* DOC: Adjust polyfit doc to clarify the meaning of w (#18421)Mike Jarvis2021-06-081-3/+6
| | | | | | | | | | | | | | | | | * DOC: Adjust polyfit doc to clarify the meaning of w cov='unscaled', in particular, had inconsistently referred to a weight of 1/sigma**2, while the doc for w says it should be equal to 1/sigma. This change clarifies w to comport with more typical meanings of weights in weighted least squares, and makes clear that cov='unscaled' is appropriate when the weight w**2 = 1/sigma**2. See Issue #5261 for more discussion of the errors/confusion in the previous doc string. * Update doc text for w in all polynomial module fit functions Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* BUG: Fixed an issue wherein `poly1d.__getitem__` could return scalars of the ↵Bas van Beek2021-05-281-7/+7
| | | | wrong dtype
* MAINT: regex char class improveTyler Reddy2020-12-281-1/+1
| | | | | | | | | | | | | * replace superfluous single-character regex character classes with their literal string equivalents; this avoids the overhead associated with a character class when there's only a single character enclosed (so there's no benefit to the class overhead) * for more information see: Chapter 6 of: Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O’Reilly Media, 2009.
* DOC: Fix a couple of reference to verbatim and vice versaMatthias Bussonnier2020-12-181-2/+2
| | | | | | | | | | | | | | | | This update a coupe of references (single backticks) that actually are not to verbatim/code (double backticks); and a couple of verbatim to reference when they do actually exists and can be resolved in context. I probably missed other; and stayed simple but spoted a few other inconsistencies that I did not fix: - some ``...`` could actually be :math:`...` but not always clear if it would be better. - some intervals are [``...``], other are ``[...]`` I guess they could be discussed individually; it was mostly the failing references that bothered me.
* DOC: Fix doctestsEric Wieser2020-10-241-3/+3
|
* use integer literal instead of floatCameron Blocker2020-10-181-1/+1
| | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* BUG: Respect dtype of all-zero argument to poly1dCameron Blocker2020-10-171-1/+1
| | | | | Fixes gh-16354. Previously np.poly1d(z).coeffs.dtype would always be np.float64 for zero array z, regardless of z's dtype.
* BUG: fix typo in polydiv that prevented promotion to poly1d (#17053)jakobjakobson132020-08-171-1/+1
| | | Fix bug caused by typo and added tests
* Update to polynomial.pydavidedalbosco2020-07-151-5/+6
| | | | | Edited the documentation of polyfit. The scaling factor of the covariance matrix in the description was erroneous, the correct form is chi2/dof. The code already used this correct scaling, just the description needed to be updated.
* DOC: Add transition note to all lib/poly functionsRoss Barnowski2020-05-061-0/+66
| | | | | | Adds a `.. note::` right after the description to all functions/classes from the numpy.lib.polynomial module notifying the user that the numpy.polynomial package is preferred.
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-051-1/+1
| | | | | | | Inheriting from object was necessary for Python 2 compatibility to use new-style classes. In Python 3, this is unnecessary as there are no old-style classes. Dropping the object is more idiomatic Python.
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* DOC: clarify residual in np.polyfitSeth Troisi2019-10-021-4/+4
|
* BUG: Increment stacklevel for warnings to account for NEP-18 overrides (#13589)Stephan Hoyer2019-05-201-1/+1
| | | | | | | | | | | | | | * Increment stacklevel for warnings to account for NEP-18 overrides For NumPy functions that make use of `__array_function__`, the appropriate the stack level for warnings should generally be increased by 1 to account for the override function defined in numpy.core.overrides. Fixes GH-13329 * Update numpy/lib/type_check.py Co-Authored-By: Sebastian Berg <sebastian@sipsolutions.net>
* Merge branch 'master' into poly1d-fixes-fixes-fixes-fixesEric Wieser2019-04-161-48/+119
|\
| * DOC: fix 4 remaining doc build warnings.Ralf Gommers2019-04-141-2/+4
| | | | | | | | 2 for polyfit rankwarning, 2 for divide by zero in log10.
| * DOC: fix some more See Also issuesRalf Gommers2019-04-141-5/+4
| | | | | | | | These ones just generated warnings, not build failures
| * Merge pull request #12239 from daten-kieker/polyval_2477Marten van Kerkwijk2019-01-041-1/+3
| |\ | | | | | | BUG: polyval returned non-masked arrays for masked input.
| | * BUG: polyval returned Non-Masked Arrays for Masked Input.Joachim Hereth2018-10-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This fix will preserve subtypes of ndarray when given as input (x) to the polyval function. In particular, the results for masked values of a masked array will be masked. Fixes #2477.
| * | TST, DOC: enable refguide_checkTyler Reddy2018-12-141-21/+22
| | | | | | | | | | | | | | | | | | | | | | | | * ported the refguide_check module from SciPy for usage in NumPy docstring execution/ verification; added the refguide_check run to Azure Mac OS CI * adjusted NumPy docstrings such that refguide_check passes
| * | Removed non-standard scaling of the covariance matrix and added option to ↵Andreas Nussbaumer2018-11-211-11/+19
| | | | | | | | | | | | disable scaling completely.
| * | DOC: Fix typo in polyint.Alon Hershenhorn2018-11-151-1/+1
| | | | | | | | | | | | | | | Change differentiate to integrate in parameter `p` description. Fixes #12386.
| * | ENH: set correct __module__ for objects in numpy's public APIStephan Hoyer2018-11-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes GH-12271 Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to ``'numpy'``, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed. I also identified a handful of functions for which I had accidentally not setup dispatch for with ``__array_function__`` before, because they were listed under "ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in trusting code comments :).
| * | MAINT: set preferred __module__ for numpy functionsStephan Hoyer2018-10-231-1/+6
| | |
| * | ENH: __array_function__ support for np.lib, part 2/2 (#12119)Stephan Hoyer2018-10-221-0/+52
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH: __array_function__ support for np.lib, part 2 xref GH12028 np.lib.npyio through np.lib.ufunclike * Fix failures in numpy/core/tests/test_overrides.py * CLN: handle depreaction in dispatchers for np.lib.ufunclike * CLN: fewer dispatchers in lib.twodim_base * CLN: fewer dispatchers in lib.shape_base * CLN: more dispatcher consolidation * BUG: fix test failure * Use all method instead of function in assert_equal * DOC: indicate n is array_like in scimath.logn * MAINT: updates per review * MAINT: more conservative changes in assert_array_equal * MAINT: add back in comment * MAINT: casting tweaks in assert_array_equal * MAINT: fixes and tests for assert_array_equal on subclasses
| * DOC: Small docstring fixes for old polyfit.Charles Harris2018-08-151-2/+1
| | | | | | | | | | * Remove misleading reference to numpy/polynomial/polynomial/polyfit. * Add missing period in numpy/polynomial/_polybase.py
| * DOC: recommend polynomial.Polynomial over np.polyfit (#11733)Matti Picus2018-08-141-1/+6
| | | | | | | | | | | | | | | | | | | | * DOC: reccomend polynomail.Polynomial over np.polyfit * update from review * update from review, fix links * fix from review
| * HTTP -> HTTPS, and other linkrot fixesMike Toews2018-06-161-2/+2
| |
| * MAINT: move matrix tests in lib to matrixlib.Marten van Kerkwijk2018-04-291-5/+0
| |
| * BUG: Fixed polydiv for Complex Numbers (#10473)Deepak Kumar Gouda2018-01-301-1/+1
| | | | | | | | | | | | This previously failed with: TypeError: Cannot cast ufunc subtract output from dtype('complex128') to dtype('float64') with casting rule 'same_kind'
* | BUG: Return the coefficients array directlyEric Wieser2017-07-081-2/+8
|/ | | | | | | Turns out that this was relied upon downstream We also add a setter for coeffs, so that augmented assignment does not both change state and raise an exception suggesting state could not be changed.
* TST: Prove that poly1d coeffs are immutableEric Wieser2017-03-211-3/+2
| | | | Remove the comment suggesting that they are not
* BUG: Prevent modification of coefficientsEric Wieser2017-03-211-1/+1
| | | | | | | `poly.coeffs = 1` has always failed with a strong exception guarantee. However, `poly.coeffs += 1` would both change the state and fail. Now both fail without affecting the value.
* BUG: Fix regression in scipy that relied on quirky behaviourEric Wieser2017-03-211-0/+10
| | | | Scipy needs `.__dict__['coeffs']` to work, so we can't call the member _coeffs
* DEP: Deprecate copying random properties in __init__Eric Wieser2017-03-091-2/+9
|
* MAINT: Remove weird __setattr__ logic emulating propertiesEric Wieser2017-03-091-27/+32
| | | | | Presumably written long before @property existed. This means we don't need __dict__ everywhere
* BUG: Prevent crash in poly1d.__eq__Eric Wieser2017-03-091-0/+4
| | | | Fixes #8760
* MAINT: replace len(x.shape) with x.ndimEric Wieser2017-02-241-2/+2
|
* DOC: Fix erroneous return type description for np.roots.Stuart Archibald2016-09-231-1/+1
| | | | | | | | | | | | | | np.roots() does not always return complex roots, the roots of a polynomial depend its coefficients and therefore may be in the real or complex domain. e.g. ``` >>> (np.roots([1,2,3])).dtype dtype('complex128') >>> (np.roots([1,2,])).dtype dtype('float64') ```
* ENH: Add stacklevel to all (or almost all) our function callsSebastian Berg2016-09-021-1/+1
|
* DOC: Fixed documented dimension of return value Joseph Fox-Rabinovitz2016-08-261-1/+1
| | | The first dimension of the return value depends on the degree of the polynomial, not the number of elements being used in the fit.
* TST: Test that polyfit raises if not enough data for cov estimate.Charles Harris2016-06-151-3/+3
| | | | Also a slight refactoring of np.polyfit.
* BUG: Make sure we don't divide by zero in np.polyfit.David Schaich2016-06-151-0/+3
| | | | | | | | This should fix the issue discussed at https://mail.scipy.org/pipermail/numpy-discussion/2013-July/067076.html Without the ValueError added here, polyfit can (and does) return negative or nan variances with no warning.