summaryrefslogtreecommitdiff
path: root/numpy/lib/scimath.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-07-30 18:06:28 -0600
committerJulian Taylor <jtaylor.debian@googlemail.com>2014-07-31 21:21:17 +0200
commit01b0d7e82211b581aaff925e3ccc36cff9ac1895 (patch)
tree8ec68353d5f09b9f0411948f1345ec79f5443b4c /numpy/lib/scimath.py
parentdec6658cdc10a23ad0e733fb52a814306033d88c (diff)
downloadnumpy-01b0d7e82211b581aaff925e3ccc36cff9ac1895.tar.gz
STY: Make files in numpy/lib PEP8 compliant.
The rules enforced are the same as those used for scipy.
Diffstat (limited to 'numpy/lib/scimath.py')
-rw-r--r--numpy/lib/scimath.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py
index 3da86d9c8..e07caf805 100644
--- a/numpy/lib/scimath.py
+++ b/numpy/lib/scimath.py
@@ -17,16 +17,21 @@ correctly handled. See their respective docstrings for specific examples.
"""
from __future__ import division, absolute_import, print_function
-__all__ = ['sqrt', 'log', 'log2', 'logn', 'log10', 'power', 'arccos',
- 'arcsin', 'arctanh']
-
import numpy.core.numeric as nx
import numpy.core.numerictypes as nt
from numpy.core.numeric import asarray, any
from numpy.lib.type_check import isreal
+
+__all__ = [
+ 'sqrt', 'log', 'log2', 'logn', 'log10', 'power', 'arccos', 'arcsin',
+ 'arctanh'
+ ]
+
+
_ln2 = nx.log(2.0)
+
def _tocomplex(arr):
"""Convert its input `arr` to a complex array.
@@ -109,9 +114,10 @@ def _fix_real_lt_zero(x):
>>> np.lib.scimath._fix_real_lt_zero([-1,2])
array([-1.+0.j, 2.+0.j])
+
"""
x = asarray(x)
- if any(isreal(x) & (x<0)):
+ if any(isreal(x) & (x < 0)):
x = _tocomplex(x)
return x
@@ -163,7 +169,7 @@ def _fix_real_abs_gt_1(x):
array([ 0.+0.j, 2.+0.j])
"""
x = asarray(x)
- if any(isreal(x) & (abs(x)>1)):
+ if any(isreal(x) & (abs(x) > 1)):
x = _tocomplex(x)
return x