Here are the examples of the python api numpy.copysign taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
0
Example 1
Project: python-skyfield Source File: units.py
def _unsexagesimalize(value):
"""Return `value` after interpreting a (units, minutes, seconds) tuple.
When `value` is not a tuple, it is simply returned.
>>> _unsexagesimalize(3.25)
3.25
An input tuple is interpreted as units, minutes, and seconds. Note
that only the sign of `units` is significant! So all of the
following tuples convert into exactly the same value:
>>> '%f' % _unsexagesimalize((-1, 2, 3))
'-1.034167'
>>> '%f' % _unsexagesimalize((-1, -2, 3))
'-1.034167'
>>> '%f' % _unsexagesimalize((-1, -2, -3))
'-1.034167'
"""
if isinstance(value, tuple):
for i, component in enumerate(value):
if i:
value = value + copysign(component, value) * 60.0 ** -i
else:
value = component
return value
0
Example 2
def _scale(self,index):
domain = self._domain
base = self._base
return np.copysign(1.0,domain) * np.log(np.abs(domain))/np.log(base)
0
Example 3
def _process_domain(self):
domain = self._domain
exponent = self._exponents
domain = np.copysign(1,domain) * np.power(np.abs(domain), exponent)
return domain
0
Example 4
Project: numba Source File: test_math.py
def test_math_copysign(self):
self.binary_template_float32(math_copysign, np.copysign, start=-1)
self.binary_template_float64(math_copysign, np.copysign, start=-1)