Returns distance given distance modulus.
189917
def dfromdm(dm):
    
    if np.size(dm)>1:
        dm = np.atleast_1d(dm)
    return 10**(1+dm/5)
634529
def _get_distance_term(self, C, rrup, mag):
        
        r_adj = np.sqrt(rrup ** 2.0 + (mag ** 2.0 - 3.1 * mag - 14.55) ** 2.)
        return C["c1"] * np.log10(r_adj) + C["c2"] * r_adj
1341039
def distance_to(self, other):
        """"""
        return np.linalg.norm(self.position-other.position)
819407
def _compute_distance_term(self, C, rrup, mag):
        
        exponent_term = (1.0 + C["c3"] * np.exp(mag - 5.)) ** 2.
        return C["c2"] * np.log(np.sqrt(rrup ** 2. + exponent_term))
1258246
public int getManhattanDistance(Point2 that) {
    return Math.abs(x - that.x) + Math.abs(y - that.y);
  }
411406
def _distance(self,x):
        """"""
        distance = np.empty([len(self.mu)])

        for i in np.arange(len(self.mu)):
            if self.d == 'mahalanobis' and self.is_invertible(self.Z[i]):
                    distance[i] = (x - self.mu[i]).dot(np.linalg.inv(self.Z[i])).dot((x - self.mu[i]).transpose())
            else:
                distance[i] = (x - self.mu[i]).dot((x - self.mu[i]).transpose())

        return distance
161925
def _compute_distance_fast(self):
        """"""
        d, m = edit_distance(self.seq1, self.seq2,
                             action_function=self.action_function,
                             test=self.test)
        if self.dist:
            assert d == self.dist
        if self._matches:
            assert m == self._matches
        self.dist = d
        self._matches = m
737523
def get_distance_matrix(x):
    """"""
    square = nd.sum(x ** 2.0, axis=1, keepdims=True)
    distance_square = square + square.transpose() - (2.0 * nd.dot(x, x.transpose()))
    return nd.sqrt(distance_square)
706435
def eol_distance_next(self, offset=0):
        """"""
        distance = 0
        for char in self.string[self.pos + offset:]:
            if char == '\n':
                break
            else:
                distance += 1
        return distance
1287079
def distance(x,y):
    
    assert len(x) == len(y), "The vector must have same length"
    result = ()
    sum = 0
    for i in range(len(x)):
        result += (x[i] -y[i],)
    for component in result:
        sum += component**2
    return math.sqrt(sum)
1031076
def _get_distance_scaling(self, C, mag, rhypo):
        
        return (C["a3"] * np.log(rhypo)) + (C["a4"] + C["a5"] * mag) * rhypo
1349152
def _distance(self, x0, y0, x1, y1):
        """"""
        dx = x1-x0
        dy = y1-y0
        # roll displacements across the borders
        if self.pix:
            dx[ dx > self.Lx/2 ] -= self.Lx
            dx[ dx < -self.Lx/2 ] += self.Lx
        if self.piy:
            dy[ dy > self.Ly/2 ] -= self.Ly
            dy[ dy < -self.Ly/2 ] += self.Ly
        return dx, dy
1204691
def geo_distance(a, b):
    """"""
    a_y = radians(a.y)
    b_y = radians(b.y)
    delta_x = radians(a.x - b.x)
    cos_x = (sin(a_y) * sin(b_y) +
             cos(a_y) * cos(b_y) * cos(delta_x))
    return acos(cos_x) * earth_radius_km
1119231
def absolute_magnitude(distance_modulus,g,r,prob=None):
    
    V = g - 0.487*(g - r) - 0.0249
        
    flux = np.sum(10**(-(V-distance_modulus)/2.5))
    Mv = -2.5*np.log10(flux)
    return Mv
395842
def distance(self, other):
        
        return np.linalg.norm(other.coords - self.coords)
981486
def distance(a, b, metric="cosine"):
    
    if metric == "cosine":
        return np.dot(a, b.T)
    raise Exception("Unknown metric '{metric}'".format(metric=metric))
345736
def _distance(self):
        """"""
        return np.average(self.min_kl, weights=self.f.weights)