Convert global assumptions to a point.
434391
def _assume2point():
    """"""
    point = dict()
    for lit in _ASSUMPTIONS:
        if isinstance(lit, Complement):
            point[~lit] = 0
        elif isinstance(lit, Variable):
            point[lit] = 1
    return point
819709
def _global_step(hparams):
  """"""
  step = tf.to_float(tf.train.get_or_create_global_step())
  multiplier = hparams.optimizer_multistep_accumulate_steps
  if not multiplier:
    return step

  tf.logging.info("Dividing global step by %d for multi-step optimizer."
                  % multiplier)
  return step / tf.to_float(multiplier)
1123463
def uniform_random_global_points(n=100):
    
    xs = np.random.uniform(-180, 180, n)
    ys = np.random.uniform(-90, 90, n)
    return [shapely.geometry.Point(x, y) for x, y in zip(xs, ys)]
319679
def point(cls):  # No range because it's unknown at this time.
    """"""
    def factory(i, name):
      return cls(i, name, (0, 0), lambda a: point.Point(*a).floor(), None)
    return factory
901764
def lonlat2xyz(lon, lat):
    """"""
    lat = xu.deg2rad(lat)
    lon = xu.deg2rad(lon)
    x = xu.cos(lat) * xu.cos(lon)
    y = xu.cos(lat) * xu.sin(lon)
    z = xu.sin(lat)
    return x, y, z
593353
def interpolate(self, lat, lon, var):
        

        subset, dims = self.crop(lat, lon, var)

        if np.all([y in dims['lat'] for y in lat]) & \
                np.all([x in dims['lon'] for x in lon]):
                    yn = np.nonzero([y in lat for y in dims['lat']])[0]
                    xn = np.nonzero([x in lon for x in dims['lon']])[0]
                    output = {}
                    for v in subset:
                        # output[v] = subset[v][dn, zn, yn, xn]
                        # Seriously that this is the way to do it?!!??
                        output[v] = subset[v][:, xn][yn]
                    return output

        # The output coordinates shall be created only once.
        points_out = []
        for latn in lat:
            for lonn in lon:
                points_out.append([latn, lonn])
        points_out = np.array(points_out)

        output = {}
        for v in var:
            output[v] = ma.masked_all(
                    (lat.size, lon.size),
                    dtype=subset[v].dtype)

            # The valid data
            idx = np.nonzero(~ma.getmaskarray(subset[v]))

            if idx[0].size > 0:
                points = np.array([
                    dims['lat'][idx[0]], dims['lon'][idx[1]]]).T
                values = subset[v][idx]

                # Interpolate along the dimensions that have more than one
                #   position, otherwise it means that the output is exactly
                #   on that coordinate.
                ind = np.array(
                        [np.unique(points[:, i]).size > 1 for i in
                            range(points.shape[1])])
                assert ind.any()

                values_out = griddata(
                        np.atleast_1d(np.squeeze(points[:, ind])),
                        values,
                        np.atleast_1d(np.squeeze(points_out[:, ind]))
                        )

                # Remap the interpolated value back into a 4D array
                idx = np.isfinite(values_out)
                for [y, x], out in zip(points_out[idx], values_out[idx]):
                    output[v][y==lat, x==lon] = out

        return output
847175
function(start, end, point) {
        if (point <= start) {
            return 0;
        }
        if (point >= end) {
            return 1;
        }
        let x = (point - start) / (end - start); // interpolation
        return x * x * (3 - 2 * x);
    }
580610
def for_point(cls, point, zoom):
        """"""
        latitude, longitude = point.latitude_longitude
        return cls.for_latitude_longitude(latitude=latitude, longitude=longitude, zoom=zoom)
607729
def _normalizePoint(self, x, y):
        
        # cast to int, always faster than type checking
        x = int(x)
        y = int(y)

        assert (-self.width <= x < self.width) and \
               (-self.height <= y < self.height), \
               ('(%i, %i) is an invalid postition on %s' % (x, y, self))

        # handle negative indexes
        return (x % self.width, y % self.height)
1161169
def y0astep():
    
    """

    global mp_b
    mp_b[:] = mp_inv_off_diag * np.sum((mp_S + mp_rho*(mp_DX+mp_U0)),
                                       axis=mp_axisM, keepdims=True)
1131447
def _extrapolate(self, result, v, below_bounds, above_bounds, der):
        """"""
        if self.extrapolate_mode == 'const':
            fill_b = fill_a = self.fill_value
        elif self.extrapolate_mode == 'border':
            fill_b = self._poly_eval(0, 0, der)
            fill_a = self._poly_eval(0, -1, der)
        elif self.extrapolate_mode == 'extrapolate':
            u = v[above_bounds] - self._x[-2]
            fill_a = self._poly_eval(u, -2, der)
            u = v[below_bounds] - self._x[0]
            fill_b = self._poly_eval(u, 0, der)
        else:
            raise ValueError("extrapolation method doesn't exist")

        result[below_bounds] = fill_b
        result[above_bounds] = fill_a
589919
def point_lm(self, context):
        

        # Shape (npsrc, 2)
        (ls, us), _ = context.array_extents(context.name)
        return np.asarray(lm_coords[ls:us], dtype=context.dtype)
307963
def convertor(geometry, method="wgs2gcj"):
    
    if geometry['type'] == 'Point':
        coords = geometry['coordinates']
        coords[0], coords[1] = methods[method](coords[0], coords[1])
    elif geometry['type'] == 'LineString' or geometry['type'] == 'MutliPoint':
        coordinates = geometry['coordinates']
        for coords in coordinates:
            coords[0], coords[1] = methods[method](coords[0], coords[1])
    elif geometry['type'] == 'Polygon' or geometry['type'] == 'MultiLineString':
        coordinates = geometry['coordinates']
        for rings in coordinates:
            for coords in rings:
                coords[0], coords[1] = methods[method](coords[0], coords[1])
    elif geometry['type'] == 'MultiPolygon':
        coordinates = geometry['coordinates']
        for rings in coordinates:
            for lines in rings:
                for coords in lines:
                    coords[0], coords[1] = methods[method](coords[0], coords[1])
    return geometry
316793
def convert(lat, lon):
    """"""

    x = numpy.cos(lon) * numpy.cos(lat)
    y = numpy.sin(lon) * numpy.cos(lat)
    z = numpy.sin(lat)

    # Invariable plane: values in arcseconds.
    epsilon = 5713.86
    omega = 387390.8

    coseps = numpy.cos(epsilon * secrad)
    sineps = numpy.sin(epsilon * secrad)
    cosom = numpy.cos(omega * secrad)
    sinom = numpy.sin(omega * secrad)

    xi = x * cosom + y * sinom
    yi = coseps * (-sinom * x + cosom * y) + sineps * z
    zi = - sineps * (-sinom * x + cosom * y) + coseps * z

    lat = numpy.arcsin(zi)
    lon = numpy.arctan2(yi, xi)
    return (lat, lon)
211931
def to_gtp(coord):
    """"""
    if coord is None:
        return 'pass'
    y, x = coord
    return '{}{}'.format(_GTP_COLUMNS[x], go.N - y)
1199702
def radialrange(self, origin, return_all_global_extrema=False):
        """"""
        return bezier_radialrange(self, origin,
                return_all_global_extrema=return_all_global_extrema)
289834
def point(self, t):
        """"""
        return (1 - t)**2*self.start + 2*(1 - t)*t*self.control + t**2*self.end