Use a custom stellar model
In this tutorial we take a look at how to use a custom stellar model.
Let us mock up some stellar data.
[1]:
import numpy as np
def generate_synthetic_stellar_models(n_wvs=1000, n_mus=20):
# Generate I(lambda, mu).
wvs = np.linspace(0.01e-6, 50e-6, n_wvs)
mus = np.linspace(1., 0.01, n_mus)
temps = np.linspace(5000., 4500., n_mus)
stellar_intensity = []
for mu, temp in zip(mus, temps):
stellar_intensity.append(plancks_law(wvs, temp))
return wvs * 1.e10, mus, np.array(stellar_intensity).T
def plancks_law(wav, temp):
a = 2.0 * 6.62607004e-34 * 2.99792458e8**2
b = 6.62607004e-34 * 2.99792458e8 / (wav * 1.38064852e-23 * temp)
intensity = a / (wav**5 * (np.exp(b) - 1.0))
return intensity
s_wvs, s_mus, stellar_intensity = generate_synthetic_stellar_models()
print(s_wvs.shape)
print(s_mus.shape)
print(stellar_intensity.shape)
(1000,)
(20,)
(1000, 20)
With this data in hand, you can run the code as follows.
[2]:
import os
from exotic_ld import StellarLimbDarkening
sld = StellarLimbDarkening(ld_data_path="exotic_ld_data",
ld_model="custom",
custom_wavelengths=s_wvs,
custom_mus=s_mus,
custom_stellar_model=stellar_intensity)
cs = sld.compute_4_parameter_non_linear_ld_coeffs(wavelength_range=[20000., 30000.],
mode="JWST_NIRSpec_Prism")
print(cs)
(0.0005949930583144949, 0.16760039051680015, 0.0026860142027271758, 0.0012534501563158235)