Example #1
0
 def to_space(self, C, x, y, z, broadcast=False):
     CC = C*self.A
     if len(CC.shape) > 3 and broadcast:
         CC = np.transpose(CC, axes=(1,2,3,0))
         return np.einsum('...ijk,i,j,k->...ijk', hermgrid3d(x, y, z, CC), np.exp(-x**2/2), np.exp(-y**2/2), np.exp(-z**2/2))
     else:
         return np.einsum('ijk,i,j,k->ijk', hermgrid3d(x, y, z, CC), np.exp(-x**2/2), np.exp(-y**2/2), np.exp(-z**2/2))
Example #2
0
    def test_hermgrid3d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

        #test values
        tgt = np.einsum('i,j,k->ijk', y1, y2, y3)
        res = herm.hermgrid3d(x1, x2, x3, self.c3d)
        assert_almost_equal(res, tgt)

        #test shape
        z = np.ones((2, 3))
        res = herm.hermgrid3d(z, z, z, self.c3d)
        assert_(res.shape == (2, 3) * 3)
Example #3
0
    def test_hermgrid3d(self):
        x1, x2, x3 = self.x
        y1, y2, y3 = self.y

        #test values
        tgt = np.einsum('i,j,k->ijk', y1, y2, y3)
        res = herm.hermgrid3d(x1, x2, x3, self.c3d)
        assert_almost_equal(res, tgt)

        #test shape
        z = np.ones((2,3))
        res = herm.hermgrid3d(z, z, z, self.c3d)
        assert_(res.shape == (2, 3)*3)
Example #4
0
 def E_MF(self, C):
     CC = C*self.A
     # print(CC.shape)
     P =  np.abs(hermgrid3d(self.x_emf/sq2, self.x_emf/sq2, self.x_emf/sq2, CC))**4
     # print(P.shape)
     return 0.5*self.g_int * np.einsum('ijk,i,j,k->', P, self.w_emf, self.w_emf, self.w_emf)/(2*sq2)/np.sqrt(self.AR)