예제 #1
0
파일: scripting.py 프로젝트: zakiali/aipy
def uv_selector(uv, ants=-1, pol_str=-1):
    """Call uv.select with appropriate options based on string argument for
    antennas (can be 'all', 'auto', 'cross', '0,1,2', or '0_1,0_2') and
    string for polarization ('xx','yy','xy','yx')."""
    if ants != -1:
        if type(ants) == str:
            ants = parse_ants(ants, uv["nants"])
        for cnt, (bl, include, pol) in enumerate(ants):
            if cnt > 0:
                if include:
                    uv.select("or", -1, -1)
                else:
                    uv.select("and", -1, -1)
            if pol == -1:
                pol = pol_str  # default to explicit pol parameter
            if bl == "auto":
                uv.select("auto", 0, 0, include=include)
            else:
                i, j = miriad.bl2ij(bl)
                uv.select("antennae", i, j, include=include)
            if pol != -1:
                for p in pol.split(","):
                    polopt = miriad.str2pol[p]
                    uv.select("polarization", polopt, 0)
    elif pol_str != -1:
        for p in pol_str.split(","):
            polopt = miriad.str2pol[p]
            uv.select("polarization", polopt, 0)
예제 #2
0
def uv_selector(uv, ants, pol_str):
    """Call uv.select with appropriate options based on string argument for
    antennas (can be 'all', 'auto', 'cross', '0,1,2', or '0_1,0_2') and
    string for polarization ('xx','yy','xy','yx' or combinations 'xx,xy' etc.)."""
    if type(ants) == str: ants = parse_ants(ants, uv['nants'])
    print ants
    for bl,include in ants:
        if len(include)>1: include,pol = include
        if bl == 'auto': uv.select('auto', 0, 0, include=include)
        else:
            i,j = miriad.bl2ij(bl)
            uv.select('antennae', i, j, include=include)
    for pol in pol_str.split(','):
        try: polopt = miriad.str2pol[pol_str]
        except(KeyError): raise ValueError('--pol argument invalid or absent')
        uv.select('polarization', polopt, 0)
예제 #3
0
파일: scripting_pol.py 프로젝트: nkern/capo
def uv_selector(uv, ants, pol_str):
    """Call uv.select with appropriate options based on string argument for
    antennas (can be 'all', 'auto', 'cross', '0,1,2', or '0_1,0_2') and
    string for polarization ('xx','yy','xy','yx' or combinations 'xx,xy' etc.)."""
    if type(ants) == str: ants = parse_ants(ants, uv['nants'])
    print ants
    for bl, include in ants:
        if len(include) > 1: include, pol = include
        if bl == 'auto': uv.select('auto', 0, 0, include=include)
        else:
            i, j = miriad.bl2ij(bl)
            uv.select('antennae', i, j, include=include)
    for pol in pol_str.split(','):
        try:
            polopt = miriad.str2pol[pol_str]
        except (KeyError):
            raise ValueError('--pol argument invalid or absent')
        uv.select('polarization', polopt, 0)
예제 #4
0
def uv_selector(uv, ants=-1, pol_str=-1):
    """Call uv.select with appropriate options based on string argument for
    antennas (can be 'all', 'auto', 'cross', '0,1,2', or '0_1,0_2') and
    string for polarization ('xx','yy','xy','yx')."""
    if ants != -1:
        if type(ants) == str: ants = parse_ants(ants, uv['nants'])
        for cnt, (bl, include, pol) in enumerate(ants):
            if cnt > 0:
                if include: uv.select('or', -1, -1)
                else: uv.select('and', -1, -1)
            if pol == -1: pol = pol_str  # default to explicit pol parameter
            if bl == 'auto': uv.select('auto', 0, 0, include=include)
            else:
                i, j = miriad.bl2ij(bl)
                uv.select('antennae', i, j, include=include)
            if pol != -1:
                for p in pol.split(','):
                    polopt = miriad.str2pol[p]
                    uv.select('polarization', polopt, 0)
    elif pol_str != -1:
        for p in pol.split(','):
            polopt = miriad.str2pol[p]
            uv.select('polarization', polopt, 0)
예제 #5
0
파일: phs.py 프로젝트: DavidFMoore/aipy
 def bl2ij(self, bl):
     """Convert Miriad's (i+1) << 8 | (j+1) baseline indexing scheme to 
     i,j (0 indexed)"""
     return bl2ij(bl)
예제 #6
0
파일: phs.py 프로젝트: zuoshifan/aipy
 def bl2ij(self, bl):
     """Convert Miriad's (i+1) << 8 | (j+1) baseline indexing scheme to 
     i,j (0 indexed)"""
     return bl2ij(bl)