Star catalogue analysis

Thanks to UCF Physics undergrad Tyler Townsend for contributing to the development of this notebook.


In [ ]:
# Import modules that contain functions we need
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt

Getting the data


In [ ]:
# Read in data that will be used for the calculations.
# Using pandas read_csv method, we can create a data frame
data = pd.read_csv("https://raw.githubusercontent.com/merryjman/astronomy/master/stars.csv")
datatwo = pd.read_csv("https://raw.githubusercontent.com/astronexus/HYG-Database/master/hygdata_v3.csv")

In [ ]:
# We wish to look at the first 12 rows of our data set

data.head(12)

Star map


In [ ]:
fig = plt.figure(figsize=(15, 4))
plt.scatter(data.ra,data.dec, s=0.01)
plt.xlim(24, 0)
plt.title("All the Stars in the Catalogue")
plt.xlabel('right ascension (hours)')
plt.ylabel('declination (degrees)')

Let's Graph a Constellation!


In [ ]:
# These are the abbreviations for all the constellations
datatwo.sort_values('con').con.unique()

In [ ]:
# This shows just one constellation.
datatwo_con = datatwo.query('con == "UMa"')

#Define a variable called "name" so I don't have to keep renaming the plot title!
name = "Ursa Major"

# This plots where the brightest 15 stars are in the sky
datatwo_con = datatwo_con.sort_values('mag').head(15)
plt.scatter(datatwo_con.ra,datatwo_con.dec)
plt.gca().invert_xaxis()

# I graphed first without the line below, to see what it looks like, then
# I added the plt.xlim(25,20) to make it look nicer.

plt.xlim(15,8)
plt.ylim(30,70)
plt.title('%s In the Sky'%(name))
plt.xlabel('right ascension (hours)')
plt.ylabel('declination (degrees)')

Let's Go Back in Time!


In [ ]:
# What did this constellation look like 50,000 years ago??
plt.scatter(datatwo_con.ra-datatwo_con.pmra/1000/3600/15*50000,datatwo_con.dec-datatwo_con.pmdec/1000/3600*50000)
plt.xlim(15,8)
plt.ylim(30,70)

plt.title('%s Fifty Thousand Years Ago!'%(name))
plt.xlabel('right ascension (hours)')
plt.ylabel('declination (degrees)')

Let's Go Into the Future!


In [ ]:
# Now, let's try looking at what this same constellation will look like in 50,000 years!
plt.scatter(datatwo_con.ra+datatwo_con.pmra/1000/3600/15*50000,datatwo_con.dec+datatwo_con.pmdec/1000/3600*50000)

plt.xlim(15,8)
plt.ylim(30,70)
plt.title('%s Fifty Thousand Years From Now!'%(name))
plt.xlabel('right ascension (hours)')
plt.ylabel('declination (degrees)')

Now you try one of your own!


In [ ]:
# Make a Hertzsprung-Russell Diagram!

References

  • The data came from The Astronomy Nexus and their colletion of the Hipparcos, Yale Bright Star, and Gliese catalogues (huge zip file here).
  • Reversed H-R diagram from The Electric Universe
  • Many thanks to Adam Lamee and his colleagues at codingink12.org for basically making this whole thing.