Skip to content

Commit 629f2c6

Browse files
committed
DOC: Fix docs issue
1 parent 8a57102 commit 629f2c6

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

doc/source/reference/routines.emath.rst

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,37 @@
33
Mathematical functions with automatic domain
44
********************************************
55

6-
.. currentmodule:: numpy
6+
.. currentmodule:: numpy.emath
77

8-
.. note:: :mod:`numpy.emath` is a preferred alias for ``numpy.lib.scimath``,
8+
.. note:: ``numpy.emath`` is a preferred alias for ``numpy.lib.scimath``,
99
available after :mod:`numpy` is imported.
1010

11-
.. automodule:: numpy.emath
11+
Wrapper functions to more user-friendly calling of certain math functions
12+
whose output data-type is different than the input data-type in certain
13+
domains of the input.
14+
15+
For example, for functions like `log` with branch cuts, the versions in this
16+
module provide the mathematically valid answers in the complex plane::
17+
18+
>>> import math
19+
>>> np.emath.log(-math.exp(1)) == (1+1j*math.pi)
20+
True
21+
22+
Similarly, `sqrt`, other base logarithms, `power` and trig functions
23+
are correctly handled. See their respective docstrings for specific examples.
24+
25+
Functions
26+
---------
27+
28+
.. autosummary::
29+
:toctree: generated/
30+
31+
arccos
32+
arcsin
33+
arctanh
34+
log
35+
log2
36+
logn
37+
log10
38+
power
39+
sqrt

numpy/_core/tests/test_umath.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4019,14 +4019,15 @@ def test_array_ufunc_direct_call(self):
40194019
def test_ufunc_docstring(self):
40204020
original_doc = np.add.__doc__
40214021
new_doc = "new docs"
4022+
expected_dict = {} if IS_PYPY else {"__module__": "numpy"}
40224023

40234024
np.add.__doc__ = new_doc
40244025
assert np.add.__doc__ == new_doc
40254026
assert np.add.__dict__["__doc__"] == new_doc
40264027

40274028
del np.add.__doc__
40284029
assert np.add.__doc__ == original_doc
4029-
assert np.add.__dict__ == {"__module__": "numpy"}
4030+
assert np.add.__dict__ == expected_dict
40304031

40314032
np.add.__dict__["other"] = 1
40324033
np.add.__dict__["__doc__"] = new_doc
@@ -4035,7 +4036,7 @@ def test_ufunc_docstring(self):
40354036
del np.add.__dict__["__doc__"]
40364037
assert np.add.__doc__ == original_doc
40374038
del np.add.__dict__["other"]
4038-
assert np.add.__dict__ == {"__module__": "numpy"}
4039+
assert np.add.__dict__ == expected_dict
40394040

40404041

40414042
class TestChoose:

0 commit comments

Comments
 (0)