def topoFromGeoSimple(appGeoP, last, lat): """Converts apparent topocentric position to apparent geocentric. "Simple" because it only corrects for local sidereal time, ignoring diurnal parallax, diurnal aberration and pole wander. Inputs: - appGeoP(3) apparent geocentric cartesian position (RA/Dec) - last local apparent sidereal time (deg) - lat latitude (deg) Returns: - appTopoP(3) apparent topocentric cartesian position (az, alt), a numpy.array Note: unlike topoFromGeo, the position units need not be au; the output position will be the same units as the input position. Sign convention: increasing azAlt[x] is south-ish increasing azAlt[y] is east """ sinLAST = RO.MathUtil.sind (last) cosLAST = RO.MathUtil.cosd (last) # rotate position and offset to (-HA)/Dec (still cartesian, of course) posA = ( cosLAST * appGeoP(1) + sinLAST * appGeoP(2), - sinLAST * appGeoP(1) + cosLAST * appGeoP(2). appGeoP(3), ) return azAltFromHADec (posA, lat)
def topoFromGeo(appGeoP, last, obsData): """ Converts apparent geocentric coordinates to apparent topocentric coordinates (not corrected for refraction). Inputs: - appGeoP(3) current app. geocentric cartesian position (au) (RA/Dec) - last local apparent sidereal time, as an angle (deg) - obsData an ObserverData object Returns: - appTopo(3) apparent topocentric cartesian position (au) (az/alt), a numpy.array Details: The following approximation is used: - pole wander is ignored References: P.T. Wallace, "Proposals for Keck Tel. Pointing Algorithms", 1986 (unpub) """ sinLAST = RO.MathUtil.sind (last) cosLAST = RO.MathUtil.cosd (last) # rotate position and offset to (-ha)/Dec (still cartesian, of course) posA = numpy.array(( cosLAST * appGeoP[0] + sinLAST * appGeoP[1], -sinLAST * appGeoP[0] + cosLAST * appGeoP[1], appGeoP[2], )) # correct position for diurnal parallax posB = posA - obsData.p # correct position for diurnal aberration # follows Pat Wallace's AOPQK bDir, bMag = llv.vn(posB) diurAbScaleCorr = 1.0 - (obsData.diurAbVecMag * bDir[1]) posC = numpy.array (( posB[0] * diurAbScaleCorr, (posB[1] + (obsData.diurAbVecMag * bMag)) * diurAbScaleCorr, posB[2] * diurAbScaleCorr, )) # rotate position (posC) to alt/az; return azAltFromHADec (posC, obsData.latitude)
def topoFromGeo(appGeoP, last, obsData): """ Converts apparent geocentric coordinates to apparent topocentric coordinates (not corrected for refraction). Inputs: - appGeoP(3) current app. geocentric cartesian position (au) (RA/Dec) - last local apparent sidereal time, as an angle (deg) - obsData an ObserverData object Returns: - appTopo(3) apparent topocentric cartesian position (au) (az/alt), a numpy.array Details: The following approximation is used: - pole wander is ignored References: P.T. Wallace, "Proposals for Keck Tel. Pointing Algorithms", 1986 (unpub) """ sinLAST = RO.MathUtil.sind(last) cosLAST = RO.MathUtil.cosd(last) # rotate position and offset to (-ha)/Dec (still cartesian, of course) posA = numpy.array(( cosLAST * appGeoP[0] + sinLAST * appGeoP[1], -sinLAST * appGeoP[0] + cosLAST * appGeoP[1], appGeoP[2], )) # correct position for diurnal parallax posB = posA - obsData.p # correct position for diurnal aberration # follows Pat Wallace's AOPQK bDir, bMag = llv.vn(posB) diurAbScaleCorr = 1.0 - (obsData.diurAbVecMag * bDir[1]) posC = numpy.array(( posB[0] * diurAbScaleCorr, (posB[1] + (obsData.diurAbVecMag * bMag)) * diurAbScaleCorr, posB[2] * diurAbScaleCorr, )) # rotate position (posC) to alt/az; return azAltFromHADec(posC, obsData.latitude)