-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi everyone,
This should probably be a separate issue, but there might be some more accuracy problems with FFBBasis. For instance, the code below transforms a 3D Gaussian into the basis and then back into the Cartesian grid and even with the change above, my machine makes the FFBBasis a lot less accurate than FBBasis (1st plot is ground truth, 2nd is FFB, 3d is FB).
from aspire.basis import *
import numpy as np
import matplotlib.pyplot as plt
from aspire.utils.fft import centered_fft3, centered_ifft3
def make_spot_3d(bright, spread, x0,y0,z0, s):
# Create x and y indices
x = np.linspace(-3, 3, s[0])
y = np.linspace(-3, 3, s[1])
z = np.linspace(-3, 3, s[2])
X, Y, Z = np.meshgrid(x, y, z)
Intensity = bright*np.exp(-((X-x0)/spread)**2
-((Y-y0)/spread)**2
-((Z-z0)/spread)**2)
return Intensity
M = 32
s3d = (M,M,M)
lmax = 7
bas = FFBBasis3D(s3d, ell_max = lmax, dtype=np.float64)
bas2 = FBBasis3D(s3d, ell_max = lmax, dtype=np.float64)
x = make_spot_3d(1,1/2.,0,1/2.,1/2.,s3d)
c = bas.expand(x)
c2 = bas2.evaluate_t(centered_fft3(x))
y = bas.evaluate(c)
y2 = centered_ifft3(bas2.evaluate(c2))
plt.subplot(3,1,1)
plt.plot(x.flatten())
plt.subplot(3,1,2)
plt.plot(y.flatten())
plt.subplot(3,1,3)
plt.plot(y2.flatten())
plt.show()Originally posted by @oscarmickelin in #528 (comment)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working