diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 17652ba..86e2f4e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: args: [--prose-wrap=always] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.8.3" + rev: "v0.9.2" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -70,7 +70,7 @@ repos: additional_dependencies: ["validate-pyproject-schema-store[all]"] - repo: https://github.com/python-jsonschema/check-jsonschema - rev: "0.30.0" + rev: "0.31.0" hooks: - id: check-dependabot - id: check-github-workflows diff --git a/fixms/fix_ms_corrs.py b/fixms/fix_ms_corrs.py index 1f642ef..86b6aa5 100644 --- a/fixms/fix_ms_corrs.py +++ b/fixms/fix_ms_corrs.py @@ -547,12 +547,12 @@ async def fix_ms_corrs_coro( # throughout the observation. For example, bandpass observations vary # this direction as each beam cycles in the footprint cycles over the # calibrator source. - assert ( - len(feed1) == 1 and len(feed2) == 1 - ), "Found more than one feed orientation!" - assert ( - feed1[0] == feed2[0] - ), f"The unique feed entries available in the data table differ, {feed1=} {feed2=}" + assert len(feed1) == 1 and len(feed2) == 1, ( + "Found more than one feed orientation!" + ) + assert feed1[0] == feed2[0], ( + f"The unique feed entries available in the data table differ, {feed1=} {feed2=}" + ) # The two assertions above should enforce enough constraint # to make sure the rotation matrix constructed is correct diff --git a/tests/test_fix_ms_corrs.py b/tests/test_fix_ms_corrs.py index 28971ad..15520e0 100644 --- a/tests/test_fix_ms_corrs.py +++ b/tests/test_fix_ms_corrs.py @@ -181,24 +181,24 @@ def test_get_pol_axis(ms_standard_example, ms_rotated_example): pol_axis_fixed = get_pol_axis(ms.fixed_ms_path, col="INSTRUMENT_RECEPTOR_ANGLE") rot_pol_axis_fixed = get_pol_axis(ms.fixed_ms_path, col="RECEPTOR_ANGLE") - assert np.isclose( - pol_axis_original, ms.pol_axis - ), f"Pol axis is incorrect {pol_axis_original=}" - assert np.isclose( - pol_axis_fixed, ms.pol_axis - ), f"Pol axis is incorrect {pol_axis_fixed=}" - assert np.isclose( - rot_pol_axis_fixed, 0 * u.deg - ), f"Pol axis is incorrect {rot_pol_axis_fixed=}" + assert np.isclose(pol_axis_original, ms.pol_axis), ( + f"Pol axis is incorrect {pol_axis_original=}" + ) + assert np.isclose(pol_axis_fixed, ms.pol_axis), ( + f"Pol axis is incorrect {pol_axis_fixed=}" + ) + assert np.isclose(rot_pol_axis_fixed, 0 * u.deg), ( + f"Pol axis is incorrect {rot_pol_axis_fixed=}" + ) def test_column_exists(ms_standard_example, ms_rotated_example): # Check that CORRECTED_DATA is on disk for ms in (ms_standard_example, ms_rotated_example): with table(ms.fixed_ms_path.as_posix()) as tab: - assert ( - ms.corrected_data_column in tab.colnames() - ), f"{ms.corrected_data_column} not in MS" + assert ms.corrected_data_column in tab.colnames(), ( + f"{ms.corrected_data_column} not in MS" + ) def test_original_data(ms_standard_example, ms_rotated_example): @@ -290,66 +290,66 @@ def get_wsclean_stokes(ms): def test_rotated_data_I(ms_standard_example): mueller_a = askap_stokes(ms_standard_example) mueller_a_mat = askap_stokes_mat(ms_standard_example) - assert np.allclose( - mueller_a.stokes_I, mueller_a_mat.stokes_I, atol=1e-4 - ), "Stokes rotation I failed" + assert np.allclose(mueller_a.stokes_I, mueller_a_mat.stokes_I, atol=1e-4), ( + "Stokes rotation I failed" + ) def test_rotated_data_Q(ms_standard_example): mueller_a = askap_stokes(ms_standard_example) mueller_a_mat = askap_stokes_mat(ms_standard_example) - assert np.allclose( - mueller_a.stokes_Q, mueller_a_mat.stokes_Q, atol=1e-4 - ), f"Stokes rotation Q failed for {ms_standard_example.fixed_ms_path.name}" + assert np.allclose(mueller_a.stokes_Q, mueller_a_mat.stokes_Q, atol=1e-4), ( + f"Stokes rotation Q failed for {ms_standard_example.fixed_ms_path.name}" + ) def test_rotated_data_U(ms_standard_example): mueller_a = askap_stokes(ms_standard_example) mueller_a_mat = askap_stokes_mat(ms_standard_example) - assert np.allclose( - mueller_a.stokes_U, mueller_a_mat.stokes_U, atol=1e-4 - ), f"Stokes rotation U failed for {ms_standard_example.fixed_ms_path.name}" + assert np.allclose(mueller_a.stokes_U, mueller_a_mat.stokes_U, atol=1e-4), ( + f"Stokes rotation U failed for {ms_standard_example.fixed_ms_path.name}" + ) def test_rotated_data_V(ms_standard_example): mueller_a = askap_stokes(ms_standard_example) mueller_a_mat = askap_stokes_mat(ms_standard_example) - assert np.allclose( - mueller_a.stokes_V, mueller_a_mat.stokes_V, atol=1e-4 - ), f"Stokes rotation V failed for {ms_standard_example.fixed_ms_path.name}" + assert np.allclose(mueller_a.stokes_V, mueller_a_mat.stokes_V, atol=1e-4), ( + f"Stokes rotation V failed for {ms_standard_example.fixed_ms_path.name}" + ) def test_stokes_I(ms_standard_example, ms_rotated_example): for ms in (ms_standard_example, ms_rotated_example): mueller_a = askap_stokes_mat(ms) mueller_w = get_wsclean_stokes(ms) - assert np.allclose( - mueller_a.stokes_I, mueller_w.stokes_I, atol=1e-4 - ), f"ASKAP and WSClean disagree on Stokes I in {ms.fixed_ms_path.name}" + assert np.allclose(mueller_a.stokes_I, mueller_w.stokes_I, atol=1e-4), ( + f"ASKAP and WSClean disagree on Stokes I in {ms.fixed_ms_path.name}" + ) def test_stokes_Q(ms_standard_example, ms_rotated_example): for ms in (ms_standard_example, ms_rotated_example): mueller_a = askap_stokes_mat(ms) mueller_w = get_wsclean_stokes(ms) - assert np.allclose( - mueller_a.stokes_Q, mueller_w.stokes_Q, atol=1e-1 - ), f"ASKAP and WSClean disagree on Stokes Q in {ms.fixed_ms_path.name}" + assert np.allclose(mueller_a.stokes_Q, mueller_w.stokes_Q, atol=1e-1), ( + f"ASKAP and WSClean disagree on Stokes Q in {ms.fixed_ms_path.name}" + ) def test_stokes_U(ms_standard_example, ms_rotated_example): for ms in (ms_standard_example, ms_rotated_example): mueller_a = askap_stokes_mat(ms) mueller_w = get_wsclean_stokes(ms) - assert np.allclose( - mueller_a.stokes_U, mueller_w.stokes_U, atol=1e-4 - ), f"ASKAP and WSClean disagree on Stokes U in {ms.fixed_ms_path.name}" + assert np.allclose(mueller_a.stokes_U, mueller_w.stokes_U, atol=1e-4), ( + f"ASKAP and WSClean disagree on Stokes U in {ms.fixed_ms_path.name}" + ) def test_stokes_V(ms_standard_example, ms_rotated_example): for ms in (ms_standard_example, ms_rotated_example): mueller_a = askap_stokes_mat(ms) mueller_w = get_wsclean_stokes(ms) - assert np.allclose( - mueller_a.stokes_V, mueller_w.stokes_V, atol=1e-4 - ), f"ASKAP and WSClean disagree on Stokes V in {ms.fixed_ms_path.name}" + assert np.allclose(mueller_a.stokes_V, mueller_w.stokes_V, atol=1e-4), ( + f"ASKAP and WSClean disagree on Stokes V in {ms.fixed_ms_path.name}" + )