question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug in examples/advanced/thinplate_grid.py?

See original GitHub issue

When running thinplate_grid.py, I have the following error. @marcomusy , could you have a look?

Python 3.7.3 (default, Mar 27 2019, 09:23:15) 
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.

from vtkplotter import *
import numpy as np

np.random.seed(2)

grids = []
for i in range(10):
    grids.append(Grid([0, 0, i / 10.0], resx=100, resy=100))
act = mergeActors(grids)  # merge grids into a single object

idxs = np.random.randint(0, act.N(), 10)  # pick 10 indexes

ptsource, pttarget = [], []
for i in idxs:
    ptold = act.getPoint(i) + np.random.randn(3) * 0.02
    ptsource.append(ptold)
    ptnew = ptold + [0, 0, np.random.randn(1) * 0.10]  # move in z
    pttarget.append(ptnew)

warped = thinPlateSpline(act, ptsource, pttarget)
warped.alpha(0.2).color("b")
# print(warped.getTransform())

apts = Points(ptsource, r=5, c="r")
arrs = Arrows(ptsource, pttarget)

show(warped, apts, arrs, Text(__doc__), axes=9, viewup="z", bg="w")

## -- End pasted text --
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-369e5917c20a> in <module>
    23 
    24 apts = Points(ptsource, r=5, c="r")
---> 25 arrs = Arrows(ptsource, pttarget)
    26 
    27 show(warped, apts, arrs, Text(__doc__), axes=9, viewup="z", bg="w")

/usr/local/lib/python3.7/site-packages/vtkplotter/shapes.py in Arrows(startPoints, endPoints, s, scale, c, alpha, res)
    584     arrg = Glyph(pts, arr.GetOutput(),
    585                  orientationArray=orients, scaleByVectorSize=True,
--> 586                  c=c, alpha=alpha)
    587     settings.collectable_actors.append(arrg)
    588     return arrg

/usr/local/lib/python3.7/site-packages/vtkplotter/shapes.py in Glyph(actor, glyphObj, orientationArray, scaleByVectorSize, c, alpha)
    192     gly.SetColorModeToColorByScalar()
    193 
--> 194     if orientationArray != "":
    195         gly.OrientOn()
    196         gly.SetScaleFactor(1)

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Gjacquenotcommented, May 18, 2019

Hi @marcomusy , I have tested version 3.0, and it works like a charm! Thanks for the patch!

0reactions
marcomusycommented, May 17, 2019

…is the error still there?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with Bugs — Python 3.11.1 documentation
A list of documentation bugs that have been submitted to the Python issue tracker. Overview of the process involved in reporting an improvement...
Read more >
Researchers find bug in Python script may have affected ...
Enlarge / A Python coding error may have bitten as many as 150 different published chemistry research studies. Hillary Kladke / Getty Images ......
Read more >
pytest-bug
Pytest plugin for marking tests as a bug.
Read more >
Find & Fix Code Bugs in Python: Debug With IDLE
In this tutorial, you'll learn how to identify and fix logic errors, or bugs, in your Python code. You'll use the built-in debugging...
Read more >
PyCharm (PY) - YouTrack - JetBrains
Not included in builds. chbndrhnns 22 Dec. M. PY-54084 Attaching debugger to Django console fails with Docker-compose · Targets API. 6. 23. 13....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found