Skip to content

Commit

Permalink
Merge pull request #18 from AlecThomson/docs
Browse files Browse the repository at this point in the history
Fix docs
  • Loading branch information
AlecThomson authored Feb 16, 2024
2 parents 2f886ea + 5ba98f2 commit 9108e95
Showing 1 changed file with 95 additions and 44 deletions.
139 changes: 95 additions & 44 deletions fixms/fix_ms_corrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 9108e95

Please sign in to comment.