Latitude overlap (2 images).
516546
def _cas_3(self):
        '''  '''

        lonc = self._format_lon(self.lonm)
        latc_top = self._format_lat(self.latM)
        latc_bot = self._format_lat(self.latm)

        img_name_top = self._format_name_map(lonc, latc_top)
        print(img_name_top)
        img_top = BinaryTable(img_name_top, self.path_pdsfiles)
        print(self.lonm, self.lonM, float(img_top.MINIMUM_LATITUDE), self.latM)
        X_top, Y_top, Z_top = img_top.extract_grid(self.lonm,
                                                   self.lonM,
                                                   float(
                                                       img_top.MINIMUM_LATITUDE),
                                                   self.latM)

        img_name_bottom = self._format_name_map(lonc, latc_bot)
        print(img_name_bottom)
        img_bottom = BinaryTable(img_name_bottom, self.path_pdsfiles)
        X_bottom, Y_bottom, Z_bottom = img_bottom.extract_grid(self.lonm,
                                                               self.lonM,
                                                               self.latm,
                                                               float(img_bottom.MAXIMUM_LATITUDE))

        X_new = np.vstack((X_top, X_bottom))
        Y_new = np.vstack((Y_top, Y_bottom))
        Z_new = np.vstack((Z_top, Z_bottom))

        return X_new, Y_new, Z_new
1162948
def arbanglemap(self):
        '''
        
        '''
        # raySpacingDeg = self.arbfov / self.nCutPix
        maxAng = self.boresightEl + self.arbfov / 2
        minAng = self.boresightEl - self.arbfov / 2
        angles = np.linspace(maxAng, minAng, num=self.ncutpix, endpoint=True)
        assert np.isclose(angles[0], maxAng) & np.isclose(angles[-1], minAng)
        return angles
494294
def _calc_overlap_count(
    markers1: dict,
    markers2: dict,
):
    
    overlaps=np.zeros((len(markers1), len(markers2)))

    j=0
    for marker_group in markers1:
        tmp = [len(markers2[i].intersection(markers1[marker_group])) for i in markers2.keys()]
        overlaps[j,:] = tmp
        j += 1

    return overlaps
818531
def count_overlap(self, time, other_object, other_time):
        
        ti = np.where(time == self.times)[0][0]
        ma = np.where(self.masks[ti].ravel() == 1)
        oti = np.where(other_time == other_object.times)[0]
        obj_coords = np.zeros(self.masks[ti].sum(), dtype=[('x', int), ('y', int)])
        other_obj_coords = np.zeros(other_object.masks[oti].sum(), dtype=[('x', int), ('y', int)])
        obj_coords['x'] = self.i[ti].ravel()[ma]
        obj_coords['y'] = self.j[ti].ravel()[ma]
        other_obj_coords['x'] = other_object.i[oti][other_object.masks[oti] == 1]
        other_obj_coords['y'] = other_object.j[oti][other_object.masks[oti] == 1]
        return float(np.intersect1d(obj_coords,
                                    other_obj_coords).size) / np.maximum(self.masks[ti].sum(),
                                                                         other_object.masks[oti].sum())
1014924
def view_overlaps(L, self_overlaps=False, normalize=True, colorbar=True):
    """"""
    L = L.todense() if sparse.issparse(L) else L
    G = _get_overlaps_matrix(L, normalize=normalize)
    if not self_overlaps:
        np.fill_diagonal(G, 0)  # Zero out self-overlaps
    plt.imshow(G, aspect="auto")
    plt.title("Overlaps")
    if colorbar:
        plt.colorbar()
    plt.show()
773420
private static double deltaLat(double deltaPixel, double lat, byte zoom, int tileSize) {
        long mapSize = MercatorProjection.getMapSize(zoom, tileSize);
        double pixelY = MercatorProjection.latitudeToPixelY(lat, mapSize);
        double lat2 = MercatorProjection.pixelYToLatitude(pixelY + deltaPixel, mapSize);

        return Math.abs(lat2 - lat);
    }
779792
function(elem, other_elems) {
                    // Pairwise overlap detection
                    var overlapping = function(a, b) {
                        if (Math.abs(2.0*a.offsetLeft + a.offsetWidth - 2.0*b.offsetLeft - b.offsetWidth) < a.offsetWidth + b.offsetWidth) {
                            if (Math.abs(2.0*a.offsetTop + a.offsetHeight - 2.0*b.offsetTop - b.offsetHeight) < a.offsetHeight + b.offsetHeight) {
                                return true;
                            }
                        }
                        return false;
                    };
                    var i = 0;
                    // Check elements for overlap one by one, stop and return false as soon as an overlap is found
                    for(i = 0; i < other_elems.length; i++) {
                        if (overlapping(elem, other_elems[i])) {
                            return true;
                        }
                    }
                    return false;
                }
34737
def overlaps(self,junc,tolerance=0):
    """"""
    if not self.left.overlaps(junc.left,padding=tolerance): return False
    if not self.right.overlaps(junc.right,padding=tolerance): return False
    return True
114343
public boolean overlaps(BoundingBox o, double cutoff) {
		if (this==o) return true;
		// x dimension
		if (!areOverlapping(xmin,xmax,o.xmin,o.xmax,cutoff)) {
			return false;
		}
		// y dimension
		if (!areOverlapping(ymin,ymax,o.ymin,o.ymax,cutoff)) {
			return false;
		}
		// z dimension
		if (!areOverlapping(zmin,zmax,o.zmin,o.zmax,cutoff)) {
			return false;
		}
		return true;
	}
371880
def overlap(intv1, intv2):
    """"""
    return max(0, min(intv1[1], intv2[1]) - max(intv1[0], intv2[0]))
325789
def check_overlap(pos, ins, thresh):
    
    ins_pos = ins[0]
    ins_len = ins[2]
    ol = overlap(ins_pos, pos)
    feat_len = pos[1] - pos[0] + 1
#    print float(ol) / float(feat_len)
    if float(ol) / float(feat_len) >= thresh:
        return True
    return False
3799
def overlap_bbox_and_point(bbox, xp, yp):
    """"""
    cx, cy = get_midpoint(bbox)

    dir_x = np.sign(cx-xp)
    dir_y = np.sign(cy-yp)

    if dir_x == -1:
        dx = xp - bbox.xmax
    elif dir_x == 1:
        dx = xp - bbox.xmin
    else:
        dx = 0

    if dir_y == -1:
        dy = yp - bbox.ymax
    elif dir_y == 1:
        dy = yp - bbox.ymin
    else:
        dy = 0
    return dx, dy
454437
def overlap(self, x, ctrs, kdtree=None):
        """"""

        q = len(self.within(x, ctrs, kdtree=kdtree))

        return q
361009
public static BoundingBox overlap(BoundingBox boundingBox,
			BoundingBox boundingBox2, boolean allowEmpty) {
		return boundingBox.overlap(boundingBox2, allowEmpty);
	}
1205760
def pix2ang(nside, ipix, nest=False, lonlat=False):
    """"""
    lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
    return _lonlat_to_healpy(lon, lat, lonlat=lonlat)
1079637
public List<M> findNear(double latitude, double longitude, int numImages) {
        return getDatastore().find(clazz).field("location.coordinates").near(latitude, longitude).limit(numImages).asList();
    }
874746
function getOverlapArea(topLeft1, bottomRight1, topLeft2, bottomRight2) {
  // If no overlap, return 0
  if ((topLeft1.x > bottomRight2.x || bottomRight1.x < topLeft2.x) || (topLeft1.y > bottomRight2.y || bottomRight1.y < topLeft2.y)) {
    return 0;
  }
  // return overlapping area : [ min of rightmost/bottommost co-ordinates ] - [ max of leftmost/topmost co-ordinates ]
  return ((Math.min(bottomRight1.x, bottomRight2.x) - Math.max(topLeft1.x, topLeft2.x)) * (Math.min(bottomRight1.y, bottomRight2.y) - Math.max(topLeft1.y, topLeft2.y)));
}