diff --git a/resolve/re/response.py b/resolve/re/response.py index b697b90ac505acca620bd79bd9634038996bcd6d..4158c46e1595d10f110788dbde1cd23437e6966b 100644 --- a/resolve/re/response.py +++ b/resolve/re/response.py @@ -19,19 +19,17 @@ def get_binbounds(coordinates): def convert_polarization(inp, inp_pol, out_pol): - mat_stokes_to_circular = jnp.array([[1,0,0,1], - [0,1,1,0], - [0,1j,-1j,0], - [1,0,0,-1]]) - mat_stokes_to_linear = jnp.array([[1,1,0,0], - [1,-1,0,0], - [0,0,1,1], - [0,0,1j,-1j]]) - if inp_pol == ('I', 'Q', 'U', 'V'): - if out_pol == ('RR', 'RL', 'LR', 'LL'): - return jnp.tensordot(mat_stokes_to_circular, inp, axes=([0],[0])) - elif out_pol == ('XX', 'XY', 'YX', 'YY'): - return jnp.tensordot(mat_stokes_to_linear, inp, axes=([0],[0])) + if inp_pol == ("I", "Q", "U", "V"): + if out_pol == ("RR", "RL", "LR", "LL"): + mat_stokes_to_circular = jnp.array( + [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1j, -1j, 0], [1, 0, 0, -1]] + ) + return jnp.tensordot(mat_stokes_to_circular, inp, axes=([0], [0])) + elif out_pol == ("XX", "XY", "YX", "YY"): + mat_stokes_to_linear = jnp.array( + [[1, 1, 0, 0], [1, -1, 0, 0], [0, 0, 1, 1], [0, 0, 1j, -1j]] + ) + return jnp.tensordot(mat_stokes_to_linear, inp, axes=([0], [0])) elif inp_pol == ("I",): if out_pol == ("LL", "RR") or out_pol == ("XX", "YY"): new_shp = list(inp.shape)