且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python PyEphem方位角和高度的计算

更新时间:2023-02-09 19:47:15

PyEphem底层的C库没有任何方法可以关闭偏斜,像差或章动现象-也许是因为Nature不允许我们也关闭这些效果,但我不确定!我会注意到,它不会对绕地球运行的卫星进行这些计算,但是我想不出一种简单的方法来将卫星放置在精确的RA并下降到高于您的位置的位置,以便您可以向PyEphem询问它的位置.

The C library underlying PyEphem does not have any way to turn off deflection, aberration, or nutation — maybe because Nature does not let us turn those effects off either, but I am not sure! It does not, I will note, do those calculations for an earth-orbiting satellite, but I can't think of an easy way for you to put a satellite at an exact RA and dec above your position so that you can ask PyEphem about its location.

我实际上本周在DjangoCon上度过了关于API的话题,并思考有一天PyEphem如何使它的内部工作更易于从Python访问,而不是将所有这些有趣的步骤都锁定在C代码内部.但是,在我准备好替代方法之前,完成所需操作的唯一方法是打开源文件circum.c并注释掉以下几行:

I am actually spending this week at DjangoCon going to talks about APIs, and thinking about how PyEphem might someday make its inner workings easier to access from Python, instead of leaving all of these interesting steps locked inside of the C code. But, until I have an alternative ready, the only way to accomplish what you want would be to open the source file circum.c and comment out these lines:

/* allow for relativistic light bending near the sun */
deflect (mjed, lam, bet, lsn, rsn, 1e10, &ra, &dec);

/* TODO: correction for annual parallax would go here */

/* correct EOD equatoreal for nutation/aberation to form apparent 
 * geocentric
 */
nut_eq(mjed, &ra, &dec);
ab_eq(mjed, lsn, &ra, &dec);

如果注释掉了从第263行开始的这三个调用-deflect()nut_eq()ab_eq(),那么您可能会得到一个与本文产生的答案更接近的答案.您可以通过以下方式应用这些更改:

If those three calls — deflect(), nut_eq(), and ab_eq() starting at line 263 — are commented out, then you might get an answer much closer to the one produced in this article. You would apply these changes by:

  • 下载PyEphem的.tar.gz.
  • 提取存档以生成文件.
  • 进行我上面建议的编辑.
  • 运行python setup.py install以安装您的自定义版本的软件.
  • 尝试一下!
  • Downloading the .tar.gz for PyEphem.
  • Extract the archive to produce files.
  • Make the edit that I suggest above.
  • Run python setup.py install to install your custom version of the software.
  • Try it out!

如果进动在某种程度上起作用,则可能会遇到另一个障碍-在这种情况下,您可能需要将star对象的时期完全设置为'1998/8/10 23:10:00'-但尝试先关闭三个光效果调用看看是否可以拉近你!

There might be another obstacle, if precession is somehow coming into play — you might need to set the epoch of your star object to exactly '1998/8/10 23:10:00' in that case — but try turning off the three light-effect calls first and see if that gets you closer!