Introducing a simple plot using the Hertzsprung-Russell diagram (commonly known as the HR diagram) using a space astronomical database called astroquery. To do. Even those who are not good at it may get familiar with plotting for the time being.
If you only need the code, please refer to the google Colab page.
python
pip install astroquery
Then, enter astroquery.
Data is from a database called Vizier
Use the data from the Hipparcos satellite at.
python
from astroquery.vizier import Vizier
v = Vizier(catalog="I/239/hip_main",columns=['HIP',"Vmag","B-V","Plx"],row_limit=-1)
data = v.query_constraints()
vmag = data[0]["Vmag"]
bv = data[0]["B-V"]
plx = data[0]["Plx"]
All you need is three.
--Vmag: V-band brightness --BV: Ratio of brightness between B band and V band (Note that although it is written as B-V, the magnitude is a log, so it is a ratio.) --plx: Annual parallax. I just need distance information. Since the distance of nearby stars is measured by triangulation, convert from annual parallax to distance.
Is.
The meaning of the option is that catalog = "I / 239 / hip_main" specifies the catalog, columns = ['HIP', "Vmag", "BV", "Plx"] specifies the columns, and row_limit =- Get all the data by removing the upper limit with 1.
Plot a star with an annual parallax of 20 to 25 mili arcsec (that is, a distance of about 40-50 pc).
def to_parsec(marcsec):
return 1./(1e-3*marcsec) # pc
pmin=20 # m arcsec
pmax=25 # m arcsec
dmax = to_parsec(pmin)
dmin = to_parsec(pmax)
dlabel = str("%3.1f" % dmin) + " pc to " + str("%3.1f" % dmax) + " pc"
print (dlabel)
vmag_cut = vmag[ (plx > pmin) & (plx < pmax)]
bv_cut = bv [ (plx > pmin) & (plx < pmax)]
from matplotlib import pyplot as plt
plt.title(dlabel)
plt.xlim(-0.1,2)
plt.ylim(-13,0)
plt.xlabel("B-V")
plt.ylabel("Vmag")
plt.scatter(bv_cut, -vmag_cut, s=1)
Then
In this way, the HR diagram is applied. What if I don't cut at a distance? Please give it a try. B-V is
python
B-V \equiv log(B band brightness)-log(V-band brightness) = log(B band brightness/V-band brightness)
Because it means, let's pay attention to the ratio of brightness.
Recommended Posts