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

log_{line_segments,point} fails when color is a numpy array #2486

Closed
roym899 opened this issue Jun 20, 2023 · 1 comment · Fixed by #2569
Closed

log_{line_segments,point} fails when color is a numpy array #2486

roym899 opened this issue Jun 20, 2023 · 1 comment · Fixed by #2569
Assignees
Labels
🪳 bug Something isn't working 🐍 Python API Python logging API 🏎️ Quick Issue Can be fixed in a few hours or less

Comments

@roym899
Copy link
Collaborator

roym899 commented Jun 20, 2023

Describe the bug

import rerun as rr
import numpy as np
rr.log_line_segments("points", [0.0, 0.0], color=np.array([0.5, 0.5, 0.5]))

fails with the following warning

WARNING:root:Ignoring rerun log call: Traceback (most recent call last):
  File "/home/leo/.pyenv/versions/widebaseline/lib/python3.10/site-packages/rerun_sdk/rerun/log/log_decorator.py", line 47, in wrapper
    return func(*args, **kwargs)
  File "/home/leo/.pyenv/versions/widebaseline/lib/python3.10/site-packages/rerun_sdk/rerun/log/lines.py", line 208, in log_line_segments
    if color:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The boolean value of a numpy array with more than one value is not defined and is also False for scalar arrays with 0 value. This can most likely be fixed by changing if color: to if color is not None:. Maybe worth checking if similar code is anywhere else in the codebase.

A workaround is to convert the color to a list first.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04

Rerun version

rerun_py 0.7.0 [rustc 1.69.0 (84c898d65 2023-04-16), LLVM 15.0.7] x86_64-unknown-linux-gnu prepare-0.7 9cf3033, built 2023-06-16T15:47:32Z
@roym899 roym899 added 👀 needs triage This issue needs to be triaged by the Rerun team 🪳 bug Something isn't working labels Jun 20, 2023
@roym899 roym899 changed the title log_line_segments fails when color is a numpy array log_{line_segments,point} fails when color is a numpy array Jun 20, 2023
@roym899
Copy link
Collaborator Author

roym899 commented Jun 20, 2023

Also happens for log_point, so I suspect there are a few more cases of this.

@nikolausWest nikolausWest added 🐍 Python API Python logging API and removed 👀 needs triage This issue needs to be triaged by the Rerun team labels Jun 21, 2023
@emilk emilk added the 🏎️ Quick Issue Can be fixed in a few hours or less label Jun 27, 2023
@Wumpf Wumpf self-assigned this Jun 29, 2023
emilk pushed a commit that referenced this issue Jun 30, 2023
plus fix bad error message when supplying single dimensional position
array to line_segments

Fixes #2486
*  #2486

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I have tested https://demo.rerun.io/pr/2569 (if applicable)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2569

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/89f20b6/docs
Examples preview: https://rerun.io/preview/89f20b6/examples
<!-- pr-link-docs:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 🐍 Python API Python logging API 🏎️ Quick Issue Can be fixed in a few hours or less
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants