Checks for R2 axes perpendicular to unique axis.  For handling
        symmetric top molecules.
518515
def _check_perpendicular_r2_axis(self, axis):
        
        min_set = self._get_smallest_set_not_on_axis(axis)
        for s1, s2 in itertools.combinations(min_set, 2):
            test_axis = np.cross(s1.coords - s2.coords, axis)
            if np.linalg.norm(test_axis) > self.tol:
                op = SymmOp.from_axis_angle_and_translation(test_axis, 180)
                r2present = self.is_valid_op(op)
                if r2present:
                    self.symmops.append(op)
                    self.rot_sym.append((test_axis, 2))
                    return True
910250
function tileToPixelCoords(q, r, v) {
         var x, y;
         var ret = v || new me.Vector2d();

         if (this.staggeraxis === "x") {
           //flat top
           x = q * this.columnwidth;

           if (this.staggerindex === "odd") {
             y = r * (this.tileheight + this.sidelengthy);
             y = y + this.rowheight * (q & 1);
           } else {
             y = r * (this.tileheight + this.sidelengthy);
             y = y + this.rowheight * (1 - (q & 1));
           }
         } else {
           //pointy top
           y = r * this.rowheight;

           if (this.staggerindex === "odd") {
             x = q * (this.tilewidth + this.sidelengthx);
             x = x + this.columnwidth * (r & 1);
           } else {
             x = q * (this.tilewidth + this.sidelengthx);
             x = x + this.columnwidth * (1 - (r & 1));
           }
         }

         return ret.set(x, y);
       }
1309108
def assert_coordinate_consistent(obj, coords):
    
    for k in obj.dims:
        # make sure there are no conflict in dimension coordinates
        if k in coords and k in obj.coords:
            if not coords[k].equals(obj[k].variable):
                raise IndexError(
                    'dimension coordinate {!r} conflicts between '
                    'indexed and indexing objects:\n{}\nvs.\n{}'
                    .format(k, obj[k], coords[k]))
719735
def isCollinear(self, b, c):
        '''
        
        '''

        return all(self.ccw(b, c, axis) == 0 for axis in self._keys)
1079196
def join(self, t2, unique=False):
        

        lonv1 = np.concatenate((self.lons, t2.lons), axis=0)
        latv1 = np.concatenate((self.lats, t2.lats), axis=0)

        ## remove any duplicates

        if not unique:
            lonv1, latv1 = remove_duplicate_lonlat(lonv1, latv1)

        return lonv1, latv1
1074451
def sigma_s2(self, r, R, kwargs_profile, kwargs_anisotropy, kwargs_light):
        
        beta = self.anisotropy.beta_r(r, kwargs_anisotropy)
        return (1 - beta * R**2/r**2) * self.sigma_r2(r, kwargs_profile, kwargs_anisotropy, kwargs_light)
482918
def Any(a, axis, keep_dims):
    
    return np.any(a, axis=axis if not isinstance(axis, np.ndarray) else tuple(axis),
                  keepdims=keep_dims),
720290
def enforce_vertical_symmetry(pixmap):
    ''''''
    mirror = []
    for item in pixmap:
        y = item[0]
        x = item[1]

        if x <= IMAGE_APEX:
            diff_x = diff(x, IMAGE_APEX)
            mirror.append((y, x + (2 * diff_x) - 1))

        if x > IMAGE_APEX:
            diff_x = diff(x, IMAGE_APEX)
            mirror.append((y, x - (2 * diff_x) - 1))

    return mirror + pixmap
701214
def cublasDspr2(handle, uplo, n, alpha, x, incx, y, incy, AP):
    

    status = _libcublas.cublasDspr2_v2(handle, 
                                       _CUBLAS_FILL_MODE[uplo], n, 
                                       ctypes.byref(ctypes.c_double(alpha)), 
                                       int(x), incx, int(y), incy, int(AP))
    cublasCheckStatus(status)
986781
def _axis_in_detector(geometry):
    """"""
    du, dv = geometry.det_axes_init
    axis = geometry.axis
    c = np.array([np.vdot(axis, du), np.vdot(axis, dv)])
    cnorm = np.linalg.norm(c)

    # Check for numerical errors
    assert cnorm != 0

    return c / cnorm
374239
private Vector3d getReferenceAxisCylicWithSubunitAlignment() {
		if (rotationGroup.getPointGroup().equals("C2")) {
			return referenceVector;
		}

		// find subunit that extends the most in the xy-plane
		List<List<Integer>> orbits = getOrbitsByXYWidth();
		// get the last orbit which is the widest
		List<Integer> widestOrbit = orbits.get(orbits.size()-1);
		List<Point3d> centers = subunits.getCenters();
		int subunit = widestOrbit.get(0);

		// calculate reference vector
		Vector3d refAxis = new Vector3d();
		refAxis.sub(centers.get(subunit), subunits.getCentroid());
		refAxis.normalize();
		return refAxis;
	}
998884
private void selectAxises(SimpleMatrix R1, SimpleMatrix R2, SimpleMatrix c1, SimpleMatrix c2) {
		// --------- Compute the new x-axis
		v1.set(c2.get(0) - c1.get(0), c2.get(1) - c1.get(1), c2.get(2) - c1.get(2));
		v1.normalize();

		// --------- Compute the new y-axis
		//   cross product of old z axis and new x axis
		// According to the paper [1] this choice is arbitrary, however it is not.  By selecting
		// the original axis the similarity with the first view is maximized.  The other extreme
		// would be to make it perpendicular, resulting in an unusable rectification.

		// extract old z-axis from rotation matrix
		Vector3D_F64 oldZ = new Vector3D_F64(
				R1.get(2,0)+R2.get(2,0),
				R1.get(2,1)+R2.get(2,1),
				R1.get(2,2)+R2.get(2,2));
		GeometryMath_F64.cross(oldZ, v1, v2);
		v2.normalize();

		// ---------- Compute the new z-axis
		// simply the process product of the first two
		GeometryMath_F64.cross(v1,v2,v3);
		v3.normalize();
	}
35812
def axes(self):
        
        out = self._axes[:]
        if self._horizontalAxis:
            out.append(self._horizontalAxis)
        if self._verticalAxis:
            out.append(self._verticalAxis)
        return out
793397
def spin1_a(self):
        """"""
        return coordinates.cartesian_to_spherical_rho(
                                    self.spin1x, self.spin1y, self.spin1z)
1179321
def nbins(self, axis=0, overflow=False):
        
        if axis == 0:
            nbins = self.GetNbinsX()
        elif axis == 1:
            nbins = self.GetNbinsY()
        elif axis == 2:
            nbins = self.GetNbinsZ()
        else:
            raise ValueError("axis must be 0, 1, or 2")
        if overflow:
            nbins += 2
        return nbins
68170
private void refineReferenceVector() {
		referenceVector = new Vector3d(Y_AXIS);
		if (rotationGroup.getPointGroup().startsWith("C")) {
			referenceVector = getReferenceAxisCylicWithSubunitAlignment();
		} else if (rotationGroup.getPointGroup().startsWith("D")) {
			referenceVector = getReferenceAxisDihedralWithSubunitAlignment();
		}

		referenceVector = orthogonalize(principalRotationVector, referenceVector);
	}
784001
def axis_overlap(ax1, ax2):
    
    b1, t1 = ax1.get_position().intervaly
    b2, t2 = ax2.get_position().intervaly
    return t1 > b2 and b1 < t2