Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ENH, WIP: Add 2-D fitting function for polynomials #14151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
Loading
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix initial checks
  • Loading branch information
AWehrhahn committed May 13, 2020
commit 4cd2c036f0e227ff9e1bca9a17b3ba2d64e17d55
20 changes: 10 additions & 10 deletions 20 numpy/polynomial/polyutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,23 +776,23 @@ def _fitnd(vandernd_f, coords, data, deg=1, rcond=None, full=False, w=None,
if deg.ndim == 1 and not deg.size == ndim:
raise ValueError(f"deg must be of length {ndim}, if it is a 1d array")
if deg.ndim == ndim and np.all(deg == 0):
raise ValueError("deg must have at least one non-zero value")
raise ValueError(f"deg must have at least one non-zero value, if it is an {ndim} dimensional array")
if deg.ndim not in [0, 1, ndim]:
raise TypeError(f"deg must be an array of dimension {ndim}")
raise TypeError(f"deg must be an array of dimension 0, 1, or {ndim}")
if deg.min() < 0:
raise ValueError("expected deg >= 0")
if data.ndim < 1 or data.ndim != ndim:
raise TypeError(f"expected 1D or {ndim}D array for z")
raise ValueError("expected all deg >= 0")
if data.ndim != 1 and data.ndim != ndim:
raise TypeError(f"expected 1D or {ndim}D array for data")
if data.size == 0:
raise TypeError("expected non-empty vector for z")
raise TypeError("expected non-empty vector for data")
npoints = len(data)
for x in coords:
for i, x in enumerate(coords):
if x.ndim != 1 and x.ndim != ndim:
raise TypeError(f"expected 1D or {ndim}D vector for x")
raise TypeError(f"expected 1D or {ndim}D vector for coords[{i}]")
if x.size == 0:
raise TypeError("expected non-empty vector for x")
raise TypeError(f"expected non-empty vector for coords[{i}]")
if len(x) != npoints:
raise TypeError("expected coords and data to have same length")
raise TypeError(f"expected coords[{i}] and data to have the same length")
if w is not None:
eric-wieser marked this conversation as resolved.
Show resolved Hide resolved
if w.ndim != 1 and w.ndim != ndim:
raise TypeError(f"expected 1D or {ndim}D vector for w")
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.