Skip to content

Instantly share code, notes, and snippets.

@EH30
EH30 / julian_date_calculator.py
Created September 17, 2023 11:24
Python script to calculate juilan date
from datetime import datetime
def date_utc_to_julian(year, month, day, hour, minute, second, utc_offset_hours, utc_offset_minutes):
# Convert the date to a datetime object
dt = datetime(year, month, day, hour, minute, second)
# Calculate the Julian date offset
julian_offset = 2440587.5
# Calculate the number of seconds in a day
seconds_per_day = 86400
@EH30
EH30 / pyswisseph_calculate_planets_in_rashi_signs_and_julian_date.py
Last active September 17, 2023 11:42
Python script to calculate planet position in zodiac signs
import swisseph as swe
from datetime import datetime
def date_utc_to_julian(year, month, day, hour, minute, second, utc_offset_hours, utc_offset_minutes):
# Convert the date to a datetime object
dt = datetime(year, month, day, hour, minute, second)
# Calculate the Julian date offset
julian_offset = 2440587.5
# Calculate the number of seconds in a day
@EH30
EH30 / pyswisseph_calculate_planets_rashi.py
Last active September 15, 2023 09:05
python pyswisseph calculate planets rashi or zodiac signs
import swisseph as swe
# pyswisseph version used 2.10.3.2
def planets_rashi(year, month, day, hour, minute, second, latitude, longitude, tzoffset):
"""
This is a simple python script to calculate planets and rashi
"""
swe.set_sid_mode(swe.SIDM_LAHIRI, 0, 0) # Set the Ayanamsa
flags = swe.FLG_SWIEPH + swe.FLG_SPEED + swe.FLG_SIDEREAL
@EH30
EH30 / flatlib-sidereal_ayan_lahiri_example_code.md
Last active August 24, 2023 13:10
flatlib-sidereal ayan lahiri example code

Example

from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.chart import Chart, const

# Date: 2005-03-03 Time: 6:45 AM UTC: +5:30
date = Datetime([2005, 3, 3], ['+',6,45,0], "+05:30")
pos = GeoPos(19.0760, 72.8777)
print("lat: ", pos.lat, "lng: ", pos.lon)