flatangle / flatlib Goto Github PK
View Code? Open in Web Editor NEWPython library for Traditional Astrology
License: MIT License
Python library for Traditional Astrology
License: MIT License
how do i know the longitude and latidue current positions?
Great tool but Midpoint calculations are essential. If it already exists how does one access it?
hi,
thanks for sharing a lib.
just want to ask (and suggest addition to Q&A) if flatlib calculations include timezone (olson db, iana) calculations?
godspeed,
simon
s love nia
Is there a way to get aspects a like Trine, Conjunction, Square ... between two planets beyond getAspects()?
Should this library be moving towards a more pep8-friendly naming convention?
For example, rename (flatlib.ephem.swe.
)lunarEclipseGlobal
to lunar_eclipse_global
, and add lunarEclipseGlobal = lunar_eclipse_global
for backwards compatibility.
(Note: probably also rename this function to global_lunar_eclipse
for a more grammatically correct name, or move it under .swe.eclipse.lunar(global=True)
or similar)
Also, this library would heavily benefit from type annotations (example: def norm(angle: int) -> int:
) which provide duck-type hints for IDEs and other typechecking tools, and reduces potential bugs.
It would be nice to have a options to choose heliocentric and geocentric
How to apply various ayanamsa?
For Example : <Sun Capricorn +17:31:21 +01:01:10> is as per the existing code, however applying the Ayanamsa it should be Sun in Sagittarius 23 Deg, 58',21''
is this possible?
How i can get Pluto, Uranus, Neptune characteristics? There aren't in chart.objects. if i do a foreach the result is something like this:
<Sun Cancer +14:20:30 +00:57:13> <Moon Virgo +10:57:02 +11:55:50> <Mercury Gemini +23:38:43 +01:18:18> <Venus Leo +23:04:06 +01:09:29> <Mars Taurus +28:25:18 +00:42:32> <Jupiter Pisces +12:39:22 -00:00:53> <Saturn Aquarius +09:49:07 -00:03:47> <North Node Leo +10:06:52 -00:03:11> <South Node Aquarius +10:06:52 -00:03:11> <Syzygy Cancer +09:38:10 +13:04:03> <Pars Fortuna Capricorn +09:40:49 +00:00:00>
date = Datetime('1986/01/30', '00:20', '+00:00')
pos = GeoPos('105e51', '21n02')
chart = Chart(date, pos)
sun = chart.get(const.SUN)
print(sun)
And I got error below:
Traceback (most recent call last):
File "test.py", line 8, in <module>
chart = Chart(date, pos)
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/chart.py", line 53, in __init__
self.objects = ephem.getObjectList(IDs, date, pos)
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/ephem/ephem.py", line 35, in getObjectList
objList = [getObject(ID, date, pos) for ID in IDs]
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/ephem/ephem.py", line 35, in <listcomp>
objList = [getObject(ID, date, pos) for ID in IDs]
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/ephem/ephem.py", line 30, in getObject
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/ephem/eph.py", line 35, in getObject
pflon = tools.pfLon(jd, lat, lon)
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/ephem/tools.py", line 33, in pfLon
if isDiurnal(jd, lat, lon):
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/ephem/tools.py", line 51, in isDiurnal
return utils.isAboveHorizon(ra, decl, mcRA, lat)
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/utils.py", line 39, in isAboveHorizon
dArc, _ = dnarcs(decl, lat)
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/utils.py", line 23, in dnarcs
dArc = 180 + 2 * ascdiff(decl, lat)
File "/home/minhtl3/chiemtinh/chiemtinh/flatlib/utils.py", line 18, in ascdiff
ad = math.asin(math.tan(delta) * math.tan(phi))
ValueError: math domain error
Do you guys have any ideas?
Thanks,
using:
'
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.chart import Chartdate = Datetime('2020/03/11', '23:10', '+01:00')
pos = GeoPos('46n03', '14e31') # ljubljana, slo, eu
chart = Chart(date, pos)
Traceback (most recent call last):
File "", line 1, in
File "A:\venv_pyswisseph\flatlib\chart.py", line 53, in init
self.objects = ephem.getObjectList(IDs, date, pos)
File "A:\venv_pyswisseph\flatlib\ephem\ephem.py", line 35, in getObjectList
objList = [getObject(ID, date, pos) for ID in IDs]
File "A:\venv_pyswisseph\flatlib\ephem\ephem.py", line 35, in
objList = [getObject(ID, date, pos) for ID in IDs]
File "A:\venv_pyswisseph\flatlib\ephem\ephem.py", line 30, in getObject
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
File "A:\venv_pyswisseph\flatlib\ephem\eph.py", line 48, in getObject
obj = swe.sweObject(ID, jd)
File "A:\venv_pyswisseph\flatlib\ephem\swe.py", line 71, in sweObject
'lonspeed': sweList[3],
IndexError: tuple index out of range
'
s love nia
Is there a way to get aspects like angles, degrees that involve two or more planets, for example, opposition angle 180°, square angle 90°, trigone of angle 120° and conjunction?
Update the currently 5 year old(!) documentation with reference documentation; documentation that shows the internals of the library in a readable way for everyone to see and reference from.
Example of such documentation: discord.py
Extra; Move scripts/examples/receipes to documentation website.
Extra; Remove (practically useless and redundant) tutorial on python itself. (Reasoning; the documentation needs to be library-specific, if anyone came here and didn't knew python, this library should not teach them, only provide a link to such a tutorial)
Does the efemeris used by this lib have the Lilith position? I looked for both Lilith or something like Moon Apogee among the constants but couldn't find it.
We can create a chart using any house system, but it seems that solar return will always return chart using default house system, which is incorrect.
Maybe solar return should use self.hsys and self.IDs when creating solar return chart?
It would be nice to get Flatlib as a Django application
Creating library build\temp.win-amd64-3.7\Release\swisseph.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\swisseph.cp37-win_amd64.exp
ERROR: Failed building wheel for pyswisseph
Can not install "pyswisseph==2.00.00-2" in win10, only can install pyswisseph 2.8.0.post1,
but there are errors:
File "D:\WebDjango\mysite\mysite\astrologychart\views.py", line 54, in calculate_astrology
chart = Chart(date, pos, IDs=[const.SUN, const.MOON, const.MERCURY, const.VENUS, const.MARS, const.JUPITER, const.SATURN, const.URANUS, const.NEPTUNE, const.PLUTO, const.CHI
RON, const.NORTH_NODE, const.SOUTH_NODE ])
File "D:\DjangoWebSite\DjangoWebSite\mysite\envmysite\lib\site-packages\flatlib-0.2.2.dev0-py3.7.egg\flatlib\chart.py", line 53, in init
self.objects = ephem.getObjectList(IDs, date, pos)
File "D:\DjangoWebSite\DjangoWebSite\mysite\envmysite\lib\site-packages\flatlib-0.2.2.dev0-py3.7.egg\flatlib\ephem\ephem.py", line 35, in getObjectList
objList = [getObject(ID, date, pos) for ID in IDs]
File "D:\DjangoWebSite\DjangoWebSite\mysite\envmysite\lib\site-packages\flatlib-0.2.2.dev0-py3.7.egg\flatlib\ephem\ephem.py", line 35, in
objList = [getObject(ID, date, pos) for ID in IDs]
File "D:\DjangoWebSite\DjangoWebSite\mysite\envmysite\lib\site-packages\flatlib-0.2.2.dev0-py3.7.egg\flatlib\ephem\ephem.py", line 30, in getObject
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
File "D:\DjangoWebSite\DjangoWebSite\mysite\envmysite\lib\site-packages\flatlib-0.2.2.dev0-py3.7.egg\flatlib\ephem\eph.py", line 48, in getObject
obj = swe.sweObject(ID, jd)
File "D:\DjangoWebSite\DjangoWebSite\mysite\envmysite\lib\site-packages\flatlib-0.2.2.dev0-py3.7.egg\flatlib\ephem\swe.py", line 71, in sweObject
'lonspeed': sweList[3],
IndexError: tuple index out of range
So can flatlib support pyswisseph 2.8.0.post1?
Hello,
If i try chart.get(const.SUN) it works fine, but if i try consts.NEPTUNE (uran, pluto), it throws me error:
from flatlib import const
from flatlib.chart import Chart
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
date = Datetime('1991/01/01', '10:00', '+02:00')
pos = GeoPos('40n50', '03e62')
chart = Chart(date, pos)
print(chart.get(const.NEPTUNE).num())
Traceback (most recent call last):
File "/home/milan/PycharmProjects/elboh_astro/venv/test.py", line 9, in <module>
print(chart.get(const.NEPTUNE).num())
File "/home/milan/.local/lib/python3.5/site-packages/flatlib/chart.py", line 92, in get
return self.getObject(ID)
File "/home/milan/.local/lib/python3.5/site-packages/flatlib/chart.py", line 72, in getObject
return self.objects.get(ID)
File "/home/milan/.local/lib/python3.5/site-packages/flatlib/lists.py", line 44, in get
return self.content[ID]
KeyError: 'Neptune'
Process finished with exit code 1
Please try it and tell me if its error on my side or You can reproduce it. I don't see error in git or swiss ephemeris library constants, but on my side also not.
thanks :o)
For predictive astrology it would be super useful to have both Secondary progression or 'a-day-for-a-year' progression and Solar arc progression or 'a-degree-for-a-year' progression.
sun = chart.get(const.SUN)
print(sun)
<Sun Pisces +22:47:25 +00:59:51>
In the above output, can i split and take Sun Pisces +22:47:25 +00:59:51 seperately? i am not able to do that as it does not have split method, any help?
When I am trying to import from flatlib.chart import chart the following below error is coming.
ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 from flatlib.chart import chart
I installed flatlib using the new link provided recently.
I used this code to start to play around
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.chart import Chart
date = Datetime('2018/04/18', '17:00', '+00:00')
pos = GeoPos('38n32', '8w54')
chart = Chart(date, pos)
moon = chart.get(const.MOON)
print(moon)
got this error.
NameError Traceback (most recent call last)
in
5 pos = GeoPos('38n32', '8w54')
6 chart = Chart(date, pos)
----> 7 moon = chart.get(const.MOON)
8 print(moon)
NameError: name 'const' is not defined
Will appreciate any help here.
olo,
thx for sharing this lib, useful, though limited (to west. trad. astro.).
quote from swisseph (ch) docs:
"For new projects, we recommend using the new functions swe_fixstar2_ut() and swe_fixstar2(). Performance will be a lot better if a great number of fixed star calculations are done. "
with swisseph 2.07, new fixstar functions were added.
another quote :
"The fixed stars functions only work if the fixed stars data file sefstars.txt is found in the ephemeris path. If the file sefstars.txt is not found, the old file fixstars.cat is searched and used instead, if present. However, it is strongly recommended to not use the old file anymore. The data in the file are outdated, and the algorithms are also not as accurate as those used with the file sefstars.txt. "
regarding this, comparing flatlib/const.py and sefstars.txt (recommended above), to use sefstars.txt, constants in const.py should be updated (i believe, if they are used to search fixstars.cat file):
STAR_ZUBEN_ESCHAMALI = 'Zuben Eschamali'
STAR_RIGEL_KENTAURUS = 'Rigel Kentaurus'
so, sefstars.txt could be added to flatlib/resources/swefiles folder.
not sure if implementing (or completely substituting old) new swe_fixstar2() and swe_fixstar2_ut() makes any sense for this library.
pyswisseph has been updated to 2.08, recently.
s love nia
hello,
I found a free and open-source JavaScript library generating SVG charts to display planets in astrology. It's in GitHub, which can draw astrology chart wheel。
This js lib need input data in follow:
var data = {
"planets":{"Lilith":[18], "Chiron":[18], "Pluto":[63], "Neptune":[110, 0.2], "Uranus":[318], "Saturn":[201, -0.2], "Jupiter":[192], "Mars":[210], "Moon":[268], "Sun":[281], "Mercury":[312], "Venus":[330], "NNode":[2]},
"cusps":[296, 350, 30, 56, 75, 94, 116, 170, 210, 236, 255, 274]
};
So how can i change such as :
<Sun Pisces +12:23:23 +01:00:11>
<Moon Taurus +06:45:04 +14:17:44>
<Mercury Pisces +08:41:45 +01:50:28>
<Venus Aries +13:05:45 +00:03:51>
<Mars Aries +24:45:31 +00:43:39>
<Jupiter Libra +22:12:31 -00:04:27>
<Saturn Sagittarius +26:49:41 +00:03:18>
<North Node Virgo +03:00:25 -00:03:11>
<South Node Pisces +03:00:25 -00:03:11>
<Syzygy Pisces +08:12:07 +13:36:06>
<Pars Fortuna Libra +28:49:54 +00:00:00>
to the js lib example data format ?
Thank you。
Say please, why when using trans saturn constants, as const.PLUTO, const.URANUS, const.NEPTUNE, and trying get longitued, appearing KeyError exception ?
I have installed pyswisseph 2.05.01 (latest).
Using flatlib input:
date = Datetime('2018/08/14', '12:00', '+01:00')
pos = GeoPos('46n30', '16e14') # Globoka, Slovenia, EU
chart = Chart(date, pos, hsys='Equal')
I get output:
<House1 Scorpio +10:12:25 30.0>
<House2 Sagittarius +10:12:25 30.00000000000003>
<House3 Capricorn +10:12:25 30.0>
<House4 Aquarius +10:12:25 30.0>
<House5 Pisces +10:12:25 30.0>
<House6 Aries +10:12:25 30.0>
<House7 Taurus +10:12:25 30.0>
<House8 Gemini +10:12:25 30.0>
<House9 Cancer +10:12:25 30.0>
<House10 Leo +10:12:25 30.0>
<House11 Virgo +10:12:25 30.0>
<House12 Libra +10:12:25 29.99999999999997>
While error is nano size, it is still an erroneous output. Houses 2 & 12 are wrong size.
Simon
S love nia
It would be nice to have Lilith on a chart
Hello,
I've been looking for a library as flatlib for months and I'm really enjoying the way you've done it ! Very impressive ! I've done some tests and found that you're using (to me) the tropical system. I would like to use the sidereal Lahiri ones. I would like to know if you can setup this kind of parameter in flatlib ?
Many thanks for your works !
date = Datetime('2018/08/14', '12:30', '+01:00')
print date
output is <2018/08/14 12:00:00 +01:00:00>
instead of <2018/08/14 12:30:00 +01:00:00>
code snippet
chart = Chart(date, pos, hsys=const.HOUSES_WHOLE_SIGN,IDs=const.LIST_OBJECTS)
sun = chart.getObject(const.SUN)
print(sun.sign)
print(sun.signlon)
essential.setTerms('LILLY_TERMS')
print(essential.TERMS)
print(essential.term(sun.sign, sun.signlon))
This is what I've been trying in order to use the lilly terms for the functions that come after it. I do not get any errors, but when it prints the terms table, it is still using the default egyptian terms. What's the proper way to set it to the other table of terms? Do I need to create some sort of object?
Thanks
System: Mac OS. Python 3.7
Installation via: pip3 install git+https://github.com/flatangle/flatlib
Pyswisseph version: 2.00.00-2
Error come when using example code from description.
/usr/local/lib/python3.7/site-packages/flatlib/ephem/swe.py in sweObject(obj, jd)
69 'lon': sweList[0],
70 'lat': sweList[1],
---> 71 'lonspeed': sweList[3],
72 'latspeed': sweList[4]
73 }
IndexError: tuple index out of range
Hi, is there a way to calculate true_Node values ? I have seen the closed issue that you need to change the library file, but it doesn't work for me. I have changed the file as described here: " But if you change the dictionary value for the north node const in ephem/swe.py from 10 to 11, it will give you true north and south nodes instead of mean nodes." I am using Pycharm and it doesn't work. Anything else to do than to change the file ? Thanks !
Hello,
This library has swiss ephemeris DB in it? if so how can i access it
Using flatlib input:
date = Datetime('1990/06/11', '07:31', '-05:00')
pos = GeoPos('71N17', '157w47')
chart = Chart(date, pos, hsys='Whole Sign', IDs=const.LIST_OBJECTS)
mars = chart.get(const.MARS)
marshouse = chart.houses.getObjectHouse(mars)
print(marshouse)
I get output:
"Error: function terminated. Recommended action: inspect logs for termination reason. Details:
math domain error"
Date 1990/07/11 has the same result, but 1990/05/11 or 1990/08/11 produced the expected output. Any ideas?
ty!
Whole Sign example:
Using flatlib input:
date = Datetime('2000/09/12', '12:58', '-07:00')
pos = GeoPos('34N1', '118W29')
chart = Chart(date, pos, hsys='Whole Sign', IDs=const.LIST_OBJECTS)
mars = chart.get(const.MARS)
marshouse = chart.houses.getObjectHouse(mars)
print(marshouse)
parsfortuna = chart.get(const.PARS_FORTUNA)
parsfortunahouse = chart.houses.getObjectHouse(parsfortuna)
print(parsfortuna)
I get output:
"<House10 Virgo +00:00:00 30.0>"
"<House7 Gemini +00:00:00 30.0>"
output should be:
"<House9 Leo +00:00:00 30.0>"
"<House6 Taurus +00:00:00 30.0>"
Placidus example:
Using flatlib input:
date = Datetime('2000/09/12', '12:58', '-07:00')
pos = GeoPos('34N1', '118W29')
chart = Chart(date, pos, hsys='Placidus', IDs=const.LIST_OBJECTS)
sun = chart.get(const.SUN)
sunhouse = chart.houses.getObjectHouse(sun)
print(sunhouse)
I get output:
"<House10 Virgo +22:31:49 30.30419713684546>"
output should be:
"<House9 Leo +17:02:16 35.49254778736878>"
TypeError: super() takes at least 1 argument (0 given)
Running windows 10, python 3.7.2. Getting an error saying I need visual c++ 14. Went through the whole install and rebooted, still same problem. I think it might be coming from the ephemeris package but idk.
Approximately 1/3 of my attempts results in this Math Domain Error:
/opt/conda/lib/python3.6/site-packages/flatlib/utils.py in ascdiff(decl, lat)
16 delta = math.radians(decl)
17 phi = math.radians(lat)
---> 18 ad = math.asin(math.tan(delta) * math.tan(phi))
19 return math.degrees(ad)ValueError: math domain error
For example, when I try with this parameters:
date = Datetime('1913/02/18', '22:15','+01:00')
pos = GeoPos('51n2149', '7e2754 ')
chart = Chart(date, pos)
Thanks in advance.
It's a really great lib and is helping me a lot!! 🥇
First of all, thank you João for making this an open source project.
Sorry if I miss something. Is there a way of finding a date and time of an astrological event such as exact aspects or sign ingress?
Many thanks,
Mark
In windows 7 whether in Spyder or cmd when I run Chart I get the following errors
chart = Chart(date, pos)
Traceback (most recent call last):
File "", line 1, in
chart = Chart(date, pos)
File "C:\ProgramData\Anaconda3\lib\site-packages\flatlib\chart.py", line 53, in init
self.objects = ephem.getObjectList(IDs, date, pos)
File "C:\ProgramData\Anaconda3\lib\site-packages\flatlib\ephem\ephem.py", line 34, in getObjectList
objList = [getObject(ID, date, pos) for ID in IDs]
File "C:\ProgramData\Anaconda3\lib\site-packages\flatlib\ephem\ephem.py", line 34, in
objList = [getObject(ID, date, pos) for ID in IDs]
File "C:\ProgramData\Anaconda3\lib\site-packages\flatlib\ephem\ephem.py", line 29, in getObject
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
File "C:\ProgramData\Anaconda3\lib\site-packages\flatlib\ephem\eph.py", line 48, in getObject
obj = swe.sweObject(ID, jd)
File "C:\ProgramData\Anaconda3\lib\site-packages\flatlib\ephem\swe.py", line 71, in sweObject
'lonspeed': sweList[3],
IndexError: tuple index out of range
Any suggestion to solve the problem?
Hello,
Is there a way to output the results into a graphical chart such as a jpeg, gif or other graphical format? If not do you have a suggestion on how to take the output and put it into a graphical chart?
--Jim
Does this library rely on some external code. I had a program that previously worked and now when I try to calculate what house an object is in, it comes out incorrect. Asc and other angles are all correctly calculated, as are the objects. But for example I have a chart with pluto and jupiter in leo, and an asc at 15 virgo. No matter what I try, when I use the command for getting the objects in the first house, pluto and jupiter show up (in both placidus and whole sign). It's not limited to the first house tho.
I've checked my code over and over and it seems there's something internal going wrong with the library and how it's spitting out objects in a house. In whole sign OR placidus there should be no way to have a virgo asc and have two objects in leo report being in first...
I suppose ayanamsa is not used .
What the values I should get for 1967/07/28 is at 1967/07/04
In Traditional Astrology , there are 5 important minor planets. They are Chiron, Juno, Pallas, Ceres and Vesta.
Juno is the zodiac sign of marriage and commitment.
Pallas is the zodiac sign of brain functions.
Ceres is the zodiac sign of depth of love that sits within all of us.
But i didn't found Juno, Pallas, Ceres, Vesta in flatlib.
So its better to perfect the other four minor planets.
Thank you!
Is using the true node instead of the mean node an option in this library? I can't seem to find it as a setting. Thanks!
Hi,
This module is great, it will be better to draw a astrology chart wheel.
I got ValueError: invalid literal for int() when used float type.
pos = GeoPos('-7.2', '112.8')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.