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

fix a FutureWarning from numpy #2916

Merged
merged 1 commit into from
Sep 21, 2020

Conversation

neutrinoceros
Copy link
Member

PR Summary

CI logs still contain one FutureWarning from numpy
for instance

yt/geometry/tests/test_grid_container.py::test_grid_arrays_view
  /Users/clm/.pyenv/versions/3.8.5/envs/yt_dev/lib/python3.8/site-packages/numpy/core/_internal.py:38: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    format = dtype(obj[0], align=align)

This fixes it. However, I expect this to break the minimal setup run so I'll open as a draft for now.

@neutrinoceros neutrinoceros added bug api-consistency naming conventions, code deduplication, informative error messages, code smells... labels Sep 17, 2020
@matthewturk
Copy link
Member

Can you post the deprecation warning here?

@neutrinoceros
Copy link
Member Author

Here you go, that's what I found locally so far

yt/frontends/gadget/tests/test_outputs.py::test_gadget_binary
  /Users/clm/dev/python/yt-project/yt/yt/frontends/gadget/testing.py:56: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    header_dtype = np.dtype(
/Users/clm/dev/python/yt-project/yt/yt/frontends/gadget/testing.py:32: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    block_id_dtype = np.dtype([("id", "S", 4), ("offset", endian + "i4", 1)])

To be clear, I inspect the logs on Travis, then reproduce them locally. I think I got them all now.

@matthewturk
Copy link
Member

Wow, I'm not sure what the distinction between the two would be. Is it that one would be a non-flat array if you accessed just the dtype?

I also must confess I find the numpy change to be a tiny bit annoying, as it seems more natural to me the way we've always done it, by explicitly stating the number of items. Then again, I am sure there are aspects I'm not seeing or realizing!

@neutrinoceros
Copy link
Member Author

Wow, I'm not sure what the distinction between the two would be. Is it that one would be a non-flat array if you accessed just the dtype?

I. Have. No. Clue. 😅 (the warning is not exactly super clear to me)
I just want to clear the logs of preventable warnings so we can start paying attention to them when we get new ones :)

I also must confess I find the numpy change to be a tiny bit annoying, as it seems more natural to me the way we've always done it, by explicitly stating the number of items. Then again, I am sure there are aspects I'm not seeing or realizing!

I absolutely agree with you, but it seems reasonable to expect that they have good reasons to do this. In any case, numpy is too big a machine for us to fight against, I'd rather just ride the wave !

@neutrinoceros neutrinoceros marked this pull request as ready for review September 17, 2020 20:27
@cphyc cphyc merged commit 8650a91 into yt-project:master Sep 21, 2020
@neutrinoceros neutrinoceros deleted the hotfix_numpy_depr_warnings branch September 22, 2020 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-consistency naming conventions, code deduplication, informative error messages, code smells... bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants