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

Prevent deprecation warning #267

Merged
merged 2 commits into from Jul 28, 2023
Merged

Conversation

joaander
Copy link
Member

Description

Manually unpack scalar quantities from numpy arrays.

Motivation and Context

This prevents the following deprecation warning:

gsd/test/test_hoomd.py: 10 warnings
  /Users/joaander/build/gsd/gsd/hoomd.py:1170: 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.)                                                            
    logged_data_dict[log][idx] = data 

How Has This Been Tested?

I executed the tests locally and no longer observe the warning:

(venv) cheme-walker:~/build/gsd ▶ pytest gsd
======================================================================= test session starts ========================================================================
platform darwin -- Python 3.11.4, pytest-7.3.2, pluggy-1.0.0
rootdir: /Users/joaander/build/gsd
plugins: anyio-3.6.2
collected 125 items                                                                                                                                                

gsd/test/test_fl.py ..............................................................................                                                           [ 62%]
gsd/test/test_hoomd.py ............................................                                                                                          [ 97%]
gsd/test/test_largefile.py sss                                                                                                                               [100%]

================================================================== 122 passed, 3 skipped in 2.00s ==================================================================
(venv) cheme-walker:~/build/gsd ▶

Checklist:

  • I have reviewed the Contributor Guidelines.
  • I agree with the terms of the GSD Contributor Agreement.
  • My name is on the list of contributors (doc/credits.rst) in the pull request source branch.
  • I have added a change log entry to CHANGELOG.rst.

@joaander joaander requested review from a team as code owners July 26, 2023 16:56
@joaander joaander requested review from tommy-waltmann and janbridley and removed request for a team July 26, 2023 16:56
Copy link

@janbridley janbridley left a comment

Choose a reason for hiding this comment

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

Looks good to me

@joaander joaander merged commit e254ba7 into trunk-patch Jul 28, 2023
34 checks passed
@joaander joaander deleted the prevent-deprecation-warning branch July 28, 2023 16:24
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

2 participants