From 9a465242de4fe6cefedfdb53777660ac0fa987ea Mon Sep 17 00:00:00 2001 From: tgalvin Date: Sat, 13 Jan 2024 19:46:15 +0800 Subject: [PATCH] added some tests and data --- ...0.RACS_0635-31.beam0-MFS-subimage_rms.fits | Bin 0 -> 8640 bytes tests/test_ms.py | 13 +++++++ tests/test_validation.py | 33 ++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 flint/data/tests/SB39400.RACS_0635-31.beam0-MFS-subimage_rms.fits create mode 100644 tests/test_ms.py create mode 100644 tests/test_validation.py diff --git a/flint/data/tests/SB39400.RACS_0635-31.beam0-MFS-subimage_rms.fits b/flint/data/tests/SB39400.RACS_0635-31.beam0-MFS-subimage_rms.fits new file mode 100644 index 0000000000000000000000000000000000000000..adb8c363e62d6dca521538f675c75b630cdc0a20 GIT binary patch literal 8640 zcmeI0TZ|i58OKXQ5tTp`rRA!eIYnx=K^}W%eEouou)W^Kn_b(nohGXg((!m~Ph-zG zGvnR34?wvH9x8+oFTe}DREVmGt3c(F5^jYqi6STjLd&h<($dlv8g4D{KjZb<(K@BO ziFiPs)q2Kf&-u;&e7E^#EBVFJLXPvB_=Ka%BiwN8hU0cT?mK)gU#)P@*X_FQ)+fxz zP$pk3yP0JP+7juOwMgn8sIM+6hTeY^y^Buiu@~W%b zUe|GbUg>+j+1bT~b9A3u9Oaqe?0fjc%64d2ZkSe4%)7Lp;OQ zN|+;_5B1%{Ja?>T+0Jnh)#kCD?mMofw~>mDTeoc8H%GC(P%M;+NZ^h6p{4)?uWmLE z^MdYM%O-C-cGL2EbyJWHvu%350Cyb(*x<-imr5uH!oPXj7n$Vu#~r-c9anP;xk|QJ z0xwXw?z+xxrr~GHD5n$Zm70Ki75KMg9XH2ALwMFT8>Va8 zh6&GFwm-HXo-N;!UKsHx71mUh;)GOJ6;V$I@seE+HNLF3dnQMTnMlpf<`${}PZs&B zBq%m^OyXI#;hLz?Fv0|8R@9e){Sdf;@(b-Zs4pUXM-s=7C~^bAYnu-I5!C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H}=@9W?lAa);EC*Kbq qbbk9@=)=D5e+*36e|5(d(_?CZsRgDMm|9?JfvE+i7WhB4z<&T;S9Hn% literal 0 HcmV?d00001 diff --git a/tests/test_ms.py b/tests/test_ms.py new file mode 100644 index 00000000..1ed847e5 --- /dev/null +++ b/tests/test_ms.py @@ -0,0 +1,13 @@ +"""Small tests for items related to measurement sets +and the MS class +""" +from pathlib import Path + +from flint.ms import MS + + +def test_ms_self_attribute(): + ex = Path("example/jack_sparrow.ms") + ms = MS(path=ex) + + assert ms.ms.path == ex diff --git a/tests/test_validation.py b/tests/test_validation.py new file mode 100644 index 00000000..4e521222 --- /dev/null +++ b/tests/test_validation.py @@ -0,0 +1,33 @@ +"""Items related to test functions in the validation stage of flint +""" +import pytest +from pathlib import Path + +import pkg_resources +import numpy as np + +from flint.validation import RMSImageInfo, get_rms_image_info + + +@pytest.fixture +def rms_path(tmpdir): + rms_path = Path( + pkg_resources.resource_filename( + "flint", "data/tests/SB39400.RACS_0635-31.beam0-MFS-subimage_rms.fits" + ) + ) + + return rms_path + + +def test_rms_image_info(rms_path): + rms_info = get_rms_image_info(rms_path=rms_path) + + assert isinstance(rms_info, RMSImageInfo) + assert rms_info.path == rms_path + assert rms_info.no_valid_pixels == 150 + assert rms_info.shape == (10, 15) + assert np.isclose(0.0001515522, rms_info.median) + assert np.isclose(0.00015135764, rms_info.minimum) + assert np.isclose(0.0001518184, rms_info.maximum) + assert np.isclose(1.1098655e-07, rms_info.std)