Posts

Showing posts from July, 2024

Python Code to Plot position of planets on RA-DEC Grid

Image
 Below is Python  Output & Code to "Plot position of planets on RA-DEC Grid". Change the Setting parameters - Longitude, Latitude and Time. The comments "#" gives short description of the code. You may need to install the required libraries. *************************************************************************** from astropy.coordinates import EarthLocation, AltAz, get_sun, get_moon, solar_system_ephemeris, get_body from astropy.time import Time import astropy.units as u import matplotlib.pyplot as plt def plot_planet_positions(date_time, latitude, longitude):     # Define observer's location     observer_location = EarthLocation(lat=latitude*u.deg, lon=longitude*u.deg, height=0*u.m)          # Define the time of observation     observing_time = Time(date_time)          # List of planets     planets = ['mercury', 'venus', 'earth', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune']          #

Algol - Show Future Eclipse Dates using Python

  Python Code Algol , is also called as Demon Star. It is a bright triple star system in the constellation Perseus. It is one of the first known eclipsing binaries, where the primary star is regularly dimmed by its companion passing in front of it. Algol's periodic dimming has made it a subject of fascination and study since ancient times. Below is snippet of python code to show next eclipse 5 dates. *************************************************** import ephem # Define Algol algol = ephem.star('Algol') # Set observer location (e.g., New York) observer = ephem.Observer() observer.lat = '40.7128'  # Latitude of New York observer.lon = '-74.0060'  # Longitude of New York observer.elevation = 10  # Elevation of New York (in meters) # Set the current date and time observer.date = ephem.now() # Predict the next 5 eclipse events. You can change the parameter in range(N) function for i in range(5):     next_eclipse = observer.next_setting(algol)     print("