Swiss Ephemeris

Deborah Swanson python at deborahswanson.net
Sun Apr 9 21:52:31 EDT 2017


Peter Henry wrote, on Sunday, April 09, 2017 10:53 AM
> 
> I have a package that has been altered to imported in to 
> python, however I tired to get is working but without success 
> I be missing something obvious
> 
> The Swiss Ephemeris enable planetary coordinate  to be 
> imported and used in your program
> 
> Files access https://pypi.python.org/pypi/pyswisseph
> 
> Many thanks in advance 
> 
> Peter 

I've also worked on the problem of getting sweph into Python and have
mostly struck out so far myself.

I found one reliable means to get sweph's planetary data into Python,
but it's more or less a cheat. Nonetheless, if you want to see how much
good it does you, try the Swiss Ephemeris Test Page at
http://www.astro.com/swisseph/swetest.htm. If you can successfully
formulate a query useful to your purposes, you can download a csv of
results, read it into Python, and work from there. Right now I'm working
on converting some Excel spreadsheets and Excel VBA I use into Python
and recoding it all, using the CSVs for jumping off points. That works
pretty well, except the times from swetest are off a bit and I haven't
figured out why. But I'm concentrating on getting all my VBA code ported
to Python, and will go back to getting bang on data from sweph after I
have my code done.

The first thing I tried was to get sweph's C source code into a free
IDE, but that whole project went down in flames. You can read bits and
pieces of that misadventure at the tail end of the "Python application
launcher (for Python code)" thread. I found sweph's C source code at
some link off "Programming interface to the Swiss Ephemeris" at
http://www.astro.com/swisseph/swephprg.htm (or maybe it was on
http://www.astro.com/swisseph/swephinfo_e.htm - I can't easily find it
now, but the download link is in one of those two pages somewhere.) 

Then I tried picking through sweph's C source code, attempting to
manually reproduce the logic and the calculations in Python. That was a
highly qualified semi-success because the times were still off, but it
essentially produces the most basic planetary data. The swetest output
CSVs were more complete however, and easy to read the planetary data
into Python from, so I'd pretty much abandoned efforts to "translate"
the C source code. And now, all my efforts to leverage the C source
code. Even if successful it would be a lot more time sunk into working
with a language other than Python, which I likely wouldn't have a use
for after this project is completed.

However, I have seen bits here and there on this list that are at least
interesting. Tim Chase mentioned in passing that he encapsulated C
source code in a class, which may bear looking into. Lutz Horn also gave
a link for building a Python module to add a C language library to
Python, which also might be worth checking out:
https://docs.python.org/3/extending/index.html (I changed the 2 to a 3
from the link he gave, but you can change it back to 2 if your working
in a build of Python 2.) 

But many thanks for your pypi link to pyswisseph, which I will check
out. I can reply to this thread after I give it a shot and tell you what
I think of it. But like I said earlier, that won't be until all my Excel
VBA code, which jumps off from the sweph bare planetary data, is ported
to Python and working. Could be awhile yet. And if pyswisseph doesn't
pan out, I'll likely work on refining the two methods I have for
producing the planetary data, both of which are only lacking precisely
accurate time data in my local time, and both are off by only 5-30
minutes. I easily limped along for years with my Excel spread sheets
using the swetest CSVs for input, even though my times then were more
than a day off.

Good luck! (and this venture is a goodly portion of luck...)

Deborah

PS. I've been using medical astrology to look ahead at my medical
condition for years in advance. And being off by a day or so doesn't
matter that much when you're looking at trends over the course of years
and decades. I also have a little software widget to look at the
planetary data in graphical chart form at any particular second, also
based on sweph, which has been quite astoundingly accurate in following
the rather complex kaleidoscope of my symptoms during the course of a
day. (Though it doesn't do you a bit of good if you forget to look!
Which is my entire motivation to get it encoded and available with a few
clicks.) And it is quite useful to know in advance what will be
happening when, and most importantly when it will stop. Knowledge is
power!

Caveat. This kind of precision and accuracy is only found in the
specific forms of astrology which relate to pure physical phenomena, and
most of what you see these days masquerading as astrology is pure hooey,
almost entirely invented on  a large scale in the Middle Ages and
flowered in the Renaissance. By pure physical phenomena, which is the
only phenomena that is at least debatably influenced by physical
planetary forces, I mean things like the moon's tides, sunspots, plant
and animal activity throughout the year, and supremely, the inner
workings of the human body, the first wholly Western medicine devised by
the ancient Greeks. (The ancient Greek physicians are an excellent
fallback if modern medicine is failing you - if you can find enough that
remains today of their art.)




More information about the Python-list mailing list