Example #1
0
def ProperMotionError__ICRS_to_GAL(phi, theta, sigMuPhiStar, sigMuTheta,
                                   rhoMuPhiMuTheta):
    """
        ----------
        phi             - The longitude-like angle of the position of the source (radians).
        theta           - The latitude-like angle of the position of the source (radians).
        sigMuPhiStar    - Standard error in the proper motion in the longitude-like direction (including cos(latitude) factor).
        sigMuTheta      - Standard error in the proper motion in the latitude-like direction.
        
        Keywords (optional)
        -------------------
        rhoMuPhiMuTheta - Correlation coefficient of the proper motion errors. Set to zero if this keyword is not provided.
        
        Retuns
        ------
        sigMuPhiRotStar    - The transformed standard error in the proper motion in the longitude direction
        (including cos(latitude) factor).
        sigMuThetaRot      - The transformed standard error in the proper motion in the longitude direction.
        rhoMuPhiMuThetaRot - The transformed correlation coefficient.
        """
    # transformation ICRS to GAL
    ctICRS2GAL = CoordinateTransformation(Transformations.ICRS2GAL)
    #
    sigMuPhiRotStar, sigMuThetaRot, rhoMuPhiMuThetaRot = ctICRS2GAL.transformProperMotionErrors(
        phi, theta, sigMuPhiStar, sigMuTheta, rhoMuPhiMuTheta)

    return sigMuPhiRotStar, sigMuThetaRot, rhoMuPhiMuThetaRot
Example #2
0
    def test_transformProperMotionErrors(self):
        """
        Verify that the transformed covariance matrix for the proper motions remains a covariance matrix.
        """
        ct = CoordinateTransformation(Transformations.ICRS2GAL)
        nTests = 100
        phi = 2.0*pi*rand(nTests)
        theta = -pi/2.0+pi*rand(nTests)
        sigPhiStar, sigTheta, rhoPhiTheta = self._generateRandomCovarianceMatrices(nTests)

        sigPhiStarRot, sigThetaRot, rhoPhiThetaRot = ct.transformProperMotionErrors(phi, theta, sigPhiStar,
                sigTheta, rhoMuPhiMuTheta=rhoPhiTheta)
        for i in range(nTests):
            self.assertGreater(sigPhiStarRot[i], 0.0)
            self.assertGreater(sigThetaRot[i], 0.0)
            self.assertTrue(-1<=rhoPhiTheta[i] and rhoPhiTheta[i]<=1)

        sigPhiStarRot, sigThetaRot, rhoPhiThetaRot = ct.transformProperMotionErrors(phi, theta, sigPhiStar, sigTheta)
        for i in range(nTests):
            self.assertGreater(sigPhiStarRot[i], 0.0)
            self.assertGreater(sigThetaRot[i], 0.0)
            self.assertTrue(-1<=rhoPhiTheta[i] and rhoPhiTheta[i]<=1)
Example #3
0
  def test_transformProperMotionErrors(self):
    """
    Verify that the transformed covariance matrix for the proper motions remains a covariance matrix.
    """
    ct = CoordinateTransformation(Transformations.ICRS2GAL)
    nTests = 100
    phi = 2.0*pi*rand(nTests)
    theta = -pi/2.0+pi*rand(nTests)
    sigPhiStar, sigTheta, rhoPhiTheta = self._generateRandomCovarianceMatrices(nTests)

    sigPhiStarRot, sigThetaRot, rhoPhiThetaRot = ct.transformProperMotionErrors(phi, theta, sigPhiStar,
        sigTheta, rhoMuPhiMuTheta=rhoPhiTheta)
    for i in range(nTests):
      self.assertGreater(sigPhiStarRot[i], 0.0)
      self.assertGreater(sigThetaRot[i], 0.0)
      self.assertTrue(-1<=rhoPhiTheta[i] and rhoPhiTheta[i]<=1)

    sigPhiStarRot, sigThetaRot, rhoPhiThetaRot = ct.transformProperMotionErrors(phi, theta, sigPhiStar,
        sigTheta)
    for i in range(nTests):
      self.assertGreater(sigPhiStarRot[i], 0.0)
      self.assertGreater(sigThetaRot[i], 0.0)
      self.assertTrue(-1<=rhoPhiTheta[i] and rhoPhiTheta[i]<=1)