Investigating Stellar Isochrones in Astrophysics
InvetigatingDiscoInIso.ipynb
This Jupyter notebook file appears to focus on astrophysics, specifically in plotting and analyzing stellar isochrones by temperature and gravity, utilizing various libraries such as matplotlib, numpy, pandas, and specific astrophysical packages like fidanka and pysep. It involves reading isochrone data, interpolating these data for specific ages, and visualizing the data in plots. Additionally, it demonstrates loading stellar model data and saving configurations, supporting research in stellar evolution or comparative analysis of stellar properties.
- snippet.python
import matplotlib.pyplot as plt import numpy as np import pandas as pd from fidanka.isochrone.isochrone import interp_isochrone_age from pysep.io.iso.read import read_iso from fidanka.isochrone.MIST import read_iso as read_MIST_iso import pathlib
- snippet.python
def plot_Teff_logg(path): iso = read_MIST_iso(path) # print([x/1e9 for x in list(iso.keys())]) header = iso[list(iso.keys())[0]].columns isoAtAge = interp_isochrone_age(iso, 14.174741629268077) df = pd.DataFrame(isoAtAge, columns=header) fig, ax = plt.subplots(1, 1, figsize=(10,7)) ax.plot(10**df["log_Teff"].values, df["log_g"].values, 'o-', markersize=2) ax.invert_yaxis() ax.invert_xaxis()
- snippet.python
path = "../outputs.disconTest/PopA+0.24/alpha-1.901/isochrones.txt" assert os.path.exists(path), "File not found" plot_Teff_logg(path)
- snippet.python
fig, ax = plt.subplots(1,1,figsize=(10,7)) ax.invert_yaxis() ax.invert_xaxis() glob = pathlib.Path("../outputs.kttauTest/PopA+0.24/alpha-1.901/").rglob("*.iso") for pID, path in enumerate(glob): iso, isoMeta = read_iso(path) print(isoMeta['M']) ageCut = iso['Age'].values < 12e9 Log_T = iso['Log_T'][ageCut].values Log_g = iso['Log_g'][ageCut].values T = 10**Log_T ax.plot(T, Log_g) ax.set_xlim(6100, 4000)
0.65 0.75 0.55 0.8 0.6 0.7 0.5 0.85 (6100.0, 4000.0)
- snippet.python
from pysep.dsep import load_model
- snippet.python
model68 = load_model("M0.680.dsep")
- snippet.python
model70 = load_model("M0.700.dsep")
- snippet.python
model68.control.save("68control.nml")
True
- snippet.python
model70.physics.save("70phys.nml") model70.control.save("70control.nml")
True
python