def solid_angle(center, coords):
    """
    Helper method to calculate the solid angle of a set of coords from the
    center.

    Args:
        center (3x1 array): Center to measure solid angle from.
        coords (Nx3 array): List of coords to determine solid angle.

    Returns:
        The solid angle.
    """
    o = np.array(center)
    r = [np.array(c) - o for c in coords]
    r.append(r[0])
    n = [np.cross(r[i + 1], r[i]) for i in range(len(r) - 1)]
    n.append(np.cross(r[1], r[0]))
    vals = []
    for i in range(len(n) - 1):
        v = -np.dot(n[i], n[i + 1]) \
            / (np.linalg.norm(n[i]) * np.linalg.norm(n[i + 1]))
        vals.append(acos(abs_cap(v)))
    phi = sum(vals)
    return phi + (3 - len(r)) * pi
def solid_angle ( center , coords ) : o = np . array ( center ) r = [ np . array ( c ) - o for c in coords ] r . append ( r [ 0 ] ) n = [ np . cross ( r [ i + 1 ] , r [ i ] ) for i in range ( len ( r ) - 1 ) ] n . append ( np . cross ( r [ 1 ] , r [ 0 ] ) ) vals = [ ] for i in range ( len ( n ) - 1 ) : v = - np . dot ( n [ i ] , n [ i + 1 ] ) / ( np . linalg . norm ( n [ i ] ) * np . linalg . norm ( n [ i + 1 ] ) ) vals . append ( acos ( abs_cap ( v ) ) ) phi = sum ( vals ) return phi + ( 3 - len ( r ) ) * pi
Helper method to calculate the solid angle of a set of coords from the
    center.

    Args:
        center (3x1 array): Center to measure solid angle from.
        coords (Nx3 array): List of coords to determine solid angle.

    Returns:
        The solid angle.