Compute Barklem σ and α for an sp transition.


  • E_cont: continuum energy (upper continuum of the stage)
  • Elevs: s level energy
  • Elevp: p level energy
  • Z: atomic charge + 1

Parses level energy field from NIST tables. Brackets (round or square) indicate interpolated or theoretical values. Converts from wavenumber to energy.

get_atomic_stage(element::String, stage; source="NIST")

Returns the level structure for a given atomic stage for element and ionisation stage stage. Uses data from the given source, returns an AtomicStage struct. Currently, the only supported source is "NIST", using locally-saved data obtained from the NIST Atomic Spectra Database Levels Form.


julia> MgII = get_atomic_stage("Mg", "II")
AtomicStage("Mg", "Mg_II", 2, II, 137, (...))

julia> MgII = get_atomic_stage("Mg", 2)
AtomicStage("Mg", "Mg_II", 2, II, 137, (...))
function get_solar_abundances(;source="AAG2021")

Gets a dictionary with element names and their solar photospheric abundances. Can read from multiple sources. Currently supported are:

  • "AAG2021"`, from Asplund, Amarsi, & Grevesse 2021, A&A, 653, A141
  • "AAGS2009", from Asplund, Grevesse, Sauval, & Scott 2009, ARA&A, 47, 481
  • "GS1998", from Grevesse & Sauval 1998, Space Science Reviews, 85, 161-174
n_eff(energy_upper::Unitful.Energy, energy_lower::Unitful.Energy, Z::Integer)

Compute the effective principal quantum number for a given energy difference and atomic charge, Z= atomic charge + 1 (ie, 1 for neutral, 2 for singly ionised). energy_upper is the ionisation energy for the given stage.

    g::Array{<: Real}, χ::Array{<: Unitful.Energy, 1}, temp::Unitful.Temperature
partition_function(data::AtomicStage, temp::Unitful.Temperature)

Calculate partition function from a set of levels defined by arrays of statistical weights and energies (or an AtomicStage struct), for a given temperature.

    atom::AtomicStage, temperatures::Array{<: Unitful.Temperature},
    element::String, stage, temperatures::Array{<: Unitful.Temperature};

Returns an interpolator for the partition function of a given atomic stage.


  • atom: an AtomicStage structure with the data for the given stage
  • temperatures: array with temperatures used to build the interpolation table


  • interpolator: linear interpolator object that takes temperature to give partition function

Reads abundance file and converts to a dictionary with symbols for element names. Also converts abundances to linear scale, from usual log scale (relative to hydrogen). Source file must be YAML formatted, following the format of files under data/solar_abundances/*yaml