Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dimmastro/openastro2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenAstro2

A comprehensive Python library for astrological calculations and chart generation

Python Version License Tests

OpenAstro2 provides high-precision astrological calculations using the Swiss Ephemeris, supporting multiple chart types, house systems, and coordinate systems. It generates professional-quality SVG charts with extensive customization options.

✨ Features

πŸ—“οΈ Chart Types

  • Natal/Radix Charts - Birth chart analysis
  • Transit Charts - Current planetary influences
  • Progression Charts - Secondary progressions and directions
  • Solar/Lunar Returns - Annual and monthly return charts
  • Lunation Charts - New Moon and Full Moon charts
  • Geographic Astrology - Local Space Maps and AstroMaps
  • Fixed Star Charts - Fixed star influences

🏠 House Systems

  • Placidus, Koch, Equal, Whole Sign, Regiomontanus
  • Campanus, Morinus, Porphyrius, Topocentric
  • And 15+ more systems

🌍 Coordinate Systems

  • Apparent Geocentric (default)
  • True Geocentric
  • Topocentric
  • Heliocentric

🎨 Visualization

  • High-quality SVG chart generation
  • Customizable colors, symbols, and layouts
  • European and other traditional chart styles
  • Export to various image formats

πŸš€ Quick Start

Installation

pip install openastro2

Basic Usage

from openastro2.openastro2 import openAstro

# Create a birth event
event = openAstro.event(
    name="John Doe",
    year=1990, month=6, day=15,
    hour=14, minute=30, second=0,
    timezone=2,  # UTC+2
    location="Berlin",
    geolat=52.5200, geolon=13.4050
)

# Generate natal chart
chart = openAstro(event, type="Radix")

# Get planet positions
print(f"Sun position: {chart.planets_degree_ut[0]:.2f}Β°")
print(f"Moon sign: {chart.planets_sign[1]}")  # 0=Aries, 1=Taurus, etc.

# Generate SVG chart
svg_content = chart.makeSVG2()
with open("natal_chart.svg", "w", encoding="utf-8") as f:
    f.write(svg_content)

Current Transits

# Get current transits
transit_chart = openAstro(event, type="Transit")

# Or for specific date
transit_event = openAstro.event_dt_str(
    "Transit", "2024-12-25 12:00:00",
    timezone=2, location="Berlin",
    geolat=52.5200, geolon=13.4050
)
transit_chart = openAstro(event, transit_event, type="Transit")

πŸ“– Documentation

Comprehensive documentation is available in the docs/ directory:

🌐 Online Examples

Try OpenAstro2 in Google Colab:

πŸ› οΈ System Requirements

Python Requirements

  • Python 3.9+ (3.11+ recommended)
  • 64-bit architecture recommended

Core Dependencies

  • pyswisseph>=2.10.3.2 - Swiss Ephemeris calculations
  • skyfield>=1.46 - Astronomical computations
  • svgwrite>=1.4.3 - SVG generation
  • pandas>=2.0.2 - Data manipulation
  • numpy>=1.26.4 - Numerical operations

System Dependencies (Optional)

  • librsvg2-bin - SVG to image conversion
  • imagemagick - Additional image formats

🎯 Use Cases

Professional Astrologers

# Generate client chart with custom settings
settings = {
    'astrocfg': {
        'houses_system': 'P',  # Placidus
        'language': 'en',
        'zodiactype': 'tropical'
    }
}
chart = openAstro(client_event, type="Radix", settings=settings)

Research Applications

# Batch process multiple charts
people_data = [...] # List of birth data
results = []

for person in people_data:
    event = openAstro.event(**person)
    chart = openAstro(event, type="Radix")
    results.append({
        'name': person['name'],
        'sun_sign': chart.planets_sign[0],
        'moon_sign': chart.planets_sign[1]
    })

Web Applications

# API endpoint for chart generation
def generate_chart_api(birth_data):
    try:
        event = openAstro.event(**birth_data)
        chart = openAstro(event, type="Radix")
        return {'svg': chart.makeSVG2(), 'status': 'success'}
    except Exception as e:
        return {'error': str(e), 'status': 'error'}

πŸ§ͺ Testing

# Run test suite
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=openastro2 --cov-report=html

# Run specific test
pytest tests/test_chart_list.py::test_openastro_types -v

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone repository
git clone https://github.com/dimmastro/openastro2.git
cd openastro2

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/macOS
venv\Scripts\activate     # Windows

# Install development dependencies
pip install -r requirements.txt
pip install pytest pytest-cov black flake8

# Install in development mode
pip install -e .

# Run tests
pytest tests/

πŸ“œ License

OpenAstro2 is released under the GNU General Public License v3.0. See LICENSE for details.

πŸ™ Acknowledgments

  • Swiss Ephemeris by Astrodienst for accurate astronomical calculations
  • Original OpenAstro project by Pelle van der Scheer
  • Contributors who help improve the project

πŸ“ž Support


OpenAstro2 - Making professional astrological calculations accessible to everyone.