Skip to content

ajwheeler/Korg.jl

Repository files navigation

Documentation Tests codecov Aqua QA

Code papers (please cite these if you use Korg):

Tutorials:

Example

using Korg, PyPlot

wls, flux, continuum = synth(
    Teff=5000, # effective temperature of 5000 Kelvin
    logg=4.32, # surface gravity of 10^(4.32) cm/s²
    m_H=-1.1,  # metallicity, [m/H]. Overridden for individual elements by alpha_H and individual abundances
    C=-0.5,    # The Carbon abundance, [C/H].  Works for anything from He to U.
    linelist=Korg.get_GALAH_DR3_linelist(),
    wavelengths=(5850, 5900)
)

# plot
figure(figsize=(12, 4))
plot(wls, flux, "k-")
xlabel(L"$\lambda$ [Å]")
ylabel(L"$F_\lambda/R_\mathrm{star}^2$ [erg s$^{-1}$ cm$^{-5}$]");

See the documentation for synth, or the documentation for synthesize for advanced usage.

image

You can also call Korg from python

See the documentation for setup instructions.

from juliacall import Main as jl
jl.seval("using Korg"); Korg = jl.Korg

# calling Korg.synth is exactly the same as in Julia.
wls, flux, continuum = Korg.synth(
    Teff=5000,
    logg=4.32,
    m_H=-1.1,
    C=-0.5,
    linelist=Korg.get_GALAH_DR3_linelist(),
    wavelengths=(5850, 5900)
)

Multithreading

Korg can use multithreading to speed up line opacity calculation, the most epxensive step for for syntheses. To use it launch Julia with more than one thread, using the -t command-line argument, or by setting the $JULIA_NUM_THREADS environment variable.

About

fast 1D LTE stellar spectral synthesis

Resources

License

Stars

Watchers

Forks

Contributors 10

Languages