np.array: The grid points in x.
321901
def x(self):
        '''
        
        '''
        if None not in (self.x_min, self.x_max, self.x_step) and \
                self.x_min != self.x_max:
            x = np.arange(self.x_min, self.x_max+self.x_step-self.y_step*0.1, self.x_step)
        else:
            x = np.array([])
        return x
597556
def plot(self):
		'''
		
		'''
		pl.plot(self.x, self.y, '.')
		pl.plot(self.x_int, self.y_int)
		pl.grid(True)
		pl.show()
425964
def make_grid(xx, yy):
    
    n = len(xx)
    xx, yy = np.meshgrid(xx, yy)
    grid = np.array([xx.ravel(), yy.ravel()]).T
    x = grid[:, 0].reshape(n, n)
    y = grid[:, 1].reshape(n, n)
    return x, y
207880
def _call(self, x):
        """"""
        x_norm = self.pointwise_norm(x).ufuncs.max()

        if x_norm > 1:
            return np.inf
        else:
            return 0
961380
def grid(self, grid):
        """"""

        if not isinstance(grid, bool):
            raise TypeError("grid must be boolean, not '%s'" % grid)
        self._x_grid = self._y_grid = grid
278933
def grid_from_coordinate_transform(numPix, Mpix2coord, ra_at_xy_0, dec_at_xy_0):
    
    a = np.arange(numPix)
    matrix = np.dstack(np.meshgrid(a, a)).reshape(-1, 2)
    x_grid = matrix[:, 0]
    y_grid = matrix[:, 1]
    ra_grid = x_grid * Mpix2coord[0, 0] + y_grid * Mpix2coord[0, 1] + ra_at_xy_0
    dec_grid = x_grid * Mpix2coord[1, 0] + y_grid * Mpix2coord[1, 1] + dec_at_xy_0
    return ra_grid, dec_grid
1112661
def _mark_grid_bounds(self, plane, region_bbox):
        
        # Grid boundaries
        vbars = np.zeros([self.num_rows, self.num_cols + 1], dtype=np.bool)
        hbars = np.zeros([self.num_rows + 1, self.num_cols], dtype=np.bool)

        def closest_idx(arr, elem):
            left = bisect.bisect_left(arr, elem) - 1
            right = bisect.bisect_right(arr, elem) - 1
            return left if abs(arr[left] - elem) < abs(arr[right] - elem) else right

        # Figure out which separating segments are missing, i.e. merge cells
        for row, (y0, y1) in enumerate(self.yranges):
            yc = (y0 + y1) // 2
            for l in plane.find((region_bbox.x0, yc, region_bbox.x1, yc)):
                vbars[row, closest_idx(self.xs, l.xc)] = True
        for col, (x0, x1) in enumerate(self.xranges):
            xc = (x0 + x1) // 2
            for l in plane.find((xc, region_bbox.y0, xc, region_bbox.y1)):
                hbars[closest_idx(self.ys, l.yc), col] = True
        return vbars, hbars
750908
def coord_grid(self):
        """"""

        ra2 = math.pi * 2
        ra1 = 0
        dec1 = -1 * math.pi / 2.0
        dec2 = math.pi / 2.0

        dra = math.fabs((self.x2 - self.x1) / 4.0)
        ddec = math.fabs((self.y2 - self.y1) / 4.0)
        logging.debug("Drawing the grid.")
        label = True
        ra = ra1
        while ra <= ra2:
            # create a line that goes from dec1 to dec2 at this ra
            (cx1, cy1) = self.p2c((ra, dec1))
            # ly is the y location mid-way between the top and bottom of the plot
            (cx2, cy2) = self.p2c((ra, dec2))
            # create a dashed line for un-labeled lines
            self.create_line(cx1, cy1, cx2, cy2, dash=(20, 20), fill="grey")
            dec = dec1
            while dec <= dec2:
                if label:
                    # lx is the the x screen coordinate location of the ra
                    (lx, ly) = self.p2c((ra, dec + ddec / 2.0))
                    self.create_text(lx + 5, ly, justify=LEFT,
                                     font=('Times', '-20'),
                                     text="\n".join(str(ephem.hours(ra))[:-3]), fill='grey')
                label = not label
                dec += ddec
            ra += dra

        # plot dec grid lines bewtween South (dec1) and North (dec2) limits of plot
        dec = dec1
        # should we label the current grid line?
        label = True
        while dec <= dec2:
            # create a line the goes from ra1 to ra2 at this dec
            (cx1, cy1) = self.p2c((ra1, dec))
            (cx2, cy2) = self.p2c((ra2, dec))
            self.create_line(cx1, cy1, cx2, cy2, dash=(20, 20), fill='grey')
            ra = ra1
            while ra <= ra2:
                if label:
                    # lx/ly are the screen coordinates of the label
                    (lx, ly) = self.p2c((ra + dra / 2.0, dec))
                    self.create_text(lx, ly - 5, font=('Times', '-20'),
                                     text=str(ephem.degrees(dec)), fill='grey')
                ra += dra
            dec += ddec
            label = not label
708579
def translate_x(self, d):
        
        mat = numpy.array([
            [1, 0, 0, 0],
            [0, 1, 0, 0],
            [0, 0, 1, 0],
            [d, 0, 0, 1]
        ])
        self.vectors = self.vectors.dot(mat)
        return self
821569
def calculate(self, scene, xaxis, yaxis):
        
        # build the grid location
        sceneRect = scene.sceneRect()
        
        # process axis information
        h_lines  = []
        h_alt    = []
        h_labels = []
        v_lines  = []
        v_alt    = []
        v_labels = []
        
        xlabels   = []
        xcount    = 1
        xsections = 1
        xdelta    = 0
        xdeltamin = 0
        
        ylabels   = []
        ycount    = 1
        ysections = 1
        ydeltamin = 0
        ydelta    = 0
        
        axis_lft  = 0
        axis_rht  = 0
        axis_bot  = 0
        axis_top  = 0
        
        # precalculate xaxis information for width changes
        if xaxis and self.showXAxis():
            size = sceneRect.width()
            xdeltamin = xaxis.minimumLabelWidth()
            result = self.calculateAxis(xaxis, size, xdeltamin)
            
            xlabels, xcount, xsections, newWidth, xdelta = result
            if newWidth != size:
                sceneRect.setWidth(newWidth)
        
        # precalculate yaxis information for height changes
        if yaxis and self.showYAxis():
            size = sceneRect.height()
            ydeltamin = yaxis.minimumLabelHeight()
            result = self.calculateAxis(yaxis, size, ydeltamin)
            
            ylabels, ycount, ysections, newHeight, ydelta = result
            if newHeight != size:
                sceneRect.setHeight(newHeight)
        
        # generate the xaxis
        if xaxis and self.showXAxis():
            x        = sceneRect.left() + xdeltamin / 2
            axis_lft = x
            axis_rht = x
            alt      = False
            
            for i in range(xcount):
                v_lines.append(QLineF(x, sceneRect.top(),
                                      x, sceneRect.bottom()))
                
                # store alternate info
                if alt:
                    alt_rect = QRectF(x - xdelta, sceneRect.top(),
                                      xdelta, sceneRect.height())
                    v_alt.append(alt_rect)
                
                # store label information
                v_labels.append((x, xdelta, xlabels[i]))
                axis_rht = x
                
                x += xdelta
                alt = not alt
        
        # generate the yaxis
        if yaxis and self.showYAxis():
            y        = sceneRect.bottom() - ydeltamin / 2
            axis_bot = y
            axis_top = y
            alt      = False
            
            for i in range(ycount):
                h_lines.append(QLineF(sceneRect.left(), y,
                                      sceneRect.right(), y))
                
                # store alternate color
                if alt:
                    alt_rect = QRectF(sceneRect.left(), y,
                                      sceneRect.width(), ydelta)
                    h_alt.append(alt_rect)
                
                # store the vertical information
                h_labels.append((y, ydelta, ylabels[i]))
                axis_top = y
                
                y -= ydelta
                alt = not alt
        
        # assign the build data
        self._buildData['grid_h_lines']  = h_lines
        self._buildData['grid_h_alt']    = h_alt
        self._buildData['grid_h_labels'] = h_labels
        self._buildData['grid_v_lines']  = v_lines
        self._buildData['grid_v_alt']    = v_alt
        self._buildData['grid_v_labels'] = v_labels
        self._buildData['grid_rect']     = sceneRect
        self._buildData['axis_rect']     = QRectF(axis_lft, axis_top,
                                                  axis_rht - axis_lft,
                                                  axis_bot - axis_top)
        
        scene.setSceneRect(sceneRect)
        return sceneRect
749481
public int[] gridAt( double x, double y ) {
        if (isInRaster(x, y)) {
            GridGeometry2D gridGeometry = getGridGeometry();
            int[] colRowFromCoordinate = CoverageUtilities.colRowFromCoordinate(new Coordinate(x, y), gridGeometry, null);
            return colRowFromCoordinate;
        }
        return null;
    }
1125515
def fit(self, X):
        
        self.centers_, self.labels_, self.sse_arr_, self.n_iter_ = \
              _kmedoids(X, self.n_clusters, self.distance, self.max_iter, self.n_trials, self.tol, self.rng)
331056
def get_x(self, var, coords=None):
        
        if coords is None:
            coords = self.ds.coords
        # first we try the super class
        ret = super(UGridDecoder, self).get_x(var, coords)
        # but if that doesn't work because we get the variable name in the
        # dimension of `var`, we use the means of the triangles
        if ret is None or ret.name in var.dims:
            bounds = self.get_cell_node_coord(var, axis='x', coords=coords)
            if bounds is not None:
                centers = bounds.mean(axis=-1)
                x = self.get_nodes(self.get_mesh(var, coords), coords)[0]
                try:
                    cls = xr.IndexVariable
                except AttributeError:  # xarray < 0.9
                    cls = xr.Coordinate
                return cls(x.name, centers, attrs=x.attrs.copy())
698732
def lnlike(self, X):
        
        return -3.5*np.log(self._interpolant(X[0], X[1], grid=False))
854983
def interpolation_points(self, N):
        
        if N == 1:
            return np.array([0.])
        return np.cos(np.arange(N)*np.pi/(N-1))
1154865
def _compute_grid(self):
        
        widths = []
        for c in range(self.cols):
            c_widths = []
            for r in range(self.rows):
                subplot = self.subplots.get((r, c), None)
                nsubplots = 1 if subplot is None else len(subplot.layout)
                c_widths.append(2 if nsubplots > 1 else 1)
            widths.append(max(c_widths))

        heights = []
        for r in range(self.rows):
            r_heights = []
            for c in range(self.cols):
                subplot = self.subplots.get((r, c), None)
                nsubplots = 1 if subplot is None else len(subplot.layout)
                r_heights.append(2 if nsubplots > 2 else 1)
            heights.append(max(r_heights))

        # Generate empty grid
        rows = sum(heights)
        cols = sum(widths)
        grid = [[None]*cols for _ in range(rows)]

        return grid
931908
public void fit(INDArray x) {
        this.data = x;
        for(int i = 0; i < numTrees; i++) {
            RPTree tree = new RPTree(data.columns(),maxSize,similarityFunction);
            tree.buildTree(x);
            trees.add(tree);
        }
    }