Évolution des étoiles : types spectraux particuliers

Documentation en ligne

Catalogue utilisé

Le catalogue Hipparcos.

  • V/137D
  • Description standard utile, si l'on lit l'anglais.
  • Utilisation du langage d'interrogation de la base de données pour extraire les champs : Type spectral, Fe-H, B-V, VMag (magnitude absolue).
  • Enregistrement dans un fichier au format CSV (extension tsv ici).
  • En-tête éliminé à la main via un éditeur de texte.
  • Le fichier contient 99999 lignes (une par étoile), mais certaines lignes sont incomplètes et il va falloir les éliminer avant de poursuivre le travail.

Comment aborder ce catalogue avec Python ?

  1. Charger les données dans une liste de listes
In [9]:
import csv
import numpy as np
import matplotlib.pyplot as plt
# V/137D Hipparchos
# W = Wolf-Rayet
# L T Y = froides
# R N C S = carbonnées
SpType, Fe_H, B_V, VMag = 0, 1, 2, 3
tout = []
with open('hip99999.tsv', newline='') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=';')
    for ligne in spamreader:
        tout.append(ligne)
maxi = len(tout) - 1
  1. Une liste pour chacun des champs SpType, B-V, VMag

Remarque : emploi du trait de soulignement à la place du signe moins.

  • Élimination des lignes incomplètes.
  • Chargement des trois listes dédiées.
In [10]:
spectre = []
b_v     = []
vmag    = []

for i in range(maxi):
    ligne = tout[i]
    if (len(ligne[0].strip()) > 0) and (len(ligne[1].strip()) > 0) and len(ligne[2].strip()) > 0 and  len(ligne[3].strip()) > 0:
        spectre.append(ligne[0].strip())
        b_v.append(float(ligne[2]))
        vmag.append(float(ligne[3]))
  1. isoler les enregistrements qui correspondent à trois couleurs
  • Pour les étoiles Wolf-Rayet, on prendra les étoiles de type W.
  • Pour les étoiles brunes, celles de types L, T et Y.
  • Pour les étoiles carbonées, celles de types R, N, C et S.

Remarque : le code Python a été ici optimisé pour la facilité de lecture. Le fait de réaliser trois boucles au lieu d'une n'est pas idéal sur le plan de la consommation des ressources.

In [11]:
bvwolf, vmagwolf = [], []
bvfroides, vmagfroides = [], []
bvcarbon, vmagcarbon =[], []

for i in range(len(spectre)):
    if "W" in spectre[i]:
        bvwolf.append(b_v[i])
        vmagwolf.append(vmag[i])

for i in range(len(spectre)):
    if "L" in spectre[i] or "T" in spectre[i] or  "Y" in spectre[i]:
        bvfroides.append(b_v[i])
        vmagfroides.append(vmag[i])

for i in range(len(spectre)):
    if "R" in spectre[i] or "N" in spectre[i] or "C" in spectre[i] or "S" in spectre[i]:
        bvcarbon.append(b_v[i])
        vmagcarbon.append(vmag[i])

Tracé de diagrammes HR

Afin de mettre en évidence la position de chaque type d'étoile sur le diagramme, on en tracera trois. En fait on utilise le même code Python dont on active ou désactive certaines lignes avec le signe #. L'ensembles des 99999 étoiles extraites du catalogue est positionné sur le diagramme par des points gris.

Étoiles Wolf-Rayet

In [12]:
fig = plt.figure(1, figsize=(10,12)) # dimensions du cadre
plt.plot(b_v, vmag, linestyle='none', marker = 'o', c = '#adadad', markersize = 2, label="Catalogue entier")
# plt.plot(bvfroides, vmagfroides, linestyle='none', marker = 'o',  markersize = 4, label="L,T,Y = froides")
# plt.plot(bvcarbon, vmagcarbon, linestyle='none', marker = '+', c = '#653030', markersize = 4, label="R,N,C,S= carbonées")
plt.plot(bvwolf, vmagwolf, linestyle='none', marker = 'x', c = 'red', markersize = 3, label="Wolf-Rayet")
axes = plt.gca()
axes.set_xlabel("Couleur : B-V")
axes.set_ylabel("Magnitudes")
axes.invert_yaxis()
plt.legend(loc='right')
Out[12]:
<matplotlib.legend.Legend at 0x7fe6aefa1650>

Étoiles de types L, T et Y

In [13]:
fig = plt.figure(1, figsize=(10,12)) # dimensions du cadre
plt.plot(b_v, vmag, linestyle='none', marker = 'o', c = '#adadad', markersize = 2, label="Catalogue entier")
plt.plot(bvfroides, vmagfroides, linestyle='none', marker = 'o',  markersize = 4, label="L,T,Y = froides")
# plt.plot(bvcarbon, vmagcarbon, linestyle='none', marker = '+', c = '#653030', markersize = 4, label="R,N,C,S= carbonées")
# plt.plot(bvwolf, vmagwolf, linestyle='none', marker = 'x', c = 'red', markersize = 3, label="Wolf-Rayet")
axes = plt.gca()
axes.set_xlabel("Couleur : B-V")
axes.set_ylabel("Magnitudes")
axes.invert_yaxis()
plt.legend(loc='right')
Out[13]:
<matplotlib.legend.Legend at 0x7fe6af1618d0>

Étoiles carbonées : types R, N, C et S

In [14]:
fig = plt.figure(1, figsize=(10,12)) # dimensions du cadre
plt.plot(b_v, vmag, linestyle='none', marker = 'o', c = '#adadad', markersize = 2, label="Catalogue entier")
# plt.plot(bvfroides, vmagfroides, linestyle='none', marker = 'o',  markersize = 4, label="L,T,Y = froides")
plt.plot(bvcarbon, vmagcarbon, linestyle='none', marker = '+', c = '#653030', markersize = 4, label="R,N,C,S= carbonées")
# plt.plot(bvwolf, vmagwolf, linestyle='none', marker = 'x', c = 'red', markersize = 3, label="Wolf-Rayet")
axes = plt.gca()
axes.set_xlabel("Couleur : B-V")
axes.set_ylabel("Magnitudes")
axes.invert_yaxis()
plt.legend(loc='right')
Out[14]:
<matplotlib.legend.Legend at 0x7fe6ae1f6390>

Pour finir, un diagramme qui les réunit

In [15]:
fig = plt.figure(1, figsize=(10,12)) # dimensions du cadre
plt.plot(b_v, vmag, linestyle='none', marker = 'o', c = '#adadad', markersize = 2, label="Catalogue entier")
plt.plot(bvfroides, vmagfroides, linestyle='none', marker = 'o',  markersize = 4, label="L,T,Y = froides")
plt.plot(bvcarbon, vmagcarbon, linestyle='none', marker = '+', c = '#653030', markersize = 4, label="R,N,C,S= carbonées")
plt.plot(bvwolf, vmagwolf, linestyle='none', marker = 'x', c = 'red', markersize = 3, label="Wolf-Rayet")
axes = plt.gca()
axes.set_xlabel("Couleur : B-V")
axes.set_ylabel("Magnitudes")
axes.invert_yaxis()
plt.legend(loc='right')
Out[15]:
<matplotlib.legend.Legend at 0x7fe6ae1c7210>

Conclusions

  • Une mécanique d'exploration des ressources d'un catalogue au format CSV a été mise en place.
  • Les bibliothèques Python montrent leur efficacité.

Extensions possibles :

  • On a donné à voir... il reste maintenant à aller un peu plus loin...
  • Par quels chemins ?
  • À suivre donc.