flatlib - open source computer library

1
Hi there,

something that disappoints me a lot in today's astrology software is that it is very difficult or even impossible to perform any kind of statistical research. For example, any statistically valid study requires a relatively large set of charts, something that is virtually impossible to be done one by one.

Moreover, most of the software is geared to modern astrology. These softwares tend to wrongly implement traditional techniques, causing at least misinterpretation. In most cases, traditional techniques are not implemented at all.

That's why I decided to open-source the most important part of the work I have been doing lately, which I've named flatlib.

Flatlib is an open-source computer library for Traditional Astrology. It is implemented in the Python 3 programming language, which makes it really friendly for developers and non-developers. The Python language is considered one of the most simple and user friendly modern programming languages.

Computing a chart in flatlib is as simple as:

>>> date = Datetime('2015/03/13', '17:00', '+00:00')
>>> pos = GeoPos('38n32', '8w54')
>>> chart = Chart(date, pos)

You can get planets, houses, angles and fixed stars from the chart, and access their properties.

>>> sun = chart.get(const.SUN)
>>> print(sun)
Sun Pisces +19:40:13 +00:59:57
>>> print(sun.element())
Fire

You can also get aspects between planets, or planets and other objects:

>>> sun = chart.get(const.SUN)
>>> moon = chart.get(const.MOON)
>>> aspect = aspects.getAspect(sun, moon, const.MAJOR_ASPECTS)
Moon Sun 90 Applicative +00:24:30

Future versions will also include essential and accidental dignities, primary directions, profections, planetary days and hours, solar returns, and a lot more.


Jo?o Ventura
Last edited by jventura on Sun May 08, 2016 9:02 am, edited 4 times in total.

2
Some answers to possible questions:

Can everyone use it? Flatlib is open-source software so everyone is free to install and use it. However, since it is a programming library, some people may not be particularly inclined to use it since it requires some learning.

So is it not a end-user tool? Flatlib should really be seen as a traditional astrology software without a graphical user interface. Therefore, it is really powerful, since users can experiment without the "chains" of a graphical user interface.

How can I install it? Documentation is still scarce, but I hope to improve it in the future. You should install the latest Python 3 (3.4) and grab the flatlib package with pip3 install flatlib. This will install flatlib and its dependencies.

Is there a project page? You can check the code and simple documentation in the github page at https://github.com/flatangle/flatlib.

Are there any sample code? There's a "recipes" folder with some source code at https://github.com/flatangle/flatlib/tr ... er/recipes. You can start with "aspects.py" which is at https://github.com/flatangle/flatlib/bl ... aspects.py.

Can I use it on my own work? Absolutely yes, you are free to use it in your own projects. The flatlib source code is released under an MIT License, which allows it to be used also on commercial projects. There is a caveat though: flatlib uses the swiss ephemeris which is licensed GPL. Therefore, if you want to use flatlib in your commercial projects, you must adhere to the GPL license or buy a Swiss Ephemeris commercial license.

Why are you open-sourcing flatlib? I really want to help push forward data-driven research in astrology. That is only possible with a strong community of researchers and good tools, so there was no point in keeping flatlib hidden on my hard disk. Flatlib is also a good tool for talking about astrology techniques. Someone can always point to the source code to explain how things can be done. For instance, this is how aspects are implemented and this is how solar returns are computed.

Can I contribute to the project? I accept contributions such as code and documentation, although I suggest to wait a while since things are not stable yet. The best contribution for now is to spread the news about the existence of this project.

3
Hi there,

I've just released flatlib 0.1.1. It now includes the computation of Essential Dignities.. :)

Code: Select all

# Build a chart for a date and location

>>> date = Datetime('2015/03/13', '17:00', '+00:00')
>>> pos = GeoPos('38n32', '8w54')
>>> chart = Chart(date, pos)


# Get the Asc ruler

>>> asc = chart.get(const.ASC)
>>> ascRulerID = essential.ruler(asc.sign)
>>> ascRuler = chart.get(ascRulerID)
>>> print(ascRuler) 
Mercury Pisces +00:48:57 +01:29:49


# Print Asc Ruler score

>>> info = essential.EssentialInfo(ascRuler)
>>> print(info.score)
You can check the source code in the github page (https://github.com/flatangle/flatlib), and install it in your Python environment using pip3 install flatlib --upgrade.


Jo?o Ventura

4
Hello,

for those who have been following my work on flatlib, I have now included support for handling planetary rulers. You can now do something like:

Code: Select all

# Build a date and location

>>> date = Datetime('2015/03/13', '17:00', '+00:00')
>>> pos = GeoPos('38n32', '8w54')

# Get the Planetary Hour table

>>> hourTable = planetarytime.getHourTable(date, pos)
>>> hourTable.dayRuler() 
Venus
>>> hourTable.nightRuler()
Mars
>>> hourTable.hourRuler()
Saturn
>>> info = hourTable.currInfo()
>>> info['hourNumber']
11
You can find flatlib at github: https://github.com/flatangle/flatlib


Jo?o Ventura

6
Hello everyone,

I've just released version 0.2.0 which includes many new features and bug fixes, such as:
- Planetary time
- Arabic Parts
- Chart Dynamics
- Accidental dignities
- Predictives (Profections, Solar Returns and Primary Directions)
- Protocols (Almutem, Temperament and Behavior calculations)

All basic features are now included and I will probably start working on some documentation.

Example of Accidental Dignities:

Code: Select all

# Build a chart for a date and location
>>> date = Datetime('2015/03/13', '17:00', '+00:00')
>>> pos = GeoPos('38n32', '8w54')
>>> chart = Chart(date, pos)

# Build AccidentalDignity class for Venus
>>> venus = chart.get(const.VENUS)
>>> aDign = AccidentalDignity(venus, chart)

# Venus haiz
>>> haiz = aDign.haiz()
>>> print(haiz)
Contra-haiz

# Venus accidental dignity score
>>> score = aDign.score()
>>> print(score)
6
Source code: https://github.com/flatangle/flatlib/
Python package: https://pypi.python.org/pypi/flatlib


Jo?o Ventura

7
Jo?o,

A big thank you from me!

And thanks for your help in getting this installed on my Windows machine.

That help is now documented and should make things a lot easier for all to install now.

Skyrack

8
Hello everyone,

with a little help from @skyrack, I started to document some things regarding this library. You can find the documentation at http://flatlib.readthedocs.org/.

For now it only includes basic instructions to install flatlib from sources in Windows (other OSes will follow), and a FAQ (as above). I will keep improving the documentation, and I am planning to include also some tutorials for those who want to have a go but don't know how to start.

It is a work in progress, but things are slowly starting to take shape.. :)


Regards,
Jo?o Ventura