diff --git a/steps/test/integration/CMakeLists.txt b/steps/test/integration/CMakeLists.txt index faf0d8493791df468d7840c8be8be5080e5dfaf3..21d8fc0e309493a363435f9ff55cd09efa8c4267 100644 --- a/steps/test/integration/CMakeLists.txt +++ b/steps/test/integration/CMakeLists.txt @@ -9,6 +9,7 @@ add_python_tests( tClipper tColumnReader tDemix + tFilter tGainCal tGainCalH5Parm tIDGImager diff --git a/steps/test/integration/tFilter.py b/steps/test/integration/tFilter.py new file mode 100644 index 0000000000000000000000000000000000000000..9059d08de155fcceb12bbba16f0261cd002df641 --- /dev/null +++ b/steps/test/integration/tFilter.py @@ -0,0 +1,54 @@ +# Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy) +# SPDX-License-Identifier: GPL-3.0-or-later + +import pytest +from subprocess import check_call + +# Append current directory to system path in order to import testconfig +import sys + +sys.path.append(".") + +import testconfig as tcf +from utils import assert_taql, run_in_tmp_path, untar + +""" +Integration tests for the Filter step. + +Script can be invoked in two ways: +- as standalone from the build/steps/test/integration directory, + using `pytest source/Filter.py` (extended with pytest options of your choice) +- using ctest, see DP3/steps/test/integration/CMakeLists.txt +""" + +MSIN = "tNDPPP-generic.MS" + + +@pytest.fixture(autouse=True) +def source_env(run_in_tmp_path): + untar(f"{tcf.RESOURCEDIR}/{MSIN}.tgz") + + +def test_filter_added_station(): + """ + Adds two stations and filters out the first added station. + """ + MSOUT = "out.ms" + check_call( + [ + tcf.DP3EXE, + "checkparset=1", + f"msin={MSIN}", + f"msout={MSOUT}", + "steps=[stationadder,filter]", + "stationadder.stations={CSNEW:[CS001HBA0,CS002HBA0],RSNEW:[RS106HBA,RS208HBA]}", + "filter.baseline=!CSNEW", + "filter.remove=true", + ] + ) + + taql_command = f"select from {MSOUT}/ANTENNA where NAME='CSNEW'" + assert_taql(taql_command, 0) + + taql_command = f"select from {MSOUT}/ANTENNA where NAME='RSNEW'" + assert_taql(taql_command, 1)