def icrsFromFK4(fk4P, fk4V, fk4Epoch): """ Converts mean catalog FK4 equatorial coordinates to ICRS coordinates. Uses the approximation that ICRS is FK5 J2000. Inputs: - fk4Epoch TDB date of fk4 coordinates (Besselian epoch) note: TDT will always do and UTC is usually adequate - fk4P(3) mean catalog fk4 cartesian position (au) - fk4V(3) mean FK4 cartesian velocity (au per Besselian year), i.e. proper motion and radial velocity Returns a tuple containg: - icrsP(3) mean ICRS cartesian position (au), a numpy.array - icrsV(3) mean ICRS cartesian velocity (au/year), a numpy.array Error Conditions: none Warnings: The FK4 date is in Besselian years. The FK4 proper motion is in au/Besselian year, whereas the FK5 J2000 proper motion is in au/Julian year. The FK4 system refers to a specific set of precession constants; not all Besselian-epoch data was precessed using these constants (especially data for epochs before B1950). References: P.T. Wallace's routine FK425 """ fk4P = numpy.asarray(fk4P, dtype=float) fk4V = numpy.asarray(fk4V, dtype=float) # compute new precession constants # note: ETrms and PreBn both want Besselian date eTerms = llv.etrms(fk4Epoch) precMat = llv.prebn(fk4Epoch, 1950.0) # subtract e-terms from position. As a minor approximation, # we don't bother to subtract variation in e-terms from proper motion. magP = RO.MathUtil.vecMag(fk4P) meanFK4P = fk4P - (eTerms * magP) # correct position for velocity (PM and rad. vel.) to B1950 tempP = meanFK4P + fk4V * (1950.0 - fk4Epoch) # precess position and velocity to B1950 b1950P = numpy.dot(precMat, tempP) b1950V = numpy.dot(precMat, fk4V) # convert position and velocity to ICRS (actually FK5 J2000.0) icrsP = numpy.dot(_MatPP, b1950P) + numpy.dot(_MatPV, b1950V) icrsV = numpy.dot(_MatVP, b1950P) + numpy.dot(_MatVV, b1950V) return (icrsP, icrsV)
def icrsFromFK4 (fk4P, fk4V, fk4Epoch): """ Converts mean catalog FK4 equatorial coordinates to ICRS coordinates. Uses the approximation that ICRS is FK5 J2000. Inputs: - fk4Epoch TDB date of fk4 coordinates (Besselian epoch) note: TDT will always do and UTC is usually adequate - fk4P(3) mean catalog fk4 cartesian position (au) - fk4V(3) mean FK4 cartesian velocity (au per Besselian year), i.e. proper motion and radial velocity Returns a tuple containg: - icrsP(3) mean ICRS cartesian position (au), a numpy.array - icrsV(3) mean ICRS cartesian velocity (au/year), a numpy.array Error Conditions: none Warnings: The FK4 date is in Besselian years. The FK4 proper motion is in au/Besselian year, whereas the FK5 J2000 proper motion is in au/Julian year. The FK4 system refers to a specific set of precession constants; not all Besselian-epoch data was precessed using these constants (especially data for epochs before B1950). References: P.T. Wallace's routine FK425 """ fk4P = numpy.asarray(fk4P, dtype = float) fk4V = numpy.asarray(fk4V, dtype = float) # compute new precession constants # note: ETrms and PreBn both want Besselian date eTerms = llv.etrms (fk4Epoch) precMat = llv.prebn (fk4Epoch, 1950.0) # subtract e-terms from position. As a minor approximation, # we don't bother to subtract variation in e-terms from proper motion. magP = RO.MathUtil.vecMag(fk4P) meanFK4P = fk4P - (eTerms * magP) # correct position for velocity (PM and rad. vel.) to B1950 tempP = meanFK4P + fk4V * (1950.0 - fk4Epoch) # precess position and velocity to B1950 b1950P = numpy.dot(precMat, tempP) b1950V = numpy.dot(precMat, fk4V) # convert position and velocity to ICRS (actually FK5 J2000.0) icrsP = numpy.dot(_MatPP, b1950P) + numpy.dot(_MatPV, b1950V) icrsV = numpy.dot(_MatVP, b1950P) + numpy.dot(_MatVV, b1950V) return (icrsP, icrsV)
def fk4FromICRS(icrsP, icrsV, fk4Epoch): """ Converts mean fk4 equatorial coordinates to ICRS coordinates. Uses the approximation that ICRS is FK5 J2000. Inputs: - icrsP(3) ICRS cartesian position (au) - icrsV(3) ICRS cartesian velocity (au per Julian year), i.e. proper motion and radial velocity - fk4Epoch date of fk4 coordinates (Besselian epoch) note: tdt will always do and utc is usually adequate Returns a tuple containing: - fk4P(3) FK4 cartesian position (au), a numpy.array - fk4V(3) FK4 cartesian velocity (au/Besselian year), a numpy.array Error Conditions: none Warnings: The FK4 system refers to a specific set of precession constants, and not all Besselian-epoch data was precessed using these constants (especially data for epochs before B1950). Details: One approximation is used: - Velocity is not corrected for time-variation in the e-terms. This introduces errors on the order of a milliarcsecond per century. References: P.T. Wallace's FK524 routine """ eTerms = llv.etrms(fk4Epoch) precMat = llv.prebn(1950.0, fk4Epoch) # convert position and velocity from J2000.0 to B1950 b1950P = numpy.dot(_MatPP, icrsP) + numpy.dot(_MatPV, icrsV) b1950V = numpy.dot(_MatVP, icrsP) + numpy.dot(_MatVV, icrsV) # correct position for velocity (pm and rad. vel.) to fk4Epoch tempP = b1950P + b1950V * (fk4Epoch - 1950.0) # precess position and velocity to B1950 meanFK4P = numpy.dot(precMat, tempP) fk4V = numpy.dot(precMat, b1950V) # add e-terms to mean position, iterating thrice (should be plenty!) # to get mean catalog place. As a minor approximation, # we don't bother to add variation in e-terms to the velocity. fk4P = meanFK4P.copy() for iterNum in range(3): magP = RO.MathUtil.vecMag(fk4P) fk4P = meanFK4P + eTerms * magP return (fk4P, fk4V)
def fk4FromICRS(icrsP, icrsV, fk4Epoch): """ Converts mean fk4 equatorial coordinates to ICRS coordinates. Uses the approximation that ICRS is FK5 J2000. Inputs: - icrsP(3) ICRS cartesian position (au) - icrsV(3) ICRS cartesian velocity (au per Julian year), i.e. proper motion and radial velocity - fk4Epoch date of fk4 coordinates (Besselian epoch) note: tdt will always do and utc is usually adequate Returns a tuple containing: - fk4P(3) FK4 cartesian position (au), a numpy.array - fk4V(3) FK4 cartesian velocity (au/Besselian year), a numpy.array Error Conditions: none Warnings: The FK4 system refers to a specific set of precession constants, and not all Besselian-epoch data was precessed using these constants (especially data for epochs before B1950). Details: One approximation is used: - Velocity is not corrected for time-variation in the e-terms. This introduces errors on the order of a milliarcsecond per century. References: P.T. Wallace's FK524 routine """ eTerms = llv.etrms (fk4Epoch) precMat = llv.prebn (1950.0, fk4Epoch) # convert position and velocity from J2000.0 to B1950 b1950P = numpy.dot(_MatPP, icrsP) + numpy.dot(_MatPV, icrsV) b1950V = numpy.dot(_MatVP, icrsP) + numpy.dot(_MatVV, icrsV) # correct position for velocity (pm and rad. vel.) to fk4Epoch tempP = b1950P + b1950V * (fk4Epoch - 1950.0) # precess position and velocity to B1950 meanFK4P = numpy.dot (precMat, tempP) fk4V = numpy.dot (precMat, b1950V) # add e-terms to mean position, iterating thrice (should be plenty!) # to get mean catalog place. As a minor approximation, # we don't bother to add variation in e-terms to the velocity. fk4P = meanFK4P.copy() for iterNum in range(3): magP = RO.MathUtil.vecMag(fk4P) fk4P = meanFK4P + eTerms * magP return (fk4P, fk4V)
def icrsFromFixedFK4(fk4P, fk4Date): """ Converts mean catalog fk4 coordinates to ICRS for a fixed star. Uses the approximation that ICRS = FK5 J2000. Inputs: - fk4Date TDB date of fk4 coordinates (Besselian epoch) note: TDT will always do and UTC is usually adequate - fk4P(3) mean catalog fk4 cartesian position (au) Returns: - icrsP(3) ICRS cartesian position (au), a numpy.array Error Conditions: none Warnings: The FK4 date is in Besselian years. The star is assumed fixed on the celestial sphere. That is a bit different than assuming it has zero proper motion because FK4 system has slight ficticious proper motion. The FK4 system refers to a specific set of precession constants; not all Besselian-epoch data was precessed using these constants (especially data for epochs before B1950). References: P.T. Wallace's routine FK45Z """ # compute new precession constants # note: ETrms and PreBn both want Besselian date eTerms = llv.etrms (fk4Date) precMat = llv.prebn (fk4Date, 1950.0) # subtract e-terms from position. As a minor approximation, # we don't bother to subtract variation in e-terms from proper motion. magP = RO.MathUtil.vecMag(fk4P) meanFK4P = fk4P - (eTerms * magP) # precess position to B1950, assuming zero fk4 pm # (we'll correct for the fictious fk4 pm later) b1950P = numpy.dot(precMat, meanFK4P) # convert position to ICRS (actually FK5 J2000) # but still containing fk4 fictitious pm; # compute fictitious pm. tempP = numpy.dot(_MatPP, b1950P) ficV = numpy.dot(_MatVP, b1950P) # correct ICRS position for fk4 fictitious pm # (subtract over period fk4Date to J2000) period = 2000.0 - Tm.epJFromMJD (llv.epb2d (fk4Date)) return tempP - ficV * period