AlecThomson / arrakis

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

ASKAP correlations are not what wsclean expects #31

Closed AlecThomson closed 1 year ago

AlecThomson commented 1 year ago

As we know, ASKAP MeasurementSets are not 'standard'. I had previously assumed that the only difference was a factor of 2, which we applied to the images. However, its not that simple unfortunately.

WSclean assumes the following formulation for Stokes (taken straight from aocommon):

$$ \begin{bmatrix} I \ Q \ U \ V \end{bmatrix} = \begin{bmatrix} 0.5 & 0 & 0 & 0.5\ 0.5 & 0 & 0 & -0.5\ 0 & 0.5 & 0.5 & 0\ 0 & - 0.5 i & 0.5 i & 0 \end{bmatrix} \begin{bmatrix} XX\ XY\ YX\ YY \end{bmatrix} $$

ASKAP, however, can have an arbitrary rotation of the PAF. See the ASKAP Observation Guide, Eqn. D1. I've been able to solve for the matrix that gives us the appropriate transformation from ASKAP X's and Ys into one's WSclean expects.

Emil also gave us this handy script to get the rotation:

#!/usr/bin/env python
import sys
import numpy as np
from casacore.tables import *

if len(sys.argv) != 2:
    sys.exit("Usage %s <ms_file>" %(sys.argv[0]))

ms = sys.argv[1]

tf = table("%s/FEED" %(ms), readonly=True, ack=False)
ms_feed = tf.getcol('RECEPTOR_ANGLE')
pol_axis = -(np.degrees(ms_feed)-45.0)
print(pol_axis[0][0])
tf.close()

I'll add a script similar to fix_ms_dir to fix this issue.