Example #1
0
    def __call__(self, theta, phi):
        par = self.par
        if self.backward:
            theta = np.pi - theta

        out = gauss_plus(theta, par[0], par[1], par[2])
        return reshape_broadcast(out, np.broadcast(theta, phi).shape)
Example #2
0
    def __call__(self, theta, phi):

        if self.backward:
            theta = np.pi - theta
        out = self.sp(theta, self.nu, grid=False)

        return reshape_broadcast(out, np.broadcast(theta, phi).shape)
Example #3
0
 def __call__(self, theta, phi):
     par = self.par
     if self.backward:
         theta = np.pi - theta
     theta_eff = theta
     if 170 >= self.nu >= 130:
         theta_eff = theta * self.nu / 150
     out = gauss_plus(theta_eff, par[0], par[1], par[2])
     return reshape_broadcast(out, np.broadcast(theta, phi).shape)
Example #4
0
 def func(shapein, shapeout, extradata, extrainput):
     datashape = extradata + shapeout + shapein
     d = np.arange(product(datashape)).reshape(datashape)
     b = DenseBlockDiagonalOperator(d,
                                    naxesin=len(shapein),
                                    naxesout=len(shapeout))
     new_shape = broadcast_shapes(extradata, extrainput)
     bdense = b.todense(shapein=new_shape + shapein)
     d_ = reshape_broadcast(d, new_shape + shapeout + shapein)
     d_ = d_.reshape(-1, product(shapeout), product(shapein))
     expected = BlockDiagonalOperator(
         [_ for _ in d_],
         axisin=0).todense(shapein=product(new_shape + shapein))
     assert_same(bdense, expected)
     bTdense = b.T.todense(shapein=new_shape + shapeout)
     assert_same(bTdense, expected.T)
Example #5
0
    def __call__(self, theta, phi):
        if self.backward:
            theta = np.pi - theta

        s_peak = self.sigma
        s_ripple = self.sigma / 1.96

        coef = -0.5 / s_peak**2
        out = ne.evaluate('exp(coef * theta**2)')

        h = [0.01687, 0.00404]  # relative heights of the first two ripples
        add = np.zeros(out.shape)
        for r in xrange(self.nripples):
            coef = -0.5 / s_ripple**2
            rh = h[r]
            m = s_peak * 4.014 + s_peak * r * 2.308
            add += ne.evaluate('rh * exp(coef * (theta - m)**2)')
            set_trace()
        out += add

        return reshape_broadcast(out, np.broadcast(theta, phi).shape)
Example #6
0
    def __call__(self, theta, phi):
        if self.backward:
            theta = np.pi - theta
            
        s_peak = self.sigma
        s_ripple = self.sigma / 1.96

        coef = -0.5 / s_peak**2
        out = ne.evaluate('exp(coef * theta**2)')

        h = [0.01687, 0.00404] # relative heights of the first two ripples
        add = np.zeros(out.shape)
        for r in xrange(self.nripples):
            coef = -0.5 / s_ripple**2
            rh = h[r]
            m = s_peak * 4.014 + s_peak * r * 2.308
            add += ne.evaluate('rh * exp(coef * (theta - m)**2)')
            set_trace()
        out += add
            
        return reshape_broadcast(out, np.broadcast(theta, phi).shape)
Example #7
0
 def __call__(self, theta, phi):
     if self.backward:
         theta = np.pi - theta
     coef = -0.5 / self.sigma**2
     out = ne.evaluate('exp(coef * theta**2)')
     return reshape_broadcast(out, np.broadcast(theta, phi).shape)
Example #8
0
 def __call__(self, theta, phi):
     out = 1.
     return reshape_broadcast(out, np.broadcast(theta, phi).shape)
Example #9
0
 def func(shape, new_shape):
     data_ = data.reshape(shape)
     expected = np.empty(new_shape)
     expected[...] = data_
     actual = reshape_broadcast(data_, new_shape)
     assert_equal(actual, expected)
Example #10
0
 def __call__(self, theta_rad, phi_rad):
     out = 1.
     return reshape_broadcast(out, np.broadcast(theta_rad, phi_rad).shape)
Example #11
0
 def __call__(self, theta_rad, phi_rad):
     if self.backward:
         theta_rad = pi - theta_rad
     coef = -0.5 / self.sigma_rad**2
     out = ne.evaluate('exp(coef * theta_rad**2)')
     return reshape_broadcast(out, np.broadcast(theta_rad, phi_rad).shape)
Example #12
0
 def func(shape, new_shape):
     data_ = data.reshape(shape)
     expected = np.empty(new_shape)
     expected[...] = data_
     actual = reshape_broadcast(data_, new_shape)
     assert_equal(actual, expected)
Example #13
0
 def __call__(self, theta, phi):
     if self.backward:
         theta = np.pi - theta
     coef = -0.5 / self.sigma**2
     out = ne.evaluate('exp(coef * theta**2)')
     return reshape_broadcast(out, np.broadcast(theta, phi).shape)