Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Fourier Frequency Interpolation Option for UVBeam #1323

Open
nfcarl opened this issue Jul 25, 2023 · 0 comments
Open

Feature Request: Fourier Frequency Interpolation Option for UVBeam #1323

nfcarl opened this issue Jul 25, 2023 · 0 comments

Comments

@nfcarl
Copy link

nfcarl commented Jul 25, 2023

Steven and myself have been testing interpolation methods for the frequency to create smoother delay spectra in UVBeam. We have found that using a Fourier interpolation with a Gaussian taper gives us the best results at the center of the spectra, though we expect due to non-periodicity the method will perform poorly at the ends. That being said, because it performs so much better than spline interpolation in creating a smooth spectra, (about 4 orders of magnitude more than cubic interpolation), we would like Fourier interpolation as an option to interpolate the frequency. I have attached an image of the Fourier with Gaussian taper and with no taper compared to various spline interpolations below. To create this, we ran Fourier interpolation on the beam itself and then used "cubic" interpolation to run the simulation.

The method we used for the Fourier interpolation and Gaussian taper is shown here:

def fftinterp(y, m, taper=np.ones):
    n = y.shape[-1]
    tapered = y * taper(n)

    X = np.fft.fft(tapered)
    N = n * m 

    z = np.arange(N)/m
    pad = np.zeros(y.shape[:-1]+(N,), dtype=complex)
    pad[..., :n//2 + 1] = X[..., :n//2 + 1]
    pad[..., -n//2:] = X[...,-n//2:]
    X = np.fft.ifft(pad)
    
    return z, X * m / taper(N) 
def gausstaper(n):
    x = np.linspace(-1, 1, n+1)[:-1]
    return np.exp(-x**2 / (2 * 0.2**2))`

We used n = 10 for this simulation to pad the interpolation. The default taper is none, or np.ones, but we substituted gauss=gausstaper(n) for better results. When adding this to the software, we may want to make Gauss taper the default, since no taper leads to very poor results, but other tapers may be affective as well.

fourier_interp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants