Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3aed432
1st draft of code to generate the tlusty 2025 stellar library
karllark Apr 28, 2026
7875408
adding stellib entry
karllark Apr 28, 2026
90d1069
code for checking the boundaries
karllark Apr 28, 2026
653b4e0
fixing various codestyle issues
karllark Apr 28, 2026
2a29590
fixing docstrings
karllark Apr 28, 2026
4ff2f81
updating path
karllark Apr 28, 2026
693e154
update tlusty file format and fix bug in stelllib
karllark May 1, 2026
4b47bc9
fixing some codacy issues
karllark May 1, 2026
a173edc
adding in bosz stellar library code
karllark May 1, 2026
2e5e2cc
cleanup
karllark May 1, 2026
49e4207
updating to handle ATLAS vs MARCS
karllark May 1, 2026
17fd50c
all files!
karllark May 1, 2026
f2e8e75
going for the full grid
karllark May 1, 2026
6e46f03
updating to get the right assumed solar abundances
karllark May 1, 2026
9aebf66
gotta actually output the resuls - lol
karllark May 2, 2026
1d0659c
continuing debugging
karllark May 24, 2026
439a3dc
found a bug!
karllark May 24, 2026
2f8c6de
fixed bosz 2024 grid generation
karllark May 24, 2026
a024d69
removing debug statement
karllark May 24, 2026
9f5aa9d
works! Tweak to the new tlusty2025 metallicities.
karllark May 25, 2026
6c964ef
cleanup
karllark May 25, 2026
7fd8448
last codestlye
karllark May 25, 2026
5db671a
minor doc update
karllark May 25, 2026
10e72b6
adding aringer 2016
karllark May 25, 2026
4d85c45
cleanup
karllark May 26, 2026
ef27fe7
changing Aringer directory location
karllark May 26, 2026
f2c6c36
improved plot
karllark May 26, 2026
1d24f44
updating Aringer grid coverage to be more uniform
karllark May 26, 2026
7b40d9a
removing old kurucz generation code
karllark May 26, 2026
2681eb2
adding coverage plot for multiple grids
karllark May 26, 2026
eb624a9
better stellar lib coverage plots
karllark May 27, 2026
3e8c96e
updating multi library coverage plot
karllark May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions beast/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
vega="vega.hd5",
filters="filters.hd5",
kurucz04="kurucz2004.grid.fits",
bosz24="bosz2024.grid.fits",
tlusty09="tlusty.lowres.grid.fits",
tlusty25="tlusty2025.grid.fits",
hstcovar="hst_whitedwarf_frac_covar.fits",
mist1="MIST_FeH-4.00_vvcrit0.4.fits",
mist2="MIST_FeH-3.50_vvcrit0.4.fits",
Expand Down
Empty file.
201 changes: 0 additions & 201 deletions beast/physicsmodel/stars/kurucz/generate.py

This file was deleted.

62 changes: 62 additions & 0 deletions beast/physicsmodel/stars/stellar_libraries/check_slib_coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import argparse
import numpy as np
import matplotlib.pyplot as plt

from beast.physicsmodel.stars import stellib
from helpers import get_stellib_boundaries

if __name__ == "__main__": # pragma: no cover

parser = argparse.ArgumentParser()
parser.add_argument(
"--grid",
default="BOSZ2024",
choices=["Tlusty2025", "BOSZ2024", "Aringer2016", "Kurucz", "Tlusty"],
help="Grid to show",
)
parser.add_argument("--png", action="store_true", help="save figures to png files")
args = parser.parse_args()

if args.grid == "BOSZ2024":
slib = stellib.BOSZ2024()
elif args.grid == "Tlusty2025":
slib = stellib.Tlusty2025()
elif args.grid == "Aringer2016":
slib = stellib.Aringer2026()
elif args.grid == "Kurucz":
slib = stellib.Kurucz()
elif args.grid == "Tlusty":
slib = stellib.Tlusty()

# useful when new grids are generarted
# results are used to define the bounding box in a model definition
bound = get_stellib_boundaries(slib, dlogT=0.0, dlogg=0.0)
print("Algorithmically generated bounds")
print(bound)

# setup the plots
fontsize = 12
font = {"size": fontsize}
plt.rc("font", **font)
plt.rc("lines", linewidth=2)
plt.rc("axes", linewidth=2)
plt.rc("xtick.major", width=2)
plt.rc("ytick.major", width=2)

for cz in np.unique(slib.Z.data):
gvals = slib.Z.data == cz
plt.plot(slib.logT[gvals], slib.logg[gvals], "ko")
plt.plot(bound[:, 0], bound[:, 1], "g-", label="algorithmly generated")
slib.plot_boundary(
dlogT=0.0, dlogg=0.0, label="defined in class def", alpha=0.5, color="b"
)
plt.title(f"{args.grid}; z = {cz:.2e}")
plt.xlabel("log(Teff)")
plt.ylabel("log(g)")
plt.legend()

if args.png:
plt.savefig(f"slib_coverage_{args.grid}_z_{cz:.2e}.png")
plt.close()
else:
plt.show()
68 changes: 68 additions & 0 deletions beast/physicsmodel/stars/stellar_libraries/comp_tlusty25_bosz24.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import matplotlib.pyplot as plt
import numpy as np
import astropy.units as u
from astropy.io import ascii

from helpers import rebin_spectrum

if __name__ == "__main__": # pragma: no cover

solar_z = 0.02

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With new models, do we still stick to this old Zsun value? For example, the PARSEC models use Zsun=0.0152.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solar_z value for each model is different. I've gone back to the papers to figure out the correct value for each grid. This is given with references in each script that generates the grids. We want the absolute metallicity, not relative to solar as each grid uses a different solar value - as the solar value changes with time. Exciting.

I will update this script to compare models from any two stellar libraries using the grids themselves. This is needed to ensure that the scaling is correct for all the models. And provides a great way to compare models from two grids for the same stellar parameters. Will not resolve this comment till the expanded script is ready.


# read the kurucz spectrum
# wavelength first
wave_filename = "/home/kgordon/Python/extstar_data/Models/BOSZ2024/r2000/bosz2024_wave_r2000.txt"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line contains a hardcoded absolute path pointing to your specific directory. To ensure portability across different environments and for other users, please replace this with a relative path or leverage the standard beast data directory configuration paths. Also the corresponding documentation should be provided.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

mspec_lte_wave = ascii.read(
wave_filename,
format="no_header",
# fast_reader={"exponent_style": "D"},
names=["Wave"],
)

model_filename = "/home/kgordon/Python/extstar_data/Models/BOSZ2024/r2000/m+0.00/bosz2024_ap_t15000_g+4.0_m+0.00_a+0.00_c+0.00_v2_r2000_resam.txt.gz"
mspec_lte = ascii.read(
model_filename,
format="no_header",
# fast_reader={"exponent_style": "D"},
names=["SFlux", "SCont"],
)
mspec_lte["Wave"] = mspec_lte_wave["Wave"] * u.angstrom

# read the tlusty spectrum
model_filename = (
"/home/kgordon/Python/extstar_data/Models/Tlusty_2023/z100t15000g400v2.spec.gz"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. ;-)

)
# read in the model spectrum
mspec = ascii.read(
model_filename,
format="no_header",
fast_reader={"exponent_style": "D"},
names=["Wave", "SFlux"],
)

# convert the type to float
mspec["SFlux"] = mspec["SFlux"].astype(float)

# set the units
fluxunit = u.erg / (u.s * u.cm * u.cm * u.angstrom)
mspec["Wave"].unit = u.angstrom
mspec["SFlux"].unit = fluxunit

# now extract the wave and flux colums
mwave = mspec["Wave"]
mflux = mspec["SFlux"]

# rebin to R=4000 for speed
rbres = 4000.0
wave_rebin, flux_rebin, npts_rebin = rebin_spectrum(
mwave.value, mflux.value, rbres, [200.0, 310000.0]
)
wave_rebin *= u.angstrom
print(len(wave_rebin))

# plot
plt.plot(wave_rebin.to(u.micron), flux_rebin * 4 * np.pi)
plt.plot(mspec_lte["Wave"].to(u.micron), mspec_lte["SFlux"] * 4 * np.pi)
plt.yscale("log")
plt.xscale("log")
plt.show()
Loading
Loading