Return the spherical harmonic coefficients of Slepian function i as an
        array, where i = 0 is the best concentrated function.
351431
def _to_array(self, alpha, normalization='4pi', csphase=1):
        
        if self.coeffs is None:
            coeffs = _np.copy(self._taper2coeffs(alpha))
        else:
            if alpha > self.nrot - 1:
                raise ValueError('alpha must be less than or equal to ' +
                                 'nrot - 1. alpha = {:d}, nrot = {:d}'
                                 .format(alpha, self.nrot))
            coeffs = _shtools.SHVectorToCilm(self.coeffs[:, alpha])

        if normalization == 'schmidt':
            for l in range(self.lmax + 1):
                coeffs[:, l, :l+1] *= _np.sqrt(2.0 * l + 1.0)
        elif normalization == 'ortho':
            coeffs *= _np.sqrt(4.0 * _np.pi)

        if csphase == -1:
            for m in range(self.lmax + 1):
                if m % 2 == 1:
                    coeffs[:, :, m] = - coeffs[:, :, m]

        return coeffs
1358214
def noisysphere(self, x, noise=2.10e-9, cond=1.0, noise_offset=0.10):
        
        return self.elli(x, cond=cond) * (1 + noise * np.random.randn() / len(x)) + noise_offset * np.random.rand()
483599
def _hammer_function(self, x,x0,r_x0, s_x0):
        '''
        
        '''
        return norm.logcdf((np.sqrt((np.square(np.atleast_2d(x)[:,None,:]-np.atleast_2d(x0)[None,:,:])).sum(-1))- r_x0)/s_x0)
1167356
def _zeros(ftype, *dims):
    """"""
    shape = _dims2shape(*dims)
    objs = [ftype.box(0) for _ in range(_volume(shape))]
    return farray(objs, shape, ftype)
399161
def get_vectors(self, indices=None):
        ''''''
        H_ = self._deflated_solver.H
        (n_, n) = H_.shape
        coeffs = self.coeffs if indices is None else self.coeffs[:, indices]
        return numpy.c_[self._deflated_solver.V[:, :n],
                        self._deflated_solver.projection.U].dot(coeffs)
221093
public float getSphereBound(float[] sphere)
    {
        if ((sphere == null) || (sphere.length != 4) ||
            ((NativeVertexBuffer.getBoundingVolume(getNative(), sphere)) < 0))
        {
            throw new IllegalArgumentException("Cannot copy sphere bound into array provided");
        }
        return sphere[0];
    }
333540
def f(self, m):
        '''  '''
        M = reshape(m,self.input_dim)
        n = M.shape[0]
        if M.shape[1] != self.input_dim:
            return 'Wrong input dimension'
        else:
            S = self.environment.update(M)
            m = M[0]
            s = S[0]
            # Store the points (m,s) explored during the optimisation
            self.pointsList.append((m,s))
            return self.dist_array(S)
582530
def getHessian(self):
        
        assert self.init,        'GP not initialised'
        assert self.fast==False, 'Not supported for fast implementation'
        
        if self.cache['Hessian']==None:
            ParamMask=self.gp.getParamMask()['covar']
            std=SP.zeros(ParamMask.sum())
            H=self.gp.LMLhess_covar()
            It= (ParamMask[:,0]==1)
            self.cache['Hessian']=H[It,:][:,It]
        
        return self.cache['Hessian']
581199
def _jmomentsurfaceMCIntegrand(vz,vR,vT,R,z,df,sigmaR1,gamma,sigmaz1,mvT,n,m,o):
    """"""
    return df(R,vR*sigmaR1,vT*sigmaR1*gamma,z,vz*sigmaz1,use_physical=False,
              func=(lambda x,y,z: x**n*y**m*z**o))\
              *numpy.exp(vR**2./2.+(vT-mvT)**2./2.+vz**2./2.)
458987
def spherical(cls, mag, theta, phi=0):
        ''''''
        return cls(
            mag * math.sin(phi) * math.cos(theta),  # X
            mag * math.sin(phi) * math.sin(theta),  # Y
            mag * math.cos(phi)  # Z
        )
1344356
def _get_nsymop(self):
        """"""
        if self.centrosymmetric:
            return 2 * len(self._rotations) * len(self._subtrans)
        else:
            return len(self._rotations) * len(self._subtrans)
578373
def spacings(self):
        """"""
        result_invsq = (self.reciprocal**2).sum(axis=0)
        result = np.zeros(3, float)
        for i in range(3):
            if result_invsq[i] > 0:
                result[i] = result_invsq[i]**(-0.5)
        return result
814551
function sphereVoxels(cx, cy, cz, r, col){
    return function(cons, nil){
      sphere(cx, cy, cz, r)(function(x, y, z, res){
        return cons(x, y, z, col, res);
      }, nil);
    };
  }
798227
def _to_array(self, alpha, normalization='4pi', csphase=1):
        
        coeffs = _shtools.SHVectorToCilm(self.tapers[:, alpha])

        if normalization == 'schmidt':
            for l in range(self.lmax + 1):
                coeffs[:, l, :l+1] *= _np.sqrt(2.0 * l + 1.0)
        elif normalization == 'ortho':
            coeffs *= _np.sqrt(4.0 * _np.pi)

        if csphase == -1:
            for m in range(self.lmax + 1):
                if m % 2 == 1:
                    coeffs[:, :, m] = - coeffs[:, :, m]

        return coeffs
209460
def esp(self):
        """"""
        result = np.zeros(self.numc, float)
        for index1 in range(self.numc):
            result[index1] = self.esp_component(index1)
        return result
410355
def spherical(coordinates):
    """"""
    c = coordinates
    r = N.linalg.norm(c,axis=0)
    theta = N.arccos(c[2]/r)
    phi = N.arctan2(c[1],c[0])
    return N.column_stack((r,theta,phi))
156598
def spherical_to_vector(spherical):
    
    spherical = np.asanyarray(spherical, dtype=np.float64)
    if not is_shape(spherical, (-1, 2)):
        raise ValueError('spherical coordinates must be (n, 2)!')

    theta, phi = spherical.T
    st, ct = np.sin(theta), np.cos(theta)
    sp, cp = np.sin(phi), np.cos(phi)
    vectors = np.column_stack((ct * sp,
                               st * sp,
                               cp))
    return vectors