3

I have difficulties with finding current coordinates (RA, DEC) for star in sky. In net I have found only this one tutorial, how to use ephem library: http://asimpleweblog.wordpress.com/2010/07/04/astrometry-in-python-with-pyephem/

As I understood I need to:

  1. create observer
telescope = ephem.Observer()
telescope.long =  ephem.degrees('10')
telescope.lat = ephem.degrees('60')
telescope.elevation = 200
  1. Create a body Object star here is trouble, I have only (RA,DEC) coordinates for star

  2. Calculate position by .calculate(now())

  3. by new coordinates find altitude

One more question about accuracy of this library, how accurate it is? I have compared juliandate and sidestreal time between this program and kstars, looks like quite similar.

and this http://www.jgiesen.de/astro/astroJS/siderealClock/

PS! Or may be some one can reccomend better library for this purposes.

madth3
  • 7,275
  • 12
  • 50
  • 74
ekitru
  • 172
  • 1
  • 5
  • 16
  • The documentation for pyEphem is useless when it comes to creating your own bodies. I have done it before, so if I can find the code I'll post an answer. – samb8s Jul 29 '11 at 09:42
  • it will be good, because currently I do not understand hwo it works. I have found how to get current julian day and current sidereal time, I create new observer, but I can't get recalculated coobdinates for stars. for verifing I use stars program, just compare julian day and sidereal time – ekitru Jul 30 '11 at 15:58

2 Answers2

6

I guess you're looking for FixedBody?

telescope = ephem.Observer()
telescope.long =  ephem.degrees('10')
telescope.lat = ephem.degrees('60')
telescope.elevation = 200
star = ephem.FixedBody()
star._ra = 123.123
star._dec = 45.45
star.compute(telescope)
print star.alt, star.az

I don't know about the accuracy; pyephem uses the same code as xephem, and eg the positions of the planets are given by rounded-down VSOP87 solutions (accuracy better than 1 arcsecond); kstars appears to use the full VSOP solution.
But this will really depend on your need; eg don't rely on it blindly guiding your telescope, there are better solutions for that.

  • Thanks, I think it what I need. Why I should not rely on it? Can it be wrong some times? or you means stars can be invisible some times? – ekitru Jul 29 '11 at 12:49
  • No, in the specific example case of guiding a telescope, you'll want subarcsecond precision. Good guiding software actually uses the locally (x, y on the camera) calculated star centres and can handle those small corrections. This is necessary for long exposures. For a combined series of short exposures, the precision would probably be okay, as well as for generally pointing a telescope. As mentioned, depends on your needs. –  Jul 29 '11 at 15:53
  • If you need to track object position for this observer continuously, you should update observer time. For example in separate thread or before each reading. telescope.date = ephem.now() – ekitru Aug 14 '11 at 21:26
  • I've suggested a change, considering this is one of the few places where you find an usage example of FixedBody I find it important. Change is, _ra and _dec must be declared outside FixedBody(). what you put inside those parenthesis has no effect. – JunCTionS Sep 20 '12 at 05:39
  • Thanks. Hadn't realised that (hadn't noticed Ekitru's answer). Would've been nice it PyEphem allowed initialization in the constructor; now I'm setting private variables, which is a bad idea. –  Sep 20 '12 at 12:20
3
star = ephem.FixedBody(ra=123.123, dec=45.45)

in my case fixedbody creation does not work, should be

star = ephem.FixedBody()
star._ra = ephem.hours('10:10:10')
star._dec = ephem.degrees('10:10:10')
ekitru
  • 172
  • 1
  • 5
  • 16