Joshuaalbert / DSA2000-Cal

DSA-2000 Calibration and Forward Modelling
https://www.deepsynoptic.org/overview
MIT License
1 stars 0 forks source link

Adjust implementation to handle large numbers of channels #69

Closed Joshuaalbert closed 3 months ago

Joshuaalbert commented 3 months ago

Can use interpolation per baseline along frequency? Answer: No, channel widths are already at the furthest spacing possible.

V[lambda] = sum_k I[k]/n e^(-2pi i (l u + m v + (1-n) w) / lambda)

If we interpolate, suppose lambda0 < lambda < lambda0 + dlambda, then interpolation is given by:

V[lambda] = (1 - alpha) * V[lambda0] + alpha * V[lambda0 + dlambda]

where alpha = (lambda - lambda0) / dlambda. Substituting the eq above:

V[lambda] = (1 - alpha) * sum_k I[k]/n e^(-2pi i (l u + m v + (1-n) w) / lambda0) + alpha * sum_k I[k]/n e^(-2pi i (l u + m v + (1-n) w) / (lambda0 + dlambda))
= sum_k I[k]/n [(1 - alpha) * e^(-2pi i (l u + m v + (1-n) w) / lambda0) + alpha * e^(-2pi i (l u + m v + (1-n) w) / (lambda0 + dlambda))]

This is a good approximation if the term in square brackets is a good approximation for e^(-2pi i (l u + m v + (1-n) w) / lambda). Let us find an upper bound on the error of the approximation.

def approx_error_interp_exponential():
    def exponential(x, nu):
        return np.exp(-2j * jnp.pi * (x * nu / constants.c))

    def approximation(x, nu, nu0, dnu):
        alpha = (nu - nu0) / dnu
        return (1 - alpha) * exponential(x, nu0) * alpha * exponential(x, nu0 + dnu)

    def error(x, nu, nu0, dnu):
        return np.abs(exponential(x, nu) - approximation(x, nu, nu0, dnu))

    import astropy.units as au
    import astropy.constants as constants

    x = 3 * au.km
    nu0 = 50e6 * au.Hz
    dnu = 24e3 * au.Hz
    nu = jnp.linspace(nu0, nu0 + dnu, 100) * au.Hz

    errors = error(x, nu, nu0, dnu)
    import pylab as plt

    plt.plot(nu, errors)
    plt.show()

We can see that already at the channel width of LWA (24KHz) we see linear interpolation errors of the exponential terms of up to 25%. This implies that interpolation approach is not useful.

Image