Python numpy.arctan() Examples
The following are 30
code examples of numpy.arctan().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy
, or try the search function
.
Example #1
Source File: tf_gmm_tools.py From tf-example-models with Apache License 2.0 | 7 votes |
def _plot_gaussian(mean, covariance, color, zorder=0): """Plots the mean and 2-std ellipse of a given Gaussian""" plt.plot(mean[0], mean[1], color[0] + ".", zorder=zorder) if covariance.ndim == 1: covariance = np.diag(covariance) radius = np.sqrt(5.991) eigvals, eigvecs = np.linalg.eig(covariance) axis = np.sqrt(eigvals) * radius slope = eigvecs[1][0] / eigvecs[1][1] angle = 180.0 * np.arctan(slope) / np.pi plt.axes().add_artist(pat.Ellipse( mean, 2 * axis[0], 2 * axis[1], angle=angle, fill=False, color=color, linewidth=1, zorder=zorder ))
Example #2
Source File: test_umath.py From recruit with Apache License 2.0 | 6 votes |
def test_branch_cuts_complex64(self): # check branch cuts and continuity on them _check_branch_cut(np.log, -0.5, 1j, 1, -1, True, np.complex64) _check_branch_cut(np.log2, -0.5, 1j, 1, -1, True, np.complex64) _check_branch_cut(np.log10, -0.5, 1j, 1, -1, True, np.complex64) _check_branch_cut(np.log1p, -1.5, 1j, 1, -1, True, np.complex64) _check_branch_cut(np.sqrt, -0.5, 1j, 1, -1, True, np.complex64) _check_branch_cut(np.arcsin, [ -2, 2], [1j, 1j], 1, -1, True, np.complex64) _check_branch_cut(np.arccos, [ -2, 2], [1j, 1j], 1, -1, True, np.complex64) _check_branch_cut(np.arctan, [0-2j, 2j], [1, 1], -1, 1, True, np.complex64) _check_branch_cut(np.arcsinh, [0-2j, 2j], [1, 1], -1, 1, True, np.complex64) _check_branch_cut(np.arccosh, [ -1, 0.5], [1j, 1j], 1, -1, True, np.complex64) _check_branch_cut(np.arctanh, [ -2, 2], [1j, 1j], 1, -1, True, np.complex64) # check against bogus branch cuts: assert continuity between quadrants _check_branch_cut(np.arcsin, [0-2j, 2j], [ 1, 1], 1, 1, False, np.complex64) _check_branch_cut(np.arccos, [0-2j, 2j], [ 1, 1], 1, 1, False, np.complex64) _check_branch_cut(np.arctan, [ -2, 2], [1j, 1j], 1, 1, False, np.complex64) _check_branch_cut(np.arcsinh, [ -2, 2, 0], [1j, 1j, 1], 1, 1, False, np.complex64) _check_branch_cut(np.arccosh, [0-2j, 2j, 2], [1, 1, 1j], 1, 1, False, np.complex64) _check_branch_cut(np.arctanh, [0-2j, 2j, 0], [1, 1, 1j], 1, 1, False, np.complex64)
Example #3
Source File: pano_lsd_align.py From HorizonNet with MIT License | 6 votes |
def computeUVN_vec(n, in_, planeID): ''' vectorization version of computeUVN @n N x 3 @in_ MN x 1 @planeID N ''' n = n.copy() if (planeID == 2).sum(): n[planeID == 2] = np.roll(n[planeID == 2], 2, axis=1) if (planeID == 3).sum(): n[planeID == 3] = np.roll(n[planeID == 3], 1, axis=1) n = np.repeat(n, in_.shape[0] // n.shape[0], axis=0) assert n.shape[0] == in_.shape[0] bc = n[:, [0]] * np.sin(in_) + n[:, [1]] * np.cos(in_) bs = n[:, [2]] out = np.arctan(-bc / (bs + 1e-9)) return out
Example #4
Source File: KnownRVSurvey.py From EXOSIMS with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, **specs): # call prototype constructor SurveySimulation.__init__(self, **specs) TL = self.TargetList SU = self.SimulatedUniverse # reinitialize working angles and delta magnitudes used for integration self.WAint = np.zeros(TL.nStars)*u.arcsec self.dMagint = np.zeros(TL.nStars) # calculate estimates of shortest WAint and largest dMagint for each target for sInd in range(TL.nStars): pInds = np.where(SU.plan2star == sInd)[0] self.WAint[sInd] = np.arctan(np.min(SU.a[pInds])/TL.dist[sInd]).to('arcsec') phis = np.array([np.pi/2]*pInds.size) dMags = deltaMag(SU.p[pInds], SU.Rp[pInds], SU.a[pInds], phis) self.dMagint[sInd] = np.min(dMags) # populate outspec with arrays self._outspec['WAint'] = self.WAint.value self._outspec['dMagint'] = self.dMagint
Example #5
Source File: _continuous_distns.py From lambda-packs with MIT License | 6 votes |
def _cdf(self, x, c): output = np.zeros(x.shape, dtype=x.dtype) val = (1.0+c)/(1.0-c) c1 = x < np.pi c2 = 1-c1 xp = np.extract(c1, x) xn = np.extract(c2, x) if np.any(xn): valn = np.extract(c2, np.ones_like(x)*val) xn = 2*np.pi - xn yn = np.tan(xn/2.0) on = 1.0-1.0/np.pi*np.arctan(valn*yn) np.place(output, c2, on) if np.any(xp): valp = np.extract(c1, np.ones_like(x)*val) yp = np.tan(xp/2.0) op = 1.0/np.pi*np.arctan(valp*yp) np.place(output, c1, op) return output
Example #6
Source File: utils.py From tf-example-models with Apache License 2.0 | 6 votes |
def _plot_gaussian(mean, covariance, color, zorder=0): """Plots the mean and 2-std ellipse of a given Gaussian""" plt.plot(mean[0], mean[1], color[0] + ".", zorder=zorder) if covariance.ndim == 1: covariance = np.diag(covariance) radius = np.sqrt(5.991) eigvals, eigvecs = np.linalg.eig(covariance) axis = np.sqrt(eigvals) * radius slope = eigvecs[1][0] / eigvecs[1][1] angle = 180.0 * np.arctan(slope) / np.pi plt.axes().add_artist(pat.Ellipse( mean, 2 * axis[0], 2 * axis[1], angle=angle, fill=False, color=color, linewidth=1, zorder=zorder ))
Example #7
Source File: utils.py From speech_separation with MIT License | 6 votes |
def phase_enhance_pred(mix_STFT,pred_file, mode='STFT'): if mode=='wav': T_pred, _ = librosa.load(pred_file,sr=16000) F_pred = fast_stft(T_pred) if mode =='STFT': F_pred = pred_file M = np.sqrt(np.square(F_pred[:,:,0])+np.square(F_pred[:,:,1])) #magnitude print('shape M:',M.shape) P = np.arctan(np.divide(mix_STFT[:,:,0],mix_STFT[:,:,1])) #phase print('shape p:',P.shape) F_enhance = np.zeros_like(F_pred) print('shape enhance',F_enhance.shape) F_enhance[:,:,0] = np.multiply(M,np.cos(P)) F_enhance[:,:,1] = np.multiply(M,np.sin(P)) print('shape enhance', F_enhance.shape) T_enhance = fast_istft(F_enhance) return T_enhance ## test code part
Example #8
Source File: test_camera.py From ratcave with MIT License | 6 votes |
def test_look_at_updates_for_children(): dist = 2. cam = StereoCameraGroup(distance=dist) point = np.array([0, 0, 0, 1]).reshape(-1, 1) point[2] = -1 #np.random.randint(1, 6) angle = np.arctan(point[2]/(cam.distance/2))[0] cam.right.rotation.y = -np.rad2deg(angle) cam.left.rotation.y = np.rad2deg(angle) point_view_mat_left = np.dot(cam.left.view_matrix, point) point_view_mat_right = np.dot(cam.right.view_matrix, point) assert (point_view_mat_left == point_view_mat_right).all() cam2 = StereoCameraGroup(distance=dist) cam2.look_at(*point[:3]) point_view_mat_left2 = np.dot(cam2.left.view_matrix, point) point_view_mat_right2 = np.dot(cam2.right.view_matrix, point) assert (point_view_mat_left == point_view_mat_left2).all() and (point_view_mat_right == point_view_mat_right2).all()
Example #9
Source File: LSDMappingTools.py From LSDMappingTools with MIT License | 6 votes |
def Hillshade(raster_file, azimuth, angle_altitude): array = ReadRasterArrayBlocks(raster_file,raster_band=1) x, y = np.gradient(array) slope = np.pi/2. - np.arctan(np.sqrt(x*x + y*y)) aspect = np.arctan2(-x, y) azimuthrad = np.azimuth*np.pi / 180. altituderad = np.angle_altitude*np.pi / 180. shaded = np.sin(altituderad) * np.sin(slope)\ + np.cos(altituderad) * np.cos(slope)\ * np.cos(azimuthrad - aspect) return 255*(shaded + 1)/2 #==============================================================================
Example #10
Source File: part2.py From buzzard with Apache License 2.0 | 6 votes |
def slopes_of_elevation(fp, primitive_fps, primitive_arrays, slopes): """A function to be fed to `compute_array` when constructing a recipe""" arr = primitive_arrays['dem'] kernel = [ [0, 1, 0], [1, 1, 1], [0, 1, 0], ] arr = ( scipy.ndimage.maximum_filter(arr, None, kernel) - scipy.ndimage.minimum_filter(arr, None, kernel) ) arr = arr[1:-1, 1:-1] arr = np.arctan(arr / fp.pxsizex) arr = arr / np.pi * 180. return arr
Example #11
Source File: test_umath.py From recruit with Apache License 2.0 | 6 votes |
def test_against_cmath(self): import cmath points = [-1-1j, -1+1j, +1-1j, +1+1j] name_map = {'arcsin': 'asin', 'arccos': 'acos', 'arctan': 'atan', 'arcsinh': 'asinh', 'arccosh': 'acosh', 'arctanh': 'atanh'} atol = 4*np.finfo(complex).eps for func in self.funcs: fname = func.__name__.split('.')[-1] cname = name_map.get(fname, fname) try: cfunc = getattr(cmath, cname) except AttributeError: continue for p in points: a = complex(func(np.complex_(p))) b = cfunc(p) assert_(abs(a - b) < atol, "%s %s: %s; cmath: %s" % (fname, p, a, b))
Example #12
Source File: test_old_ma.py From lambda-packs with MIT License | 5 votes |
def test_testUfuncs1(self): # Test various functions such as sin, cos. (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d self.assertTrue(eq(np.cos(x), cos(xm))) self.assertTrue(eq(np.cosh(x), cosh(xm))) self.assertTrue(eq(np.sin(x), sin(xm))) self.assertTrue(eq(np.sinh(x), sinh(xm))) self.assertTrue(eq(np.tan(x), tan(xm))) self.assertTrue(eq(np.tanh(x), tanh(xm))) with np.errstate(divide='ignore', invalid='ignore'): self.assertTrue(eq(np.sqrt(abs(x)), sqrt(xm))) self.assertTrue(eq(np.log(abs(x)), log(xm))) self.assertTrue(eq(np.log10(abs(x)), log10(xm))) self.assertTrue(eq(np.exp(x), exp(xm))) self.assertTrue(eq(np.arcsin(z), arcsin(zm))) self.assertTrue(eq(np.arccos(z), arccos(zm))) self.assertTrue(eq(np.arctan(z), arctan(zm))) self.assertTrue(eq(np.arctan2(x, y), arctan2(xm, ym))) self.assertTrue(eq(np.absolute(x), absolute(xm))) self.assertTrue(eq(np.equal(x, y), equal(xm, ym))) self.assertTrue(eq(np.not_equal(x, y), not_equal(xm, ym))) self.assertTrue(eq(np.less(x, y), less(xm, ym))) self.assertTrue(eq(np.greater(x, y), greater(xm, ym))) self.assertTrue(eq(np.less_equal(x, y), less_equal(xm, ym))) self.assertTrue(eq(np.greater_equal(x, y), greater_equal(xm, ym))) self.assertTrue(eq(np.conjugate(x), conjugate(xm))) self.assertTrue(eq(np.concatenate((x, y)), concatenate((xm, ym)))) self.assertTrue(eq(np.concatenate((x, y)), concatenate((x, y)))) self.assertTrue(eq(np.concatenate((x, y)), concatenate((xm, y)))) self.assertTrue(eq(np.concatenate((x, y, x)), concatenate((x, ym, x))))
Example #13
Source File: test_function_base.py From lambda-packs with MIT License | 5 votes |
def test_basic(self): x = [1 + 3j, np.sqrt(2) / 2.0 + 1j * np.sqrt(2) / 2, 1, 1j, -1, -1j, 1 - 3j, -1 + 3j] y = angle(x) yo = [ np.arctan(3.0 / 1.0), np.arctan(1.0), 0, np.pi / 2, np.pi, -np.pi / 2.0, -np.arctan(3.0 / 1.0), np.pi - np.arctan(3.0 / 1.0)] z = angle(x, deg=1) zo = np.array(yo) * 180 / np.pi assert_array_almost_equal(y, yo, 11) assert_array_almost_equal(z, zo, 11)
Example #14
Source File: _continuous_distns.py From lambda-packs with MIT License | 5 votes |
def _ppf(self, q, c): val = (1.0-c)/(1.0+c) rcq = 2*np.arctan(val*np.tan(np.pi*q)) rcmq = 2*np.pi-2*np.arctan(val*np.tan(np.pi*(1-q))) return np.where(q < 1.0/2, rcq, rcmq)
Example #15
Source File: corefuncs.py From nevergrad with MIT License | 5 votes |
def deceptivepath(x: np.ndarray) -> float: """A function which needs following a long path. Most algorithms fail on this. The path becomes thiner as we get closer to the optimum.""" assert len(x) >= 2 distance = np.sqrt(x[0] ** 2 + x[1] ** 2) if distance == 0.0: return 0.0 angle = np.arctan(x[0] / x[1]) if x[1] != 0.0 else np.pi / 2.0 invdistance = (1.0 / distance) if distance > 0.0 else 0.0 if np.abs(np.cos(invdistance) - angle) > 0.1: return 1.0 return float(distance)
Example #16
Source File: least_squares.py From lambda-packs with MIT License | 5 votes |
def arctan(z, rho, cost_only): rho[0] = np.arctan(z) if cost_only: return t = 1 + z**2 rho[1] = 1 / t rho[2] = -2 * z / t**2
Example #17
Source File: Dataset.py From 3D-BoundingBox with MIT License | 5 votes |
def calc_theta_ray(self, img, box_2d, proj_matrix): width = img.shape[1] fovx = 2 * np.arctan(width / (2 * proj_matrix[0][0])) center = (box_2d[1][0] + box_2d[0][0]) / 2 dx = center - (width / 2) mult = 1 if dx < 0: mult = -1 dx = abs(dx) angle = np.arctan( (2*dx*np.tan(fovx/2)) / width ) angle = angle * mult return angle
Example #18
Source File: test_old_ma.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def test_testUfuncRegression(self): f_invalid_ignore = [ 'sqrt', 'arctanh', 'arcsin', 'arccos', 'arccosh', 'arctanh', 'log', 'log10', 'divide', 'true_divide', 'floor_divide', 'remainder', 'fmod'] for f in ['sqrt', 'log', 'log10', 'exp', 'conjugate', 'sin', 'cos', 'tan', 'arcsin', 'arccos', 'arctan', 'sinh', 'cosh', 'tanh', 'arcsinh', 'arccosh', 'arctanh', 'absolute', 'fabs', 'negative', 'floor', 'ceil', 'logical_not', 'add', 'subtract', 'multiply', 'divide', 'true_divide', 'floor_divide', 'remainder', 'fmod', 'hypot', 'arctan2', 'equal', 'not_equal', 'less_equal', 'greater_equal', 'less', 'greater', 'logical_and', 'logical_or', 'logical_xor']: try: uf = getattr(umath, f) except AttributeError: uf = getattr(fromnumeric, f) mf = getattr(np.ma, f) args = self.d[:uf.nin] with np.errstate(): if f in f_invalid_ignore: np.seterr(invalid='ignore') if f in ['arctanh', 'log', 'log10']: np.seterr(divide='ignore') ur = uf(*args) mr = mf(*args) self.assertTrue(eq(ur.filled(0), mr.filled(0), f)) self.assertTrue(eqmask(ur.mask, mr.mask))
Example #19
Source File: dd_conversions.py From servir-vic-training with GNU General Public License v3.0 | 5 votes |
def dd2meters(inPt,scale=0.1): """Function to convert decimal degrees to meters based on the approximation given by: https://en.wikipedia.org/wiki/Geographic_coordinate_system Args: inPt (list or array): A Y,X point provided in geographic coordinates in that order. Keywords: scale (int): Resolution of the raster value to covert into meters, must be in decimal degrees. Returns: list: List of Y,X resolution values converted from meters to decimal degrees """ lat = inPt[0] # get latitude value radLat = np.deg2rad(lat) # convert degree latitude to radians a = 6378137 # radius of Earth in meters ba = 0.99664719 # constant of b/a ss = np.arctan(ba*np.tan(radLat)) # calculate the reduced latitude # factor to convert meters to decimal degrees for X axis xfct = (np.pi/180)*a*np.cos(ss) # factor to convert meters to decimal degrees for Y axis yfct = (111132.92-559.82*np.cos(2*radLat)+1.175*np.cos(4*radLat)- 0.0023*np.cos(6*radLat)) # get meter resolution y_meters = scale * yfct x_meters = scale * xfct # return list of converted resolution values return [y_meters,x_meters]
Example #20
Source File: dd_conversions.py From servir-vic-training with GNU General Public License v3.0 | 5 votes |
def meters2dd(inPt,scale=30): """Function to convert meters to decimal degrees based on the approximation given by: https://en.wikipedia.org/wiki/Geographic_coordinate_system Args: inPt (list or array): A Y,X point provided in geographic coordinates in that order. Keywords: scale (int): Resolution of the raster value to covert into decimal degrees, must be in meters. Returns: list: List of Y,X resolution values converted from meters to decimal degrees """ lat = inPt[0] # get latitude value radLat = np.deg2rad(lat) # convert degree latitude to radians a = 6378137 # radius of Earth in meters ba = 0.99664719 # constant of b/a ss = np.arctan(ba*np.tan(radLat)) # calculate the reduced latitude # factor to convert meters to decimal degrees for X axis xfct = (np.pi/180)*a*np.cos(ss) # factor to convert meters to decimal degrees for Y axis yfct = (111132.92-559.82*np.cos(2*radLat)+1.175*np.cos(4*radLat)- 0.0023*np.cos(6*radLat)) # get decimal degree resolution ydd = scale / yfct xdd = scale / xfct # return list of converted resolution values return [ydd,xdd]
Example #21
Source File: test_core.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def test_basic_ufuncs(self): # Test various functions such as sin, cos. (x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d assert_equal(np.cos(x), cos(xm)) assert_equal(np.cosh(x), cosh(xm)) assert_equal(np.sin(x), sin(xm)) assert_equal(np.sinh(x), sinh(xm)) assert_equal(np.tan(x), tan(xm)) assert_equal(np.tanh(x), tanh(xm)) assert_equal(np.sqrt(abs(x)), sqrt(xm)) assert_equal(np.log(abs(x)), log(xm)) assert_equal(np.log10(abs(x)), log10(xm)) assert_equal(np.exp(x), exp(xm)) assert_equal(np.arcsin(z), arcsin(zm)) assert_equal(np.arccos(z), arccos(zm)) assert_equal(np.arctan(z), arctan(zm)) assert_equal(np.arctan2(x, y), arctan2(xm, ym)) assert_equal(np.absolute(x), absolute(xm)) assert_equal(np.angle(x + 1j*y), angle(xm + 1j*ym)) assert_equal(np.angle(x + 1j*y, deg=True), angle(xm + 1j*ym, deg=True)) assert_equal(np.equal(x, y), equal(xm, ym)) assert_equal(np.not_equal(x, y), not_equal(xm, ym)) assert_equal(np.less(x, y), less(xm, ym)) assert_equal(np.greater(x, y), greater(xm, ym)) assert_equal(np.less_equal(x, y), less_equal(xm, ym)) assert_equal(np.greater_equal(x, y), greater_equal(xm, ym)) assert_equal(np.conjugate(x), conjugate(xm))
Example #22
Source File: _slopes.py From buzzard with Apache License 2.0 | 5 votes |
def create_slopes(dsm, reso, dtype=np.float32, crop=False): ''' Compute the slopes from dsm: Args: dsm: (M, N) numpy array reso: float or (float, float) * (resox, resoy) = reso: Spanning of a pixel in space * Should be in the same unit as dsm's values * If a single float is given, it is interpreted as (reso, -reso) dtype: numpy dtype * Output dtype crop: bool * Cropping of output array Returns: numpy.array: If crop: (M - 1, N - 1) Else: (M, N) ''' try: reso = tuple(reso) except TypeError: reso = (reso, -reso) dx = _calcdzdx(dsm, reso[0], dtype) dy = _calcdzdy(dsm, reso[1], dtype) rise_run = np.sqrt(dx ** 2 + dy ** 2) slopes = np.arctan(rise_run) * (180.0 / np.pi) slopes = slopes.astype(dtype) if crop: return slopes[1:-1, 1:-1] return slopes
Example #23
Source File: aa.py From burnman with GNU General Public License v2.0 | 5 votes |
def _isochoric_energy_change(self, Ts, T, V, params): """ int Cv dT """ A, B, Theta = self._ABTheta(V, params) lmda, xi = self._lambdaxi(V, params) E_kin = 1.5*params['n']*gas_constant*(T - Ts) E_el = A*(T - Ts - Theta*(np.arctan(T/Theta) - np.arctan(Ts/Theta))) + 5./8*B*(np.power(T, 1.6) - np.power(Ts, 1.6)) # A5 E_pot = (lmda*(T - Ts) + params['theta']*(xi - lmda)*np.log((params['theta'] + T)/(params['theta'] + Ts))) # A19 return E_kin + E_el + E_pot
Example #24
Source File: aster.py From typhon with MIT License | 5 votes |
def geocentric2geodetic(latitude): """Translate geocentric to geodetic latitudes. Parameters: latitude (ndarray): latitude values in degree. Returns: (ndarray): geodetic latitudes. """ return np.rad2deg(np.arctan(1.0067395 * np.tan(np.deg2rad(latitude))))
Example #25
Source File: create_table_pose.py From ObjectPoseEstimationSummary with MIT License | 5 votes |
def compute_viewpoint_from_camera(c): # compute the viewpoint according to the camera position elevation = np.arctan(c[2] / np.sqrt(c[0] **2 + c[2] ** 2)) azimuth = np.arctan(c[1] / c[0]) if c[0] < 0 and c[1] < 0: azimuth -= np.pi if c[0] < 0 and c[1] > 0: azimuth += np.pi return azimuth[0] * 180./ np.pi, elevation[0] * 180./ np.pi
Example #26
Source File: test_core.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def test_testUfuncRegression(self): # Tests new ufuncs on MaskedArrays. for f in ['sqrt', 'log', 'log10', 'exp', 'conjugate', 'sin', 'cos', 'tan', 'arcsin', 'arccos', 'arctan', 'sinh', 'cosh', 'tanh', 'arcsinh', 'arccosh', 'arctanh', 'absolute', 'fabs', 'negative', 'floor', 'ceil', 'logical_not', 'add', 'subtract', 'multiply', 'divide', 'true_divide', 'floor_divide', 'remainder', 'fmod', 'hypot', 'arctan2', 'equal', 'not_equal', 'less_equal', 'greater_equal', 'less', 'greater', 'logical_and', 'logical_or', 'logical_xor', ]: try: uf = getattr(umath, f) except AttributeError: uf = getattr(fromnumeric, f) mf = getattr(numpy.ma.core, f) args = self.d[:uf.nin] ur = uf(*args) mr = mf(*args) assert_equal(ur.filled(0), mr.filled(0), f) assert_mask_equal(ur.mask, mr.mask, err_msg=f)
Example #27
Source File: test_umath.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def assert_arctan2_ispinf(x, y): assert_((np.isinf(ncu.arctan2(x, y)) and ncu.arctan2(x, y) > 0), "arctan(%s, %s) is %s, not +inf" % (x, y, ncu.arctan2(x, y)))
Example #28
Source File: test_umath.py From recruit with Apache License 2.0 | 5 votes |
def assert_arctan2_isnzero(x, y): assert_((ncu.arctan2(x, y) == 0 and np.signbit(ncu.arctan2(x, y))), "arctan(%s, %s) is %s, not -0" % (x, y, ncu.arctan2(x, y)))
Example #29
Source File: test_umath.py From recruit with Apache License 2.0 | 5 votes |
def assert_arctan2_ispzero(x, y): assert_((ncu.arctan2(x, y) == 0 and not np.signbit(ncu.arctan2(x, y))), "arctan(%s, %s) is %s, not +0" % (x, y, ncu.arctan2(x, y)))
Example #30
Source File: _continuous_distns.py From lambda-packs with MIT License | 5 votes |
def _sf(self, x): return 0.5 - 1.0/np.pi*np.arctan(x)