skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.41k stars 211 forks source link

Recommendations to supporting Swiss Ephemeris #246

Closed jsluyi closed 5 years ago

jsluyi commented 5 years ago

Skyfield is a great library with plentiful features, detailed instructions, and it's comfortable for use. The ephemeris provided by JPL is great - a lot of unimaginable work has been realized because of it. Maybe it's my wild wishes, I think the JPL ephemeris still has a fly in the ointment, because it is difficult to meet the requirements of small file size, high positional accuracy and long time span at the same time. Occasionally, I met the Swiss Ephemeris. After I know a little bit about it, I found that it not only met my demanding requirements for the Ephemeris, but also exceeded my expectations. The Swiss Ephemeris not only has the characteristics of small file size, high positional accuracy and long time span, but also the celestial body and time span can be flexibly tailored and expanded. In addition, the celestial body's offset and virtual stars can be customized to provide greater flexibility. The data of the Swiss Ephemeris is based on the JPL ephemeris, and the latest version is based on the de431 ephemeris. The advantages of the Swiss Ephemeris apis also include the ability to set altitude, increase the effects of atmospheric pressure and temperature on the celestial body's apparent position, and so on. But its apis and documentation are not very convenient to use, and the language is not based on Python. I think if Skyfield can read the data of Swiss Ephemeris, it will be a perfect combination. Skyfield will also have more flexible configurations and more powerful features, as well as a wider range of uses, which can benefit more.

Homepage to the Swiss Ephemeris:https://www.astro.com/horoscope Info to the Swiss Ephemeris:https://www.astro.com/swisseph/swephinfo_e.htm Manual to the Swiss Ephemeris:https://www.astro.com/swisseph/swisseph.htm Programming interface to the Swiss Ephemeris:https://www.astro.com/swisseph/swephprg.htm Download to the Swiss Ephemeris(ftp):ftp://ftp.astro.com/pub/swisseph/ Download to the Swiss Ephemeris(http):https://www.astro.com/ftp/swisseph/

ghost commented 5 years ago

My only concern with this would be the repeated use of the word "astrological". I'm guessing the positions are the same as "astronomical", but slightly worried they're not.

There are alternative ephemerides, but I'm not sure how interested Brandon would be in using them. VSOP 2013 is a major example: https://en.wikipedia.org/wiki/VSOP_(planets)#VSOP2013

brandon-rhodes commented 5 years ago

The jplephem Python tool that Skyfield uses already supports one kind of file size reduction: you can trim down an existing ephemeris to only the range of dates you need.

But you are asking about the other kind of reduction: where the time range is kept the same, but the precision is reduced and the error is increased in order to achieve a trade off in file size.

  1. Some users would simply turn to a smaller JPL ephemeris, like DE406 instead of DE422.
  2. It's possible that the trade-off could be made in a program that takes in a .bsp file and outputs another .bsp file whose polynomials have been trimmed or combined to be less precise but also take up less room in the file. Then Skyfield wouldn't need any new feature; just like jplephem can trim the date range of an ephemeris, there could be another tool that trims the precision of an ephemeris.
  3. As you suggest, if the Swiss Ephemeris has its own file format, then Skyfield might not be able to support it. What is the Swiss Ephemeris's licensing like? Are its users allowed to reverse-engineer its file format?

If you'll suggest what range of time you need predictions for, and how precise they need to be, and what kind of device you are going to be performing them on (which will establish the file size you have room for), then we can look for a solution that fits your situation. I think that is the right way to go about it; let's learn more about your situation and only bring in the Swiss Ephemeris if your criteria can't be satisfied using normal standard tools.

jsluyi commented 5 years ago

@barrycarter Thank you for your reply. For "astrological" and "astronomical", they may not be exactly the same. However, no matter which aspect is used, one thing is common: you need to determine the relationship between the coordinates of the celestial body and time. My hope is that I can meet the requirements of longer time span, higher precision, smaller file size, etc., which may be equally needed for "astronomical". I sometimes understand this: "astrological" is based on "astronomical". But I am not sure if I understand it correctly.

jsluyi commented 5 years ago

@brandon-rhodes Thank you for your reply. From your reply, I feel that you have insight into the root of the problem and provided helpful suggestions. I found the Swiss Ephemeris's license statement (see below). If it is not of sufficient value, may be it is the time to close this Issue?

The Swiss ephemeris's license statement is as follows: ''' Licensing

The Swiss Ephemeris is not a product for end users. It is a toolset for programmers to build into their astrological software.

Swiss Ephemeris is made available by its authors under a dual licensing system. The software developer, who uses any part of Swiss Ephemeris in his or her software, must choose between one of the two license models, which are

a) GNU public license version 2 or later

b) Swiss Ephemeris Professional License

The choice must be made before the software developer distributes software containing parts of Swiss Ephemeris to others, and before any public service using the developed software is activated.

If the developer choses the GNU GPL software license, he or she must fulfill the conditions of that license, which includes the obligation to place his or her whole software project under the GNU GPL or a compatible license. See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

If the developer choses the Swiss Ephemeris Professional license, he must follow the instructions as found in http://www.astro.com/swisseph/ and purchase the Swiss Ephemeris Professional Edition from Astrodienst and sign the corresponding license contract.

The Swiss Ephemeris Professional Edition can be purchased from Astrodienst for a one-time fixed fee for each commercial programming project. The license is just a legal document. All actual software and data are found in the public download area and are to be downloaded from there.

Professional license: The license fee for the first license is Swiss Francs (CHF) 750.-, and CHF 400.- for each additional license by the same licensee. An unlimited license is available for CHF 1550.-. '''

brandon-rhodes commented 5 years ago

If you can describe your project and its space and accuracy requirements, we could work from those to discover either an official ephemeris that would fulfill your requirements, or to talk about what kinds of data compression and reduction — with the Swiss Ephemeris as one option — might bring one of the official ephemerides down in size so that it met your requirements.

But without a description of the constraints that tempted you to consider a third-party reduction of a NASA ephemeris, we can't weigh the options, so for now I'm going to close the issue. Feel free to comment with specifics if you would ever like to, however!