Skip to content

Commit

Permalink
feat: tests for ska-ost-array-config
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielaBreitman committed Jan 8, 2025
1 parent 37ea7fa commit ef9e317
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/py21cmsense/observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def grid_baselines(
--------
grid_baselines_coherent :
Coherent sum over baseline groups of the output of this method.
grid_basleine_incoherent :
grid_baseline_incoherent :
Incoherent sum over baseline groups of the output of this method.
"""
if baselines is not None:
Expand Down
30 changes: 29 additions & 1 deletion tests/test_observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ def test_from_yaml(bm):


def test_from_ska():
from ska_ost_array_config.array_config import LowSubArray
from ska_ost_array_config.array_config import LowSubArray, UVW
from ska_ost_array_config.simulation_utils import simulate_observation
from astropy.time import Time
from astropy.coordinates import SkyCoord

obs = Observatory.from_ska(subarray_type="AA*", array_type="low", frequency=300.0 * units.MHz)
low_aastar = LowSubArray(subarray_type="AA*")
Expand All @@ -228,6 +231,31 @@ def test_from_ska():
) # selects all core stations, 6 stations in the E1 cluster, excludes core stations C1 and C2
assert obs.antpos.shape == low_custom.array_config.xyz.data.shape

# Simulate visibilities and retreive the UVW values
# ref_time = Time.now()
# zenith = SkyCoord(
# alt=90 * units.deg,
# az=0 * units.deg,
# frame="altaz",
# obstime=ref_time,
# location=low_custom.array_config.location,
# ).icrs
# vis = simulate_observation(
# array_config=low_custom.array_config,
# phase_centre=zenith,
# start_time=ref_time,
# ref_freq=50e6, # Dummy value. We are after uvw values in [m]
# chan_width=1e3, # Dummy value. We are after uvw values in [m]
# n_chan=1,
# )
# uvw = UVW.UVW(vis, ignore_autocorr=False)
# uvw_m = uvw.uvdist_m
# print(uvw_m.shape, uvw_m.min(), uvw_m.max()) # max is 1239.7
# uvws = obs.grid_baselines(coherent=True).flatten()
# print(uvws.shape, uvws.min(), uvws.max()) # max is 1605.0
# assert np.allclose(uvws, uvw_m)



def test_get_redundant_baselines(bm):
a = Observatory(antpos=np.array([[0, 0, 0], [1, 0, 0], [2, 0, 0]]) * units.m, beam=bm)
Expand Down

0 comments on commit ef9e317

Please sign in to comment.