def test_betax1(self): bx, by = wave.betaxy((1, 19), (1, 2)) bx1 = wave.betax1(19, (1, 2)) self.allclose(bx[0][0], bx1[0]) out = np.empty_like(bx1) bx1 = wave.betax1(19, (1, 2), out=out) self.allclose(bx[0][0], out[0]) bx, by = wave.betaxy((1, 19), 2) bx1 = wave.betax1(19, 2) self.allclose(bx[0], bx1)
def test_betaxy(self): bx, by = wave.betaxy(self.shape, self.ks) self.allclose(self.betax, bx) self.allclose(self.betay, by) out = np.empty_like(bx), np.empty_like(by) wave.betaxy(self.shape, self.ks, out=out) self.allclose(self.betax, out[0]) self.allclose(self.betay, out[1]) bx, by = wave.betaxy(self.shape, self.ks[1]) self.allclose(self.betax[1], bx) self.allclose(self.betay[1], by) self.isfloat(bx) self.isfloat(by)
def mean_betaphi(field, k0): """Calculates mean beta and phi of a given field.""" b = blackman(field.shape[-2:]) f = fft2(field * b) #filter it with blackman.. betax, betay = betaxy(field.shape[-2:], k0) beta, phi = _fft_betaphi(f, betax, betay) return beta, phi
def fft_betaxy(shape, k0): bx, by = betaxy(shape[-2:], np.asarray(k0, FDTYPE)[..., None]) return bx, by #np.broadcast_to(bx,shape),np.broadcast_to(by,shape)