def phi_doublet_matrix(vecs: MatrixVector, rls: MatrixVector, sgnz: matrix): mags = vecs.return_magnitude() ms = divide(vecs.x, rls.y) ths = arctan(ms) ths[rls.y == 0.0] = piby2 gs = multiply(ms, divide(rls.z, mags)) Js = arctan(gs) Js[rls.y == 0.0] = piby2 phids = Js - multiply(sgnz, ths) return phids, mags
def phi_doublet_matrix(vecs: MatrixVector, sgnz: matrix): mags = vecs.return_magnitude() chkm = mags < tol chky = absolute(vecs.y) < tol vecs.y[chky] = 0.0 ms = zeros(mags.shape, dtype=float) divide(vecs.x, vecs.y, where=logical_not(chky), out=ms) ths = arctan(ms) ths[chky] = piby2 ts = zeros(mags.shape, dtype=float) divide(vecs.z, mags, where=logical_not(chkm), out=ts) gs = multiply(ms, ts) Js = arctan(gs) Js[chky] = piby2 phids = Js - multiply(sgnz, ths) return phids, mags
def phi_trailing_doublet_matrix(rls: MatrixVector, sgnz: matrix, faco: float): ths = zeros(rls.shape, dtype=float) ths[rls.y > 0.0] = piby2 ths[rls.y == 0.0] = -piby2 * faco ths[rls.y < 0.0] = -piby2 gs = divide(rls.z, rls.y) Js = arctan(gs) Js[rls.y == 0.0] = -piby2 * faco phids = Js - multiply(sgnz, ths) return phids
def arctand(digit): """ This function calculates the inverse tangent of a number. :param digit: Number. :type digit: float :return: The inverse tangent of the number in degrees. :rtype: float """ return np.rad2deg(arctan(digit))
def phi_trailing_doublet_matrix(rls: MatrixVector, sgnz: matrix): ths = zeros(rls.shape, dtype=float) chky = absolute(rls.y) < tol ths[rls.y > 0.0] = piby2 ths[rls.y < 0.0] = -piby2 ths[chky] = -piby2 gs = zeros(rls.shape, dtype=float) divide(rls.z, rls.y, where=logical_not(chky), out=gs) Js = arctan(gs) Js[rls.y == 0.0] = -piby2 phids = Js - multiply(sgnz, ths) return phids