diff --git a/steps/test/integration/tDemix.py b/steps/test/integration/tDemix.py index 84348462ff5827dc7a645dc36bb0de249dc622e5..a78327ea180d8c9dbdd059e087c2db71ee1aaf19 100755 --- a/steps/test/integration/tDemix.py +++ b/steps/test/integration/tDemix.py @@ -20,7 +20,8 @@ Script can be invoked in two ways: - using ctest, see DP3/steps/test/integration/CMakeLists.txt """ -MSIN = "tDemix.in_MS" +MSIN_DEMIX = "tDemix.in_MS" +MSIN_GENERIC = "tNDPPP-generic.MS" common_args = [ "msin=tDemix_tmp/tDemix.MS", @@ -42,9 +43,9 @@ common_args = [ skymodel_arg = "demix.skymodel='tDemix_tmp/{}'" -@pytest.fixture(autouse=True) -def source_env(run_in_tmp_path): - untar(f"{tcf.RESOURCEDIR}/{MSIN}.tgz") +@pytest.fixture() +def demix_ms(run_in_tmp_path): + untar(f"{tcf.RESOURCEDIR}/{MSIN_DEMIX}.tgz") check_call( [ tcf.MAKESOURCEDBEXE, @@ -54,8 +55,13 @@ def source_env(run_in_tmp_path): ) +@pytest.fixture() +def generic_ms(run_in_tmp_path): + untar(f"{tcf.RESOURCEDIR}/{MSIN_GENERIC}.tgz") + + @pytest.mark.parametrize("skymodel", ["sky.txt", "sourcedb"]) -def test_without_target(skymodel): +def test_without_target(demix_ms, skymodel): check_call( [ tcf.DP3EXE, @@ -73,7 +79,7 @@ def test_without_target(skymodel): @pytest.mark.parametrize("skymodel", ["sky.txt", "sourcedb"]) -def test_with_target_projected_away(skymodel): +def test_with_target_projected_away(demix_ms, skymodel): check_call( [ tcf.DP3EXE, @@ -91,7 +97,7 @@ def test_with_target_projected_away(skymodel): @pytest.mark.parametrize("skymodel", ["sky.txt", "sourcedb"]) -def test_with_target(skymodel): +def test_with_target(demix_ms, skymodel): check_call( [ tcf.DP3EXE, @@ -109,7 +115,7 @@ def test_with_target(skymodel): assert_taql(taql_command) -def test_time_freq_resolution(): +def test_time_freq_resolution(demix_ms): check_call( [ tcf.DP3EXE, @@ -126,3 +132,21 @@ def test_time_freq_resolution(): # Compare some columns of the output MS with the reference output. taql_command = f"select from tDemix_out.MS t1, tDemix_tmp/tDemix_ref1.MS t2 where not all(near(t1.DATA,t2.DATA,1e-3) || (isnan(t1.DATA) && isnan(t2.DATA))) || not all(t1.FLAG = t2.FLAG) || not all(near(t1.WEIGHT_SPECTRUM, t2.WEIGHT_SPECTRUM)) || t1.ANTENNA1 != t2.ANTENNA1 || t1.ANTENNA2 != t2.ANTENNA2 || t1.TIME !~= t2.TIME" assert_taql(taql_command) + + +@pytest.mark.skip(reason="Issue #268 is not fixed yet") +def test_multiple_baseline_selection(generic_ms): + # Test for https://git.astron.nl/RD/DP3/-/issues/268, where the baseline + # selection for demix was already applied using msin and filter. + check_call( + [ + tcf.DP3EXE, + f"msin={MSIN_GENERIC}", + "msin.baseline=CS*&", + "steps=[filter,demix,null]", + "filter.baseline=CS*&", + "filter.remove=true", + "demix.baseline=CS*&", + f"demix.skymodel={MSIN_GENERIC}/sky", + ] + )