Skip to content

Commit

Permalink
Changed I to pI
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuneeta committed May 16, 2018
1 parent c53cb9a commit 0f538c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions hera_pspec/pstokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

# weights used in forming Stokes visibilities
pol_weights = {
'I': {'XX': 1. , 'YY': 1. },
'Q': {'XX': 1. , 'YY':-1. },
'U': {'XY': 1. , 'YX': 1. },
'V': {'XY':-1.j, 'YX': 1.j},
'pI': {'XX': 1. , 'YY': 1. },
'pQ': {'XX': 1. , 'YY':-1. },
'pU': {'XY': 1. , 'YX': 1. },
'pV': {'XY':-1.j, 'YX': 1.j},
}

def miriad2pyuvdata(dset):
Expand All @@ -26,7 +26,7 @@ def miriad2pyuvdata(dset):
uv.read_miriad(dset)
return uv

def _combine_pol(uvd1, uvd2, pol1, pol2, pstokes='I'):
def _combine_pol(uvd1, uvd2, pol1, pol2, pstokes='pI'):
"""
Reads in miriad file and combines visibilities to form the desired pseudo-stokes visibilities. It returns UVData object containing the pseudo-stokes visibilities
Expand All @@ -47,7 +47,7 @@ def _combine_pol(uvd1, uvd2, pol1, pol2, pstokes='I'):
Polarization of the second UVData object
pstokes: Pseudo-stokes parameter, type: str
Pseudo stokes parameter to form, can be 'I' or 'Q' or 'U' or 'V'. Default: I
Pseudo stokes parameter to form, can be 'pI' or 'pQ' or 'pU' or 'pV'. Default: pI
"""
if isinstance(uvd1, pyuvdata.UVData) == False:
Expand Down Expand Up @@ -80,7 +80,7 @@ def _combine_pol(uvd1, uvd2, pol1, pol2, pstokes='I'):

return uvdS

def construct_pstokes(dset1, dset2, pstokes='I', run_check=True):
def construct_pstokes(dset1, dset2, pstokes='pI', run_check=True):
"""
Validates datasets required to construct desired visibilities and constructs desired Stokes parameters
Expand All @@ -95,7 +95,7 @@ def construct_pstokes(dset1, dset2, pstokes='I', run_check=True):
form Stokes visibilities
pstokes: Stokes parameter, type: str
Pseudo stokes parameter to form, can be 'I' or 'Q' or 'U' or 'V'. Default: I
Pseudo stokes parameter to form, can be 'pI' or 'pQ' or 'pU' or 'pV'. Default: I
run_check: boolean
Option to check for the existence and proper shapes of
Expand Down
8 changes: 4 additions & 4 deletions hera_pspec/tests/test_pstokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def test_combine_pol():

def test_construct_pstokes():
# test to form I and Q from single polarized UVData objects
uvdI = pstokes.construct_pstokes(dset1=uvd1, dset2=uvd2, pstokes='I')
uvdQ = pstokes.construct_pstokes(dset1=uvd1, dset2=uvd2, pstokes='Q')
uvdI = pstokes.construct_pstokes(dset1=uvd1, dset2=uvd2, pstokes='pI')
uvdQ = pstokes.construct_pstokes(dset1=uvd1, dset2=uvd2, pstokes='pQ')

# check exceptions
nt.assert_raises(AssertionError, pstokes.construct_pstokes, uvd1, 1)
Expand Down Expand Up @@ -57,10 +57,10 @@ def test_construct_pstokes():
uvd3 = uvd1 + uvd2

# test to form I and Q from dual polarized UVData objects
uvdI = pstokes.construct_pstokes(dset1=uvd3, dset2=uvd3, pstokes='I')
uvdI = pstokes.construct_pstokes(dset1=uvd3, dset2=uvd3, pstokes='pI')

# check except for same polarizations
nt.assert_raises(AssertionError, dset1=uvd1, dset2=uvd1, pstokes='I')
nt.assert_raises(AssertionError, dset1=uvd1, dset2=uvd1, pstokes='pI')

if __name__ == "__main__":
unittest.main()

0 comments on commit 0f538c6

Please sign in to comment.