Skip to content
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

Analysis for scaling type 'threads' throws numpy rint error #64

Open
JanVogelsang opened this issue Apr 11, 2023 · 1 comment
Open

Analysis for scaling type 'threads' throws numpy rint error #64

JanVogelsang opened this issue Apr 11, 2023 · 1 comment

Comments

@JanVogelsang
Copy link
Contributor

JanVogelsang commented Apr 11, 2023

With matplotlib 3.5.2, numpy 1.22.3 and Python 3.10.4 (defaults on Jureca with Stages/2023), the analysis.py script fails when using the scaling type 'threads' while it doesn't with scaling type 'nodes'. See the stacktrace below:

/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/ticker.py:795: VisibleDeprecationWarning:
Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated.
If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  locs = (np.asarray(_locs) - self.offset) / 10. ** self.orderOfMagnitude
AttributeError: 'numpy.ndarray' object has no attribute 'rint'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/p/scratch/cjinb33/ci-bennch/production/jureca/userdata/vogelsang1/1681206505/bennch/results/../analysis/analysis.py", line 50, in <module>
    plot(
  File "/p/scratch/cjinb33/ci-bennch/production/jureca/userdata/vogelsang1/1681206505/bennch/analysis/plot_helper.py", line 144, in plot
    plt.savefig(f'{save_path}/{timer_hash}.png', dpi=600)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/pyplot.py", line 979, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/figure.py", line 3046, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/backend_bases.py", line 2295, in print_figure
    self.figure.draw(renderer)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/artist.py", line 73, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
    return draw(artist, renderer)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/figure.py", line 2828, in draw
    self.execute_constrained_layout(renderer)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/figure.py", line 3186, in execute_constrained_layout
    return do_constrained_layout(fig, renderer, h_pad, w_pad,
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/_constrained_layout.py", line 110, in do_constrained_layout
    make_layout_margins(layoutgrids, fig, renderer, h_pad=h_pad,
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/_constrained_layout.py", line 315, in make_layout_margins
    pos, bbox = get_pos_and_bbox(ax, renderer)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/_constrained_layout.py", line 548, in get_pos_and_bbox
    tightbbox = ax.get_tightbbox(renderer=renderer)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 4632, in get_tightbbox
    bb_xaxis = self.xaxis.get_tightbbox(renderer)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/axis.py", line 1103, in get_tightbbox
    ticks_to_draw = self._update_ticks()
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/axis.py", line 1046, in _update_ticks
    major_labels = self.major.formatter.format_ticks(major_locs)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/ticker.py", line 223, in format_ticks
    self.set_locs(values)
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/ticker.py", line 713, in set_locs
    self._set_format()
  File "/p/software/jurecadc/stages/2023/software/matplotlib/3.5.2-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/matplotlib/ticker.py", line 812, in _set_format
    if np.abs(locs - np.round(locs, decimals=sigfigs)).max() < thresh:
  File "<__array_function__ internals>", line 180, in round_
  File "/p/software/jurecadc/stages/2023/software/SciPy-bundle/2022.05-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 3773, in round_
    return around(a, decimals=decimals, out=out)
  File "<__array_function__ internals>", line 180, in around
  File "/p/software/jurecadc/stages/2023/software/SciPy-bundle/2022.05-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 3348, in around
    return _wrapfunc(a, 'round', decimals=decimals, out=out)
  File "/p/software/jurecadc/stages/2023/software/SciPy-bundle/2022.05-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 66, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/p/software/jurecadc/stages/2023/software/SciPy-bundle/2022.05-gcccoremkl-11.3.0-2022.1.0/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 43, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
TypeError: loop of ufunc does not support argument 0 of type numpy.ndarray which has no callable rint method

I got the suspicion, that the deprecation warning in the very first line could be the cause of the error here.

@JanVogelsang
Copy link
Contributor Author

Fixed by INM-6/beNNch-plot#30.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant