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
lines = Korg.get_GALAH_DR3_linelist()
A_X = format_A_X(-1.1, Dict("C"=>-0.5))
atm = interpolate_marcs(5000.0, 4.32, A_X)
sol = synthesize(atm, lines, A_X, 5850, 5900);

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

image

You can also call Korg from python

See the documentation for setup instructions.

# imports
from juliacall import Main as jl
jl.seval("using Korg"); Korg = jl.Korg
from matplotlib import pyplot as plt

# synthesize spectrum
lines = Korg.get_GALAH_DR3_linelist()
A_X = Korg.format_A_X(-1.1, {"C": -0.5})
atm = Korg.interpolate_marcs(5000.0, 4.32, A_X)
sol = Korg.synthesize(atm, lines, A_X, 5850, 5900);

# plot
fig, ax = plt.subplots(figsize=(12, 4))
ax.plot(sol.wavelengths, sol.flux, "k-")
ax.set_xlabel("$\lambda$ [Å]")
ax.set_ylabel("$F_\lambda/R_\mathrm{star}^2$ [erg s$^{-1}$ cm$^{-5}$]")