Full Index
FormationTemps.AtmosphereCPU — Type
AtmosphereCPU(atm_korg)Build a CPU-backed atmosphere from a Korg atmosphere object.
FormationTemps.AtmosphereCPU — Method
AtmosphereCPU(atm_korg)Construct an AtmosphereCPU with thermodynamic and velocity fields on the CPU.
FormationTemps.AtmosphereGPU — Type
AtmosphereGPU(atm_korg)Build a GPU-backed atmosphere from a Korg atmosphere object.
FormationTemps.AtmosphereGPU — Method
AtmosphereGPU(atm_korg)Construct an AtmosphereGPU with thermodynamic fields from Korg and velocity fields allocated on the GPU.
FormationTemps.StellarProps — Method
StellarProps(; Teff=NaN, logg=NaN, Fe_H=NaN, vsini=0.0, v_macro=NaN, v_micro=NaN,
ρstar=1.0, istar=90.0)Container for stellar parameters and broadening properties used by FormationTemps.
Keyword arguments:
Teff: effective temperature (K).logg: log10 surface gravity (cgs).Fe_H: metallicity [Fe/H] (dex), used to buildA_X.vsini: projected rotation velocity (m/s).v_macro: macroturbulent velocity (m/s); ifNaN, usesvmac_fit(Teff, logg).v_micro: microturbulent velocity (m/s); ifNaN, usesvmic_fit(Teff).ρstar: stellar radius scale factor for disk integration (dimensionless).istar: inclination angle in degrees (90 = equator-on).
FormationTemps.calc_formation_temp — Method
calc_formation_temp(star, linelist; use_gpu=GPU_DEFAULT, Δλ=0.01, convolve=false,
minλ=NaN, maxλ=NaN, u1=NaN, u2=NaN, Nϕ=128, kwargs...)Compute flux formation temperatures, normalized flux, and flux contribution function for a given star and linelist.
The wavelength grid is built from the line list (wl * 1e8) with padding and step Δλ. Use minλ/maxλ (Angstrom) to override the default bounds (first/last line ± 2 A).
Returns a FormTempResult with fields:
wavs: wavelength grid (Angstrom).flux: normalized flux (sum(cfunc_dt_flux) / sum(cfunc_dt_flux_cont)).form_temps: formation temperature defined at 50% of the cumulative flux contribution.cont_func: contribution function, shape(Natm - 1, Nλ).atmosphere: atmosphere structure used for the calculation.
If convolve=true, applies Hirano rotation + macroturbulent convolution using limb-darkening coefficients u1 and u2. Otherwise, performs numerical disk integration using Nϕ latitude bins. Set use_gpu=true to use the GPU implementation when available.
Examples
star = StellarProps(Teff=5777.0, logg=4.44, Fe_H=0.0, vsini=2100.0)
linelist = Korg.read_linelist(joinpath(FT.datdir, "Sun_VALD.lin"))[1:500]
result = calc_formation_temp(star, linelist; Δλ=0.01, convolve=true, u1=0.43, u2=0.31)FormationTemps.calc_stellar_grid — Method
calc_stellar_grid(ρs, i, vsini, Nϕ)Compute a stellar surface grid on the GPU for disk integration. Geometry follows that from S. S. Vogt et al. (1987) and N. Piskunov & O. Kochukhov (2002).
Arguments:
ρs::Real: Stellar radius (in solar radii)i::Real: Inclination in degrees, in the range [-90, 90].vsini::Real: Projected rotational velocity.Nϕ::Int: Number of latitude bins; longitude bins vary with latitude.
Returns:
μs::CuArray: Cosine of the angle between the surface normal and the line of sight per tile.dA::CuArray: Projected surface area per tile.z_rot::CuArray: Line-of-sight rotational velocity per tile.z_cbs::CuArray: Additional per-tile velocity term. Disused in this implementation.
FormationTemps.compute_alpha! — Method
compute_alpha!(αs, wls, linelist, atm, A_X; partition_funcs=Korg.default_partition_funcs, ne_warn_thresh=0.1)
compute_alpha!(αs, wls, linelist, zs, Ts, nds, nes, A_X; partition_funcs=Korg.default_partition_funcs, ne_warn_thresh=0.1)Compute total (continuum + line) absorption coefficients in-place.
Arguments:
αs::AbstractArray{<:Real}: Output array for absorption coefficients, sized(Nlayers, Nλ).wls::Korg.Wavelengths: Wavelength grid for the absorption calculation.linelist: Line list passed toKorg.line_absorption!.atm::Atmosphereor(zs, Ts, nds, nes): Atmospheric structure (heights, temperatures, number densities, electron densities).A_X::AbstractVector{<:Real}: Elemental abundances on the usual astronomical scale.partition_funcs=Korg.default_partition_funcs: Partition function table for chemical equilibrium.ne_warn_thresh=0.1: Relative warning threshold for electron density updates.
Returns:
nothing:αsis filled in-place.
Notes:
- Adapted from
Korg.line_absorption!.
FormationTemps.convolve_gray_rotation — Method
convolve_gray_rotation(xs, ys, vsini, u1)Convolve a spectrum with the Gray (2008) rotation kernel using linear limb darkening.
Arguments:
xs::AbstractVector{<:Real}: Wavelength grid.ys::AbstractArray{<:Real}: Spectrum onxs(vector or matrix with rows as spectra).vsini::Real: Projected rotational velocity.u1::Real: Linear limb-darkening coefficient.
Returns:
ys_out::AbstractArray{<:Real}: Convolved spectrum with the same shape asys.
See also: gray_rot_kernel
FormationTemps.convolve_hirano_rotmacro — Method
convolve_hirano_rotmacro(xs, ys, vsini, ζ_rt, u1, u2; intres=intres_glob)Convolve a spectrum with the Hirano et al. (2011) rotation+macroturbulence kernel.
Arguments:
xs::AbstractVector{<:Real}: Wavelength grid.ys::AbstractArray{<:Real}: Spectrum onxs(vector or matrix with rows as spectra).vsini::Real: Projected rotational velocity.ζ_rt::Real: Radial-tangential macroturbulence velocity scale.u1::Real: Linear limb-darkening coefficient.u2::Real: Quadratic limb-darkening coefficient.intres::Int=intres_glob: Quadrature resolution for the kernel integral.
Returns:
ys_out::AbstractArray{<:Real}: Convolved spectrum with the same shape asys.
See also: hirano_rotmacro_ft_kernel
FormationTemps.convolve_instrument_gauss — Method
convolve_instrument_gauss(xs, ys; new_res=1.17e5, oversampling=2.0)Convolve a spectrum with a Gaussian LSF at resolving power new_res. The output spectrum is resampled onto a new wavelength grid (evenly spaced in log-wavelength, i.e., velocity) at the specified oversampling factor.
Arguments:
xs::AbstractVector{<:Real}: Input wavelength grid.ys::AbstractVector{<:Real}: Input spectrum sampled onxs.new_res::Real=1.17e5: Target resolving power (λ/Δλ) for the Gaussian LSF.oversampling::Real=2.0: Oversampling factor for the output log-wavelength grid.
Returns:
xs_out::Vector{<:Real}: Output wavelength grid at the requested resolution.ys_out::Vector{<:Real}: Spectrum convolved with the Gaussian LSF and rebinned toxs_out.
See also: rebin_spectrum
FormationTemps.convolve_iso_rt_macro — Method
convolve_iso_rt_macro(xs, ys, ζ_rt)Convolve a spectrum with the isotropic radial-tangential macroturbulence kernel.
Arguments:
xs::AbstractVector{<:Real}: Wavelength grid.ys::AbstractArray{<:Real}: Spectrum onxs(vector or matrix with rows as spectra).ζ_rt::Real: Isotropic radial-tangential macroturbulence velocity scale.
Returns:
ys_out::AbstractArray{<:Real}: Convolved spectrum (orysifζ_rt == 0).
See also: gray_iso_rt_macro_kernel
FormationTemps.convolve_rt_macro — Method
convolve_rt_macro(xs, ys, ζ_rt, μ)
convolve_rt_macro(xs, ys, ζ_r, ζ_t, μ)Convolve a spectrum with a radial-tangential macroturbulence kernel.
Arguments:
xs::AbstractVector{<:Real}: Wavelength grid.ys::AbstractArray{<:Real}: Spectrum onxs(vector or matrix with rows as spectra).ζ_rt::Real: Radial-tangential macroturbulence velocity scale.μ::Real: Cosine of the angle between the local normal and the line of sight.
Returns:
ys_out::AbstractArray{<:Real}: Convolved spectrum (orysifζ_rt == 0).
See also: rt_macro_kernel
FormationTemps.elav — Method
elav(a::AbstractVector)
elav(a; dims)Compute midpoints between adjacent elements along dims.
FormationTemps.get_Ts — Method
get_Ts(atm)Return the temperature grid as a standard Array.
FormationTemps.get_marcs_atm — Method
get_marcs_atm(Teff, logg, A_X; n_layers=56)Interpolate a MARCS atmosphere from Korg and return it with n_layers layers.
FormationTemps.get_zs — Method
get_zs(atm)Return the height grid as a standard Array.
FormationTemps.get_τs — Method
get_τs(atm)Return the optical depth grid as a standard Array.
FormationTemps.gray_iso_rt_macro_kernel — Method
gray_iso_rt_macro_kernel(vs, ζ_rt)Compute the isotropic radial-tangential macroturbulence kernel from Gray (2008) (Eq. 17.8) assuming AR = AT and ζR = ζT.
Arguments:
vs::AbstractVector{<:Real}: Velocity grid centered on the line core.ζ_rt::Real: Isotropic radial-tangential macroturbulence velocity scale.
Returns:
kernel::Vector{<:Real}: Normalized macroturbulence kernel evaluated onvs.
FormationTemps.gray_rot_kernel — Method
gray_rot_kernel(vs, vsini, u1)Compute the Gray (2008) rotation broadening kernel (Eq. 18.14) with linear limb darkening.
Arguments:
vs::AbstractVector{<:Real}: Velocity grid centered on the line core.vsini::Real: Projected rotational velocity.u1::Real: Linear limb-darkening coefficient.
Returns:
kernel::Vector{<:Real}: Normalized rotation kernel evaluated onvs.
FormationTemps.hirano_rotmacro_ft_kernel — Method
hirano_rotmacro_ft_kernel(σs, vsini, ζ_rt; u1=0.43, u2=0.31, intres=intres_glob)Compute the Fourier transform of the Hirano et al. (2011) rotation+macroturbulence kernel (Eq. B12).
Arguments:
σs::AbstractVector{<:Real}: Frequency grid (inverse velocity units).vsini::Real: Projected rotational velocity.ζ_rt::Real: Radial-tangential macroturbulence velocity scale.u1::Real=0.43: Linear limb-darkening coefficient.u2::Real=0.31: Quadratic limb-darkening coefficient.intres::Int=intres_glob: Quadrature resolution for the kernel integral.
Returns:
Kσ::Vector{<:Real}: Fourier transform of the rotation+macroturbulence kernel.
FormationTemps.rebin_spectrum — Method
rebin_spectrum(xs_old, ys_old, xs_new)
rebin_spectrum(xs_old, ys_old, σs_old, xs_new)Rebin a spectrum (and optional uncertainties) from xs_old to xs_new.
Based on the SpectRes spectral resampling implementation: https://github.com/ACCarnall/SpectRes/blob/master/spectres/spectral_resampling.py
Note: the algorithm may introduce small shifts if the wavelength grids are misaligned.
FormationTemps.round_to_power — Method
round_to_power(x::Real)Round x to one significant digit based on its order of magnitude.
FormationTemps.rt_macro_kernel — Method
rt_macro_kernel(vs, ζ_r, ζ_t, μ)Compute the radial-tangential macroturbulence kernel from Gray (2008) (Eq. 17.6) assuming AR = AT.
Arguments:
vs::AbstractVector{<:Real}: Velocity grid centered on the line core.ζ_r::Real: Radial macroturbulence velocity scale.ζ_t::Real: Tangential macroturbulence velocity scale.μ::Real: Cosine of the angle between the local normal and the line of sight.
Returns:
kernel::Vector{<:Real}: Normalized macroturbulence kernel evaluated onvs.
FormationTemps.rt_macro_kernel — Method
rt_macro_kernel(vs, ζ_rt, μ)Compute the radial-tangential macroturbulence kernel from Gray (2008) (Eq. 17.6) assuming AR = AT and ξR = ξT.
Arguments:
vs::AbstractVector{<:Real}: Velocity grid centered on the line core.ζ_rt::Real: Radial-tangential macroturbulence velocity scale.μ::Real: Cosine of the angle between the local normal and the line of sight.
Returns:
kernel::Vector{<:Real}: Normalized macroturbulence kernel evaluated onvs.
FormationTemps.searchsortednearest — Method
searchsortednearest(a, x)
searchsortednearest(x, a)Return the index of the element in sorted vector a that is closest to x.
FormationTemps.vmac_fit — Method
vmac_fit(teff, logg)
vmac_fit(teff)Empirical macroturbulent velocity fits.
vmac_fit(teff, logg) uses the Doyle et al. (2014) relation with teff in K and logg in cgs. vmac_fit(teff) uses the Bruntt et al. (2010) relation with teff in K. Both return the macroturbulent velocity in m/s.
FormationTemps.vmic_fit — Method
vmic_fit(teff)Empirical microturbulent velocity fit from Bruntt et al. (2010).
Input teff is in K; returns microturbulent velocity in m/s.