1

I just start learning astronomy.

I use pyephem to understand different coordinate systems such as geocentric equtorial, geocentric ecliptic, heliocentric ecliptic.

In phephem, planet body such as mars has attributes (ra,dec) in geocentric equtorial, (hlon, hlat) in heliocentric ecliptic. I try to check the consistency between them.

My method(scripts attached below) is as follows:

  1. define function earthtilt to get earth axis tilt
  2. define functions radec2cart and cart2radec to perform coordinate transform between spherical coordinates and cartesian coordinates.
  3. define function R_x to get rotation matrix.
  4. get geocentric equtorial coordinates of sun/mars using (ra,dec) attributes.
  5. use R_x and earthtilt to rotate geocentric equtorial coordinates to geocentric ecliptic coordinates
  6. (heliocentric ecliptic cartesian coordinates of mars)= (geocentric ecliptic coordinates of mars) - (geocentric ecliptic coordinates of sun)
  7. change above heliocentric cartesian ecliptic coordinates of mars to heliocentric spherical ecliptic coordinates of mars.
  8. compare above heliocentric spherical ecliptic coordinates of mars with mars attributes hlon and hlat.
  9. I got : difference between ecliptic longitude is about 16.9". difference between ecliptic latitude is about 9.2". Such a defference is a little too large.
  10. Is my computation/concept wrong or ...?

    ===================
    import ephem
    import numpy as np
    import math

    def R_x(theta):
      return np.array([[1,0,0],[0,math.cos(theta),math.sin(theta)],[0,-math.sin(theta),math.cos(theta)]])

    def radec2cart(rho,ra,dec):
      return np.array([rho*math.cos(dec)*math.cos(ra),rho*math.cos(dec)*math.sin(ra),rho*math.sin(dec)])

    def cart2radec(X):
      r=math.sqrt(X[0]*X[0]+X[1]*X[1])
      ra=ephem.hours(math.atan2(X[1],X[0])).norm
      dec=ephem.degrees(math.atan2(X[2],r))
      rho=math.sqrt(X[0]*X[0]+X[1]*X[1]+X[2]*X[2])
      return (rho,ra,dec)

    def earthtilt(date):
      pos=ephem.Ecliptic('90','0',epoch=date)
      return pos.to_radec()[1]

    def verifyhlonhlat(star,date):
      star.compute(date)
      sun=ephem.Sun(date)
      starx=radec2cart(star.earth_distance,star.g_ra,star.g_dec)
      eps=earthtilt(date)
      starx=R_x(eps).dot(starx)
      sunx=radec2cart(sun.earth_distance,sun.g_ra,sun.g_dec)
      sunx=R_x(eps).dot(sunx)
      starx=starx-sunx
      distance,hlon,hlat=cart2radec(starx)
      hlon=ephem.degrees(hlon)
      print([distance-star.sun_distance,ephem.degrees(hlon-star.hlon),ephem.degrees(hlat-star.hlat)])

    verifyhlonhlat(ephem.Mars(),ephem.Date('2016/6/7'))
    ===========
    >>> verifyhlonhlat(ephem.Mars(),ephem.Date('2016/6/7'))
    [1.3654961393161358e-05, -0:00:16.9, 0:00:09.2]
    
hjyanghj
  • 306
  • 1
  • 2
  • 10

1 Answers1

1

The error is at: 6. (heliocentric ecliptic cartesian coordinates of mars)= (geocentric ecliptic coordinates of mars) - (geocentric ecliptic coordinates of sun)

The reason is as follows: When we see a planet/star, we look at where planet/star WAS, not where planet/star IS. The difference in time is for light travel from planet/star to earth.

hjyanghj
  • 306
  • 1
  • 2
  • 10