Menu

#2 fix auto-07p for newer numpy

Unstable (example)
closed
None
5
2019-05-23
2018-09-19
No

Currently, if I import any data with auto-07p, like this

>>> import auto
>>> S2 = auto.load('S2', e='wf')
Runner configured
>>> S2['U(2)'][:3]
/usr/lib/auto-07p/python/Points.py:1086: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  r = rank(array_temp)
/usr/lib/auto-07p/python/Points.py:968: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  if rank(vals) == 0:
/usr/lib/auto-07p/python/Points.py:996: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  r=rank(self.indepvararray)
/usr/lib/auto-07p/python/Points.py:491: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  r = rank(array_temp)
array([-3.14145317, -3.14139868, -3.14134285])

it breaks matplotlib, for example:

>>> import matplotlib.pylab as plt
>>> plt.plot([1, 2, 3])
[...]
>>> plt.show(_)
[...]
  File "/home/sk/venv/dev/lib/python3.5/site-packages/numpy/core/numeric.py", line 868, in flatnonzero
    return np.nonzero(np.ravel(a))[0]
  File "/home/sk/venv/dev/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 1574, in ravel
    return asanyarray(a).ravel(order=order)
RecursionError: maximum recursion depth exceeded

It seems that removing numpy.nonzero override with flatnonzero - solves this problem.

1 Attachments

Discussion

  • Omer Tzuk

    Omer Tzuk - 2018-12-06

    I have commented out the line N.nonzero = N.flatnonzero, however, I still get an error message when I try to plot something using Python 3:

    $ auto
    Python 3.7.0 (default, Oct  9 2018, 10:31:47) 
    [GCC 7.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    (AUTOInteractiveConsole)
    AUTO> from autoutilities import plotCont
    AUTO> bif,ps=plotCont()
    ...
    Using plain TkInter for plotting. You can obtain better quality graphics
    using matplotlib (http://matplotlib.sf.net).
    Traceback (most recent call last):
    ...
    File ".../auto/07p/python/AUTOCommands.py", line 1840, in plot
        handle = windowPlotter.WindowPlotter2D(root,**options)
      File ".../auto/07p/python/graphics/windowPlotter.py", line 256, in __init__
        WindowPlotter.__init__(self,plotter.plotter,parent,**kw)
      File ".../auto/07p/python/graphics/windowPlotter.py", line 55, in __init__
        grapherClass,interior)
      File ".../auto/07p/python/graphics/Pmw.py", line 560, in createcomponent
        widget = widgetClass(*widgetArgs, **kw)
      File ".../auto/07p/python/graphics/plotter.py", line 102, in __init__
        self._plotNoDraw()
      File ".../auto/07p/python/graphics/plotter.py", line 343, in _plotNoDraw
        self.__plot7(*columns)
      File ".../auto/07p/python/graphics/plotter.py", line 607, in __plot7
        self.__plot7branch(branch,xcolumns,ycolumns,zcolumns)
      File ".../auto/07p/python/graphics/plotter.py", line 554, in __plot7branch
        xy = branch.coordarray[col]
      File ".../auto/07p/python/bifDiag.py", line 229, in __getattr__
        return super(bifDiagBranch, self).__getattr__(attr)
      File ".../auto/07p/python/parseB.py", line 297, in __getattr__
        self.__parse()
      File ".../auto/07p/python/parseB.py", line 343, in __parse
        stability = self.__parsenumpy(points)
      File ".../auto/07p/python/parseB.py", line 372, in __parsenumpy
        [len(points)-1]))
    
    ValueError: all the input arrays must have same number of dimensions
    AUTO> 
    
     
  • Bart Oldeman

    Bart Oldeman - 2019-05-23

    Please try:
    https://github.com/auto-07p/auto-07p
    it's fixed there and the plotter tested with Python 3, numpy and matplotlib.

     
  • Bart Oldeman

    Bart Oldeman - 2019-05-23
    • status: open --> closed
    • assigned_to: Bart Oldeman
     

Log in to post a comment.