Skip to content

Commit

Permalink
add non-coplanar array test
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-a-cox committed Jul 19, 2024
1 parent 3bda1a3 commit 2605f31
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions fftvis/tests/test_compare_matvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,42 @@ def test_simulate():

# Check that the results are the same
assert np.allclose(mvis, fvis, atol=1e-5)


def test_simulate_non_coplanar():
# Simulation parameters
ntimes = 10
nfreqs = 5
nants = 3
nsrcs = 20

# Set random set
np.random.seed(42)

# Define frequency and time range
freqs = np.linspace(100e6, 200e6, nfreqs)
lsts = np.linspace(0, np.pi, ntimes)

# Set up the antenna positions
antpos = {k: np.array([k * 10, 0, k]) for k in range(nants)}

# Define a Gaussian beam
beam = AnalyticBeam("gaussian", diameter=14.0)

# Set sky model
ra = np.linspace(0.0, 2.0 * np.pi, nsrcs)
dec = np.linspace(-0.5 * np.pi, 0.5 * np.pi, nsrcs)
sky_model = np.random.uniform(0, 1, size=(nsrcs, 1)) * (freqs[None] / 150e6) ** -2.5

# Use matvis as a reference
mvis = matvis.simulate_vis(
antpos, sky_model, ra, dec, freqs, lsts, beams=[beam], precision=2
)

# Use fftvis to simulate visibilities
fvis = simulate.simulate_vis(
antpos, sky_model, ra, dec, freqs, lsts, beam, precision=2, eps=1e-10
)

# Check that the results are the same
assert np.allclose(mvis, fvis, atol=1e-5)

0 comments on commit 2605f31

Please sign in to comment.