[MacPorts] #56954: python: numpy.polyfit broken

MacPorts noreply at macports.org
Thu Aug 9 11:49:55 UTC 2018


#56954: python: numpy.polyfit broken
--------------------+-------------------------------------------------
 Reporter:  mojca   |      Owner:  michaelld
     Type:  defect  |     Status:  assigned
 Priority:  Normal  |  Milestone:
Component:  ports   |    Version:
 Keywords:          |       Port:  py-numpy python27 python36 python37
--------------------+-------------------------------------------------
 There seems to be an issue with numpy.polyfit under various versions of
 python I tested (2.7, 3.6, 3.7).

 Running the following code under system python:
 {{{
 import numpy as np

 points = np.array([[0, -2.1108348e+04], [3.2768000e+04, -2.7959160e+03],
 [6.5534000e+04,  1.4279546e+04], [4.9151000e+04,  6.6721514e+03],
 [1.6384000e+04, -1.3232387e+04]], dtype=np.float32)

 koef1 = np.polyfit(points[:,0], points[:,1], 1)
 koef2 = np.polyfit(points[:,0], points[:,1], 2)
 }}}
 works and returns
 {{{
 >>> koef1
 array([  5.53485811e-01,  -2.13732832e+04], dtype=float32)
 >>> koef2
 array([ -4.00165135e-07,   5.79710186e-01,  -2.15881035e+04],
 dtype=float32)
 }}}

 However using python from MacPorts it looks much worse:
 {{{
 >>> koef1 = np.polyfit(points[:,0], points[:,1], 1)
 Python(83745,0x7fff9e546380) malloc: ***
 mach_vm_map(size=18446744072450498560) failed (error code=3)
 *** error: can't allocate region
 *** set a breakpoint in malloc_error_break to debug
 init_dgelsd failed init
 __main__:1: RankWarning: Polyfit may be poorly conditioned
 >>> koef2 = np.polyfit(points[:,0], points[:,1], 2)
 Python(83745,0x7fff9e546380) malloc: ***
 mach_vm_map(size=18446744072450498560) failed (error code=3)
 *** error: can't allocate region
 *** set a breakpoint in malloc_error_break to debug
 init_dgelsd failed init
 __main__:1: RankWarning: Polyfit may be poorly conditioned
 >>> koef1
 array([2.2937462e-317, 1.0438839e-312])
 >>> koef2
 array([5.05031302e+09, 8.97368555e+04, 2.23606798e+00])
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/56954>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list