From 5ba98f2930a0b8e6b17db5f7653e226dd22b8114 Mon Sep 17 00:00:00 2001 From: "Alec Thomson (S&A, Kensington WA)" Date: Fri, 16 Feb 2024 11:27:12 +0900 Subject: [PATCH] Fix docs --- fixms/fix_ms_corrs.py | 139 +++++++++++++++++++++++++++++------------- 1 file changed, 95 insertions(+), 44 deletions(-) diff --git a/fixms/fix_ms_corrs.py b/fixms/fix_ms_corrs.py index 7331f86..0958c4e 100644 --- a/fixms/fix_ms_corrs.py +++ b/fixms/fix_ms_corrs.py @@ -106,38 +106,63 @@ def convert_correlations( .. code-block:: - ⎡I⎤ ⎡ 1 0 0 1 ⎤ ⎡XX_a⎤ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎢Q⎥ ⎢sin(2⋅θ) cos(2⋅θ) cos(2⋅θ) -sin(2⋅θ)⎥ ⎢XY_a⎥ - ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ - ⎢U⎥ ⎢-cos(2⋅θ) sin(2⋅θ) sin(2⋅θ) cos(2⋅θ) ⎥ ⎢YX_a⎥ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎣V⎦ ⎣ 0 -1.0⋅i 1.0⋅i 0 ⎦ ⎣YY_a⎦ + ⎡I⎤ ⎡ 1 0 0 1 ⎤ ⎡XXₐ⎤ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎢Q⎥ ⎢sin(2⋅P) cos(2⋅P) cos(2⋅P) -sin(2⋅P)⎥ ⎢XYₐ⎥ + ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ + ⎢U⎥ ⎢-cos(2⋅P) sin(2⋅P) sin(2⋅P) cos(2⋅P) ⎥ ⎢YXₐ⎥ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎣V⎦ ⎣ 0 -1.0⋅ⅈ 1.0⋅ⅈ 0 ⎦ ⎣YYₐ⎦ - Where theta is the polarization axis angle. In the common case of PA=-45deg -> theta=0deg, this becomes: + Where P is the polarization axis angle. In the common case of P=-45deg this becomes: .. code-block:: - ⎡I⎤ ⎡1 0 0 1⎤ ⎡XX_a⎤ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎢Q⎥ ⎢0 1 1 0⎥ ⎢XY_a⎥ - ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ - ⎢U⎥ ⎢-1 0 0 1⎥ ⎢YX_a⎥ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎣V⎦ ⎣0 -1.0⋅i 1.0⋅i 0⎦ ⎣YY_a⎦ + ⎡I⎤ ⎡1 0 0 1⎤ ⎡XXₐ⎤ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎢Q⎥ ⎢-1 0 0 1⎥ ⎢XYₐ⎥ + ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ + ⎢U⎥ ⎢0 -1 -1 0⎥ ⎢YXₐ⎥ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎣V⎦ ⎣0 -1.0⋅ⅈ 1.0⋅ⅈ 0⎦ ⎣YYₐ⎦ or .. code-block:: - ⎡I⎤ ⎡ XX_a + YY_a ⎤ - ⎢ ⎥ ⎢ ⎥ - ⎢Q⎥ ⎢ XY_a + YX_a ⎥ - ⎢ ⎥ = ⎢ ⎥ - ⎢U⎥ ⎢ -XX_a + YY_a ⎥ - ⎢ ⎥ ⎢ ⎥ - ⎣V⎦ ⎣-i⋅XY_a + 1.0⋅i⋅YX_a⎦ + ⎡I⎤ ⎡ XXₐ + YYₐ ⎤ + ⎢ ⎥ ⎢ ⎥ + ⎢Q⎥ ⎢ -XXₐ + YYₐ ⎥ + ⎢ ⎥ = ⎢ ⎥ + ⎢U⎥ ⎢ -XYₐ - YXₐ ⎥ + ⎢ ⎥ ⎢ ⎥ + ⎣V⎦ ⎣-ⅈ⋅XYₐ + 1.0⋅ⅈ⋅YXₐ⎦ + + If instead the P=+45deg then this becomes: + + .. code-block:: + + ⎡I⎤ ⎡1 0 0 1 ⎤ ⎡XXₐ⎤ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎢Q⎥ ⎢1 0 0 -1⎥ ⎢XYₐ⎥ + ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ + ⎢U⎥ ⎢0 1 1 0 ⎥ ⎢YXₐ⎥ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎣V⎦ ⎣0 -1.0⋅ⅈ 1.0⋅ⅈ 0 ⎦ ⎣YYₐ⎦ + + + or + + .. code-block:: + + ⎡I⎤ ⎡ XXₐ + YYₐ ⎤ + ⎢ ⎥ ⎢ ⎥ + ⎢Q⎥ ⎢ XXₐ - YYₐ ⎥ + ⎢ ⎥ = ⎢ ⎥ + ⎢U⎥ ⎢ XYₐ + YXₐ ⎥ + ⎢ ⎥ ⎢ ⎥ + ⎣V⎦ ⎣-ⅈ⋅XYₐ + 1.0⋅ⅈ⋅YXₐ⎦ However, most imagers (e.g. wsclean, CASA) expect @@ -167,41 +192,67 @@ def convert_correlations( .. code-block:: - ⎡XX_w⎤ ⎡sin(2.0⋅θ) + 1 cos(2.0⋅θ) cos(2.0⋅θ) 1 - sin(2.0⋅θ)⎤ ⎡XX_a⎤ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎢XY_w⎥ ⎢ -cos(2.0⋅θ) sin(2.0⋅θ) + 1 sin(2.0⋅θ) - 1 cos(2.0⋅θ) ⎥ ⎢XY_a⎥ - ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ - ⎢YX_w⎥ ⎢ -cos(2.0⋅θ) sin(2.0⋅θ) - 1 sin(2.0⋅θ) + 1 cos(2.0⋅θ) ⎥ ⎢YX_a⎥ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎣YY_w⎦ ⎣1 - sin(2.0⋅θ) -cos(2.0⋅θ) -cos(2.0⋅θ) sin(2.0⋅θ) + 1⎦ ⎣YY_a⎦ + ⎡XX_w⎤ ⎡sin(2.0⋅P) + 1 cos(2.0⋅P) cos(2.0⋅P) 1 - sin(2.0⋅P)⎤ ⎡XXₐ⎤ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎢XY_w⎥ ⎢ -cos(2.0⋅P) sin(2.0⋅P) + 1 sin(2.0⋅P) - 1 cos(2.0⋅P) ⎥ ⎢XYₐ⎥ + ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ + ⎢YX_w⎥ ⎢ -cos(2.0⋅P) sin(2.0⋅P) - 1 sin(2.0⋅P) + 1 cos(2.0⋅P) ⎥ ⎢YXₐ⎥ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎣YY_w⎦ ⎣1 - sin(2.0⋅P) -cos(2.0⋅P) -cos(2.0⋅P) sin(2.0⋅P) + 1⎦ ⎣YYₐ⎦ Where `_w` is the 'wsclean' format and _a is the 'ASKAP' format. - In the case of PA=-45deg -> theta=0deg, this becomes: + In the case of P=-45deg this becomes: .. code-block:: - ⎡XX_w⎤ ⎡1 1 1 1⎤ ⎡XX_a⎤ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎢XY_w⎥ ⎢-1 1 -1 1⎥ ⎢XY_a⎥ - ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ - ⎢YX_w⎥ ⎢-1 -1 1 1⎥ ⎢YX_a⎥ - ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ - ⎣YY_w⎦ ⎣1 -1 -1 1⎦ ⎣YY_a⎦ + ⎡XX_w⎤ ⎡0 0 0 2⎤ ⎡XXₐ⎤ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎢XY_w⎥ ⎢0 0 -2 0⎥ ⎢XYₐ⎥ + ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ + ⎢YX_w⎥ ⎢0 -2 0 0⎥ ⎢YXₐ⎥ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎣YY_w⎦ ⎣2 0 0 0⎦ ⎣YYₐ⎦ or .. code-block:: - ⎡XX_w⎤ ⎡XX_a + XY_a + YX_a + YY_a ⎤ - ⎢ ⎥ ⎢ ⎥ - ⎢XY_w⎥ ⎢-XX_a + XY_a - YX_a + YY_a⎥ - ⎢ ⎥ = ⎢ ⎥ - ⎢YX_w⎥ ⎢-XX_a - XY_a + YX_a + YY_a⎥ - ⎢ ⎥ ⎢ ⎥ - ⎣YY_w⎦ ⎣XX_a - XY_a - YX_a + YY_a ⎦ + ⎡XX_w⎤ ⎡2⋅YYₐ ⎤ + ⎢ ⎥ ⎢ ⎥ + ⎢XY_w⎥ ⎢-2⋅YXₐ⎥ + ⎢ ⎥ = ⎢ ⎥ + ⎢YX_w⎥ ⎢-2⋅XYₐ⎥ + ⎢ ⎥ ⎢ ⎥ + ⎣YY_w⎦ ⎣2⋅XXₐ ⎦ + + + And in the case of P=+45deg this becomes: + + .. code-block:: + + ⎡XX_w⎤ ⎡2 0 0 0⎤ ⎡XXₐ⎤ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎢XY_w⎥ ⎢0 2 0 0⎥ ⎢XYₐ⎥ + ⎢ ⎥ = ⎢ ⎥⋅⎢ ⎥ + ⎢YX_w⎥ ⎢0 0 2 0⎥ ⎢YXₐ⎥ + ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ + ⎣YY_w⎦ ⎣0 0 0 2⎦ ⎣YYₐ⎦ + + or + + .. code-block:: + ⎡XX_w⎤ ⎡2⋅XXₐ⎤ + ⎢ ⎥ ⎢ ⎥ + ⎢XY_w⎥ ⎢2⋅XYₐ⎥ + ⎢ ⎥ = ⎢ ⎥ + ⎢YX_w⎥ ⎢2⋅YXₐ⎥ + ⎢ ⎥ ⎢ ⎥ + ⎣YY_w⎦ ⎣2⋅YYₐ⎦ + That is, when P=+45 H and V are perfectly aligned with X and Y, and + only the factor of 2 is required. """ theta = pol_axis.to(u.rad).value correction_matrix = np.matrix(