PrePAN

Sign in to PrePAN

AstroScript Library of astronomical calculations, aimed for astrology software

Good

Synopsis

use AstroScript::Ephemeris::Planet qw/@PLANETS/;
use AstroScript::Ephemeris qw/find_positions/;

my $jd = 2458630.5; # Standard Julian date for May 27, 2019, 00:00 UTC.
                                  # May be obtained through DateTime module or one of functions 
                                  # exported by AstroScript::Time module. 
my $t  = ($jd - 2451545) / 36525; # Convert Julian date to centuries since epoch 2000.0

# Apparent geocentric ecliptic coordinates of Sun, Moon and the planets
find_positions($t, \@PLANETS, sub {
    my ($id, %pos) = @_;
    print "$id X: $pos{x}, Y: $pos{y}, Z: $pos{z}\n";
})

# Moon X: 338.817869258643, Y: -3.97888700952293, Z: 0.00270053644038518
# Sun X: 65.4558939369393, Y: -0.000155185099535724, Z: 1.01310398748619
# Mercury X: 72.1106054350995, Y: 1.20735643288534, Z: 1.29184580348904
...

Description

There are many astronomical libraries available in the public domain. While giving accurate results, they often suffer from lack of convenient API, documentation and maintainability. Most of the source code is written in C, C++ or Java, and not dynamic languages. So, it is not easy for a layman to customize them for her custom application, be it an online lunar calendar, horoscope or tool for amateur sky observations. This library is an attempt to find a middle-ground between precision on the one hand and compact, well organized code on the other.

Most of the calculations are based on "Astronomy On The Personal Computer" by O.Montenbruck, T.Phleger, Fourth Edition, Springer-Verlag, 2000.

The library includes:

AstroScript::MathUtils — Core mathematical routines. AstroScript::Time — Time-related routines. AstroScript::Ephemeris — Positions of celestial bodies. AstroScript::Angles — Some abstract points related to diurnal rotation of the Celestial Sphera: Ascendant, Midheaven, Vertex, East Point. AstroScript::CoCo — Coordinates conversions. AstroScript::Houses — Astrological houses, by the most used systems. AstroScript::Nutation — Nutation and obliquity of ecliptic.

Comments

Declared bias: I'm a professional astronomer.

I am concerned that you are mixing Astronomy (in the modern sense of that word as representing a physical science) with Astrology. Some of the functionality seems purely astronomical, some purely astrological, and some (e.g. AstroScript::Angles) a combination of the two. I personally would hesitate to mix them. As an astronomer, I do not know if the precision required of an astrological calculation is comparable to that required for an astronomical calculation, and I would look at the former with some suspicion. I recommend that you split out the purely astronomical functionality and indicate the origin of the algorithms and the accuracy of the calculations. Note that there are already a number of astronomical modules on CPAN in the Astro:: namespace; do these not meet some of your requirements?

Your namespace 'AstroScript' is, I'm presuming, an attempt to indicate that the modules are used for scripting Astro* related processes. (I wouldn't have guessed that if it popped up on CPAN. It could be another language, like JavaScript) To date (as far as I know) the Astro prefix in CPAN has been dedicated to Astronomy. From my professional perspective, as well as from a CPAN historical perspective, it's not an appropriate namespace for Astrology.

Please consider putting your astrological code in an Astrology namespace. That will make it very clear as to who the intended audience is.

Thanks for your efforts!


djerius@github: Thank you for your review, I very much appreciate help from a professional. Well, I had my doubts for the same matter. I've just browsed through Astro:: namespace. It seems, there are no implementations of the same astronomical algorithms. Do you feel appropriate to name the astronomical part "Astro::Montenbruck"? (The routines are based on "Astronomy On The Personal Computer" by O.Montenbruck, T.Phleger).

There is a project called "Swiss Ephemeris" (https://www.astro.com/swisseph/swephinfo_e.htm), which may be called a today's standard for astrological software. It is precise and fast. There are some wrappers for its C library written in Python and Perl (http://www.astrotexte.ch/sources/SwissEph.html). What they lack is portability and convenient license. My intent is to provide a lightweight alternative, portable and free.
Thanks. This looks like it will fill a need.

Please sign up to post a review.