diff --git a/resolve/re/response.py b/resolve/re/response.py index 5b78dbd1b70c509d94da92311e66863de0bc7666..488d834d86629de56a8db00a5b5dfe33ac177bc1 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,1j,0], - [0,1,-1j,0], - [1,0,0,-1]]) - mat_stokes_to_linear = jnp.array([[1,1,0,0], - [1,-1,0,0], - [0,0,1,1j], - [0,0,1,-1j]]) - if set(inp_pol) == {'I', 'Q', 'U', 'V'}: - if set(out_pol) == {'RR', 'RL', 'LR', 'LL'}: - return jnp.tensordot(mat_stokes_to_circular,inp, axes=([0],[0])) - elif set(out_pol) == {'XX', 'XY', 'YX', 'YY'}: - return jnp.tensordot(mat_stokes_to_linear,inp, axes=([0],[0])) + mat_stokes_to_circular = jnp.array( + [[1, 0, 0, 1], [0, 1, 1j, 0], [0, 1, -1j, 0], [1, 0, 0, -1]] + ) + mat_stokes_to_linear = jnp.array( + [[1, 1, 0, 0], [1, -1, 0, 0], [0, 0, 1, 1j], [0, 0, 1, -1j]] + ) + if set(inp_pol) == {"I", "Q", "U", "V"}: + if set(out_pol) == {"RR", "RL", "LR", "LL"}: + return jnp.tensordot(mat_stokes_to_circular, inp, axes=([0], [0])) + elif set(out_pol) == {"XX", "XY", "YX", "YY"}: + 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)