[Numpy-discussion] Question about nump.ma.polyfit

Samuel Dupree sdupree at computational-astronomer.com
Mon Dec 14 23:39:34 EST 2015

I'm running Python 2.7.11 from the Anaconda distribution (version 2.4.1) 
on a MacBook Pro running Mac OS X version 10.11.2 (El Capitan)

I'm attempting to use numpy.ma.polyfit to perform a linear least square 
fit on some data I have. I'm running NumPy version 1.10.1. I've observed 
that in executing either numpy.polyfit or numpy.ma.polyfit I get the 
following traceback:

RankWarning: Polyfit may be poorly conditioned
   warnings.warn(msg, RankWarning)
Traceback (most recent call last):
   File "ComputeEnergy.py", line 132, in <module>
     coeffs, covar = np.ma.polyfit( xfit, yfit, fit_degree, 
rcond=rcondv, cov=True )
line 1951, in polyfit
     return np.polyfit(x, y, deg, rcond, full, w, cov)
line 607, in polyfit
     return c, Vbase * fac
ValueError: operands could not be broadcast together with shapes (6,6) (0,)

I've attached a stripped down version of the Python program I'm running.

Any suggestions?

Sam Dupree.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ComputeEnergy.py
Type: text/x-python-script
Size: 6133 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151214/0ff696d7/attachment.bin>

More information about the NumPy-Discussion mailing list