From 7c361420b4f81713f593ebbb5c924121c1f2d19d Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Fri, 18 Nov 2022 15:11:25 +0100 Subject: MAINT: Move set_module to numpy.core to use without C import --- numpy/lib/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/utils.py') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index afde8cc60..2a9d30b16 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -6,8 +6,8 @@ import re import warnings import functools +from .._utils import set_module from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype -from numpy.core.overrides import set_module from numpy.core import ndarray, ufunc, asarray import numpy as np -- cgit v1.2.1 From 67b20a5065d634d6f7301fbc2fc5e5e263400ac9 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 21 Dec 2022 11:55:34 +0200 Subject: MAINT: expand show_rutime, add it to issue template [skip ci] --- numpy/lib/utils.py | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) (limited to 'numpy/lib/utils.py') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 2a9d30b16..8d2d2fe33 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -5,6 +5,7 @@ import types import re import warnings import functools +import platform from .._utils import set_module from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype @@ -24,6 +25,8 @@ def show_runtime(): including available intrinsic support and BLAS/LAPACK library in use + .. versionadded:: 1.24.0 + See Also -------- show_config : Show libraries in the system on which NumPy was built. @@ -31,45 +34,20 @@ def show_runtime(): Notes ----- 1. Information is derived with the help of `threadpoolctl `_ - library. + library if available. 2. SIMD related information is derived from ``__cpu_features__``, ``__cpu_baseline__`` and ``__cpu_dispatch__`` - Examples - -------- - >>> import numpy as np - >>> np.show_runtime() - [{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'], - 'found': ['SSSE3', - 'SSE41', - 'POPCNT', - 'SSE42', - 'AVX', - 'F16C', - 'FMA3', - 'AVX2'], - 'not_found': ['AVX512F', - 'AVX512CD', - 'AVX512_KNL', - 'AVX512_KNM', - 'AVX512_SKX', - 'AVX512_CLX', - 'AVX512_CNL', - 'AVX512_ICL']}}, - {'architecture': 'Zen', - 'filepath': '/usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so', - 'internal_api': 'openblas', - 'num_threads': 12, - 'prefix': 'libopenblas', - 'threading_layer': 'pthreads', - 'user_api': 'blas', - 'version': '0.3.20'}] """ from numpy.core._multiarray_umath import ( __cpu_features__, __cpu_baseline__, __cpu_dispatch__ ) from pprint import pprint - config_found = [] + config_found = [{ + "numpy_version": np.__version__, + "python": sys.version, + "uname": platform.uname(), + }] features_found, features_not_found = [], [] for feature in __cpu_dispatch__: if __cpu_features__[feature]: -- cgit v1.2.1 From d559513a682ae91a85d823b414df7588c04b1e5a Mon Sep 17 00:00:00 2001 From: warren Date: Tue, 7 Mar 2023 09:36:37 -0500 Subject: DOC: Document that info() handles array instances. [skip actions] [skip travis] [skip azp] [skip cirrus] --- numpy/lib/utils.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'numpy/lib/utils.py') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 8d2d2fe33..5d5770c71 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -533,10 +533,11 @@ def info(object=None, maxwidth=76, output=None, toplevel='numpy'): Parameters ---------- object : object or str, optional - Input object or name to get information about. If `object` is a - numpy object, its docstring is given. If it is a string, available - modules are searched for matching objects. If None, information - about `info` itself is returned. + Input object or name to get information about. If `object` is + an `ndarray` instance, information about the array is printed. + If `object` is a numpy object, its docstring is given. If it is + a string, available modules are searched for matching objects. + If None, information about `info` itself is returned. maxwidth : int, optional Printing width. output : file like object, optional @@ -575,6 +576,22 @@ def info(object=None, maxwidth=76, output=None, toplevel='numpy'): *** Repeat reference found in numpy.fft.fftpack *** *** Total of 3 references found. *** + When the argument is an array, information about the array is printed. + + >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) + >>> np.info(a) + class: ndarray + shape: (2, 3) + strides: (24, 8) + itemsize: 8 + aligned: True + contiguous: True + fortran: False + data pointer: 0x562b6e0d2860 + byteorder: little + byteswap: False + type: complex64 + """ global _namedict, _dictlist # Local import to speed up numpy's import time. -- cgit v1.2.1 From 3b57b3294e594d3635fecc13a0923994e8ab36fc Mon Sep 17 00:00:00 2001 From: warren Date: Tue, 7 Mar 2023 12:00:11 -0500 Subject: DOC: Edit top line of info() docstring to mention array. [skip actions] [skip travis] [skip azp] [skip cirrus] --- numpy/lib/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/utils.py') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 5d5770c71..b5add0ace 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -528,7 +528,7 @@ def _info(obj, output=None): @set_module('numpy') def info(object=None, maxwidth=76, output=None, toplevel='numpy'): """ - Get help information for a function, class, or module. + Get help information for an array, function, class, or module. Parameters ---------- -- cgit v1.2.1 From 700c0342a8dbfd5649e72b3ddfdd98f7c9cb58dc Mon Sep 17 00:00:00 2001 From: warren Date: Tue, 7 Mar 2023 18:04:01 -0500 Subject: DOC: Add 'may vary' markup in info() docstring. [skip actions] [skip travis] [skip cirrus] --- numpy/lib/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/utils.py') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index b5add0ace..095c914db 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -587,7 +587,7 @@ def info(object=None, maxwidth=76, output=None, toplevel='numpy'): aligned: True contiguous: True fortran: False - data pointer: 0x562b6e0d2860 + data pointer: 0x562b6e0d2860 # may vary byteorder: little byteswap: False type: complex64 -- cgit v1.2.1