def pa_limit(pa):
    """
    Position angle is periodic with period 180 deg
    Constrain pa such that -90<pa<=90

    Parameters
    ----------
    pa : float
      Initial position angle.

    Returns
    -------
    pa : float
      Rotate position angle.
    """
    while pa <= -90:
        pa += 180
    while pa > 90:
        pa -= 180
    return pa