Exemplo n.º 1
0
def decoupled_ellipticity_matrix(jones, ell=0., tags=[], series=None):
    """Creates a decoupled ellipticity matrix (independent angles for x and y).
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The ellipticity angle is created as a Meq.Parm by qualifying 'jones' with
  'ell'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'ellipticity'.
  """
    # create matrix per-station, or just a single matrix
    if series:
        for p in series:
            ax = Parameterization.resolve_parameter("ellipticity",
                                                    jones('angle', 'x', p),
                                                    ell,
                                                    tags=tags)
            ay = Parameterization.resolve_parameter("ellipticity",
                                                    jones('angle', 'y', p),
                                                    ell,
                                                    tags=tags)
            jones(p) << Meq.Matrix22(Meq.Cos(ax), Meq.ToComplex(
                0, Meq.Sin(ax)), Meq.ToComplex(0, Meq.Sin(ay)), Meq.Cos(ay))
    else:
        ax = Parameterization.resolve_parameter("ellipticity",
                                                jones('angle', 'x'),
                                                ell,
                                                tags=tags)
        ay = Parameterization.resolve_parameter("ellipticity",
                                                jones('angle', 'y'),
                                                ell,
                                                tags=tags)
        jones << Meq.Matrix22(Meq.Cos(ax), Meq.ToComplex(0, Meq.Sin(ax)),
                              Meq.ToComplex(0, Meq.Sin(ay)), Meq.Cos(ay))
    return jones
Exemplo n.º 2
0
def ellipticity_matrix(jones, ell=0., tags=[], series=None):
    """Creates a dipole ellipticity matrix.
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The ellipticity angle is created as a Meq.Parm by qualifying 'jones' with
  'ell'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'ellipticity'.
  """
    # create matrix per-station, or just a single matrix
    if series:
        for p in series:
            angle = Parameterization.resolve_parameter("ellipticity",
                                                       jones('angle', p),
                                                       ell,
                                                       tags=tags)
            cosangle = jones("cosa", p) << Meq.Cos(angle)
            isinangle = jones("sina", p) << Meq.ToComplex(0, Meq.Sin(angle))
            jones(p) << Meq.Matrix22(cosangle, isinangle, isinangle, cosangle)
    else:
        angle = Parameterization.resolve_parameter("ellipticity",
                                                   jones('angle'),
                                                   ell,
                                                   tags=tags)
        cosangle = jones("cosa") << Meq.Cos(angle)
        isinangle = jones("sina", p) << Meq.ToComplex(0, Meq.Sin(angle))
        jones << Meq.Matrix22(cosangle, isinangle, isinangle, cosangle)
    return jones
Exemplo n.º 3
0
def decoupled_rotation_matrix(jones, rot=0., tags=[], series=None):
    """Creates a decoupled rotation matrix (independent angles for x and y)
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The rotation angle is created as a Meq.Parm by qualifying 'jones' with
  'angle'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'rotation'.
  """
    # create matrix per-station, or just a single matrix
    if series:
        for p in series:
            ax = Parameterization.resolve_parameter("rotation",
                                                    jones('angle', 'x', p),
                                                    rot,
                                                    tags=tags)
            ay = Parameterization.resolve_parameter("rotation",
                                                    jones('angle', 'y', p),
                                                    rot,
                                                    tags=tags)
            jones(p) << Meq.Matrix22(Meq.Cos(ax), -Meq.Sin(ax), Meq.Sin(ay),
                                     Meq.Cos(ay))
    else:
        ax = Parameterization.resolve_parameter("rotation",
                                                jones('angle', 'x'),
                                                rot,
                                                tags=tags)
        ay = Parameterization.resolve_parameter("rotation",
                                                jones('angle', 'y'),
                                                rot,
                                                tags=tags)
        jones << Meq.Matrix22(Meq.Cos(ax), -Meq.Sin(ax), Meq.Sin(ay),
                              Meq.Cos(ay))
    return jones
Exemplo n.º 4
0
def rotation_matrix(jones, rot=0., tags=[], series=None):
    """Creates a rotation matrix.
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The rotation angle is created as a Meq.Parm by qualifying 'jones' with
  'angle'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'rotation'.
  """
    # create matrix per-station, or just a single matrix
    if series:
        for p in series:
            angle = Parameterization.resolve_parameter("rotation",
                                                       jones('angle', p),
                                                       rot,
                                                       tags=tags)
            cosangle = jones("cosa", p) << Meq.Cos(angle)
            sinangle = jones("sina", p) << Meq.Sin(angle)
            jones(p) << Meq.Matrix22(cosangle, -sinangle, sinangle, cosangle)
    else:
        angle = Parameterization.resolve_parameter("rotation",
                                                   jones('angle'),
                                                   rot,
                                                   tags=tags)
        cosangle = jones("cosa") << Meq.Cos(angle)
        sinangle = jones("sina") << Meq.Sin(angle)
        jones << Meq.Matrix22(cosangle, -sinangle, sinangle, cosangle)
    return jones
Exemplo n.º 5
0
def decoupled_rotation_matrix (jones,rot=0.,tags=[],series=None):
  """Creates a decoupled rotation matrix (independent angles for x and y)
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The rotation angle is created as a Meq.Parm by qualifying 'jones' with
  'angle'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'rotation'.
  """
  # create matrix per-station, or just a single matrix
  if series:
    for p in series:
      ax = Parameterization.resolve_parameter("rotation",jones('angle','x',p),rot,tags=tags);
      ay = Parameterization.resolve_parameter("rotation",jones('angle','y',p),rot,tags=tags);
      jones(p) << Meq.Matrix22(Meq.Cos(ax),-Meq.Sin(ax),Meq.Sin(ay),Meq.Cos(ay));
  else:
    ax = Parameterization.resolve_parameter("rotation",jones('angle','x'),rot,tags=tags);
    ay = Parameterization.resolve_parameter("rotation",jones('angle','y'),rot,tags=tags);
    jones << Meq.Matrix22(Meq.Cos(ax),-Meq.Sin(ax),Meq.Sin(ay),Meq.Cos(ay));
  return jones;
Exemplo n.º 6
0
def rotation_matrix (jones,rot=0.,tags=[],series=None):
  """Creates a rotation matrix.
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The rotation angle is created as a Meq.Parm by qualifying 'jones' with
  'angle'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'rotation'.
  """
  # create matrix per-station, or just a single matrix
  if series:
    for p in series:
      angle = Parameterization.resolve_parameter("rotation",jones('angle',p),rot,tags=tags);
      cosangle = jones("cosa",p) << Meq.Cos(angle);
      sinangle = jones("sina",p) << Meq.Sin(angle);
      jones(p) << Meq.Matrix22(cosangle,-sinangle,sinangle,cosangle);
  else:
    angle = Parameterization.resolve_parameter("rotation",jones('angle'),rot,tags=tags);
    cosangle = jones("cosa") << Meq.Cos(angle);
    sinangle = jones("sina") << Meq.Sin(angle);
    jones << Meq.Matrix22(cosangle,-sinangle,sinangle,cosangle);
  return jones;
Exemplo n.º 7
0
def decoupled_ellipticity_matrix (jones,ell=0.,tags=[],series=None):
  """Creates a decoupled ellipticity matrix (independent angles for x and y).
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The ellipticity angle is created as a Meq.Parm by qualifying 'jones' with
  'ell'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'ellipticity'.
  """
  # create matrix per-station, or just a single matrix
  if series:
    for p in series:
      ax = Parameterization.resolve_parameter("ellipticity",jones('angle','x',p),ell,tags=tags);
      ay = Parameterization.resolve_parameter("ellipticity",jones('angle','y',p),ell,tags=tags);
      jones(p) << Meq.Matrix22(Meq.Cos(ax),Meq.ToComplex(0,Meq.Sin(ax)),
                               Meq.ToComplex(0,Meq.Sin(ay)),Meq.Cos(ay));
  else:
    ax = Parameterization.resolve_parameter("ellipticity",jones('angle','x'),ell,tags=tags);
    ay = Parameterization.resolve_parameter("ellipticity",jones('angle','y'),ell,tags=tags);
    jones << Meq.Matrix22(Meq.Cos(ax),Meq.ToComplex(0,Meq.Sin(ax)),
                          Meq.ToComplex(0,Meq.Sin(ay)),Meq.Cos(ay));
  return jones;
Exemplo n.º 8
0
def ellipticity_matrix (jones,ell=0.,tags=[],series=None):
  """Creates a dipole ellipticity matrix.
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The ellipticity angle is created as a Meq.Parm by qualifying 'jones' with
  'ell'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'ellipticity'.
  """
  # create matrix per-station, or just a single matrix
  if series:
    for p in series:
      angle = Parameterization.resolve_parameter("ellipticity",jones('angle',p),ell,tags=tags);
      cosangle = jones("cosa",p) << Meq.Cos(angle);
      isinangle = jones("sina",p) << Meq.ToComplex(0,Meq.Sin(angle));
      jones(p) << Meq.Matrix22(cosangle,isinangle,isinangle,cosangle);
  else:
    angle = Parameterization.resolve_parameter("ellipticity",jones('angle'),ell,tags=tags);
    cosangle = jones("cosa") << Meq.Cos(angle);
    isinangle = jones("sina",p) << Meq.ToComplex(0,Meq.Sin(angle));
    jones << Meq.Matrix22(cosangle,isinangle,isinangle,cosangle);
  return jones;
Exemplo n.º 9
0
def gain_ap_matrix (jones,ampl=1.,phase=0.,tags=[],series=None,solvable=True):
  """Creates an amplitude-phase gain matrix of the form:
        ( ax*e^{i*px}       0      )
        (     0       ay*e^{i*p_y} )
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The x/y amplitudes and phases are created as Meq.Parms (with initial
  values 1 and 0, respectively) by qualifying 'jones' with
  'xa','xp','ya','yp'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'ampl' and 'phase'.
  """
  if Context.observation.circular():
    X,Y,XA,XP,YA,YP = 'r','l','ra','rp','la','lp';
  else:
    X,Y,XA,XP,YA,YP = 'x','y','xa','xp','ya','yp';
  # create matrix per-station, or just a single matrix
  if series:
    for p in series:
      xa = Parameterization.resolve_parameter("ampl",jones(p,XA),ampl,tags=tags,solvable=solvable);
      #print "tags here",tags;
      xp = Parameterization.resolve_parameter("phase",jones(p,XP),phase,tags=tags,solvable=solvable);
      ya = Parameterization.resolve_parameter("ampl",jones(p,YA),ampl,tags=tags,solvable=solvable);
      yp = Parameterization.resolve_parameter("phase",jones(p,YP),phase,tags=tags,solvable=solvable);
      jones(p) << Meq.Matrix22(
        jones(p,X) << Meq.Polar(xa,xp),
        0,0,
        jones(p,Y) << Meq.Polar(ya,yp)
      );
  else:
    xa = Parameterization.resolve_parameter("ampl",jones(XA),ampl,tags=tags,solvable=solvable);
    xp = Parameterization.resolve_parameter("phase",jones(XP),phase,tags=tags,solvable=solvable);
    ya = Parameterization.resolve_parameter("ampl",jones(YA),ampl,tags=tags,solvable=solvable);
    yp = Parameterization.resolve_parameter("phase",jones(YP),phase,tags=tags,solvable=solvable);
    jones << Meq.Matrix22(
      jones(X) << Meq.Polar(xa,xp),
      0,0,
      jones(Y) << Meq.Polar(ya,yp)
    );
  return jones;
Exemplo n.º 10
0
def gain_ap_matrix(jones,
                   ampl=1.,
                   phase=0.,
                   tags=[],
                   series=None,
                   solvable=True):
    """Creates an amplitude-phase gain matrix of the form:
        ( ax*e^{i*px}       0      )
        (     0       ay*e^{i*p_y} )
  'jones' should be a node stub.
  'series' can be a list of qualifiers to make a series of matrices.
  The x/y amplitudes and phases are created as Meq.Parms (with initial
  values 1 and 0, respectively) by qualifying 'jones' with
  'xa','xp','ya','yp'. These Parm nodes will be tagged with the given set
  of 'tags', plus 'ampl' and 'phase'.
  """
    if Context.observation.circular():
        X, Y, XA, XP, YA, YP = 'r', 'l', 'ra', 'rp', 'la', 'lp'
    else:
        X, Y, XA, XP, YA, YP = 'x', 'y', 'xa', 'xp', 'ya', 'yp'
    # create matrix per-station, or just a single matrix
    if series:
        for p in series:
            xa = Parameterization.resolve_parameter("ampl",
                                                    jones(p, XA),
                                                    ampl,
                                                    tags=tags,
                                                    solvable=solvable)
            #print "tags here",tags;
            xp = Parameterization.resolve_parameter("phase",
                                                    jones(p, XP),
                                                    phase,
                                                    tags=tags,
                                                    solvable=solvable)
            ya = Parameterization.resolve_parameter("ampl",
                                                    jones(p, YA),
                                                    ampl,
                                                    tags=tags,
                                                    solvable=solvable)
            yp = Parameterization.resolve_parameter("phase",
                                                    jones(p, YP),
                                                    phase,
                                                    tags=tags,
                                                    solvable=solvable)
            jones(p) << Meq.Matrix22(
                jones(p, X) << Meq.Polar(xa, xp), 0, 0,
                jones(p, Y) << Meq.Polar(ya, yp))
    else:
        xa = Parameterization.resolve_parameter("ampl",
                                                jones(XA),
                                                ampl,
                                                tags=tags,
                                                solvable=solvable)
        xp = Parameterization.resolve_parameter("phase",
                                                jones(XP),
                                                phase,
                                                tags=tags,
                                                solvable=solvable)
        ya = Parameterization.resolve_parameter("ampl",
                                                jones(YA),
                                                ampl,
                                                tags=tags,
                                                solvable=solvable)
        yp = Parameterization.resolve_parameter("phase",
                                                jones(YP),
                                                phase,
                                                tags=tags,
                                                solvable=solvable)
        jones << Meq.Matrix22(
            jones(X) << Meq.Polar(xa, xp), 0, 0,
            jones(Y) << Meq.Polar(ya, yp))
    return jones