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

Explicitly convert arrays to scalars in Python tutorial notebook #1281

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TyLindberg
Copy link
Contributor

When running the Python tutorial notebook, the following deprecation warning is printed for certain code blocks.

DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

There are two lines of code that cause this warning.

angle[i] = data.joint('root').qpos: data.joint('root').qpos is a single element array, which is implicitly converted to a scalar.
warning = mujoco.mjtWarning(warning_index).name: warning_index is a single element array, which is implicitly converted to a scalar.

This PR adjusts those sections of code to explicitly index into the array and avoid the implicit conversion numpy is performing.

Copy link
Collaborator

@btaba btaba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yuvaltassa
Copy link
Collaborator

Can you resolve the conflict please?

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

Successfully merging this pull request may close these issues.

None yet

3 participants