From 403724f10e644bdc616e85ebeaed5c0ce1c84034 Mon Sep 17 00:00:00 2001 From: Adam Wheeler Date: Thu, 7 Nov 2024 15:19:09 -0500 Subject: [PATCH] interface tweaks --- src/abundances.jl | 3 +++ src/synth.jl | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/abundances.jl b/src/abundances.jl index 49491fab..93591f97 100644 --- a/src/abundances.jl +++ b/src/abundances.jl @@ -49,6 +49,9 @@ function format_A_X(default_metals_H::R1=0.0, default_alpha_H::R2=default_metals # make sure the keys of abundances are valid, and convert them to Z if they are strings clean_abundances = Dict{UInt8,V}() for (el, abund) in abundances + if el isa Symbol + el = string(el) + end if el isa AbstractString if !(el in keys(Korg.atomic_numbers)) throw(ArgumentError("$el isn't a valid atomic symbol.")) diff --git a/src/synth.jl b/src/synth.jl index 705fe7a0..e123ad1a 100644 --- a/src/synth.jl +++ b/src/synth.jl @@ -8,15 +8,12 @@ function synth(; rectify=true, R=Inf, vsini=0, - kwargs...,) - # if a keyword argument is an atomic symbol, it is assumed to be an abundance - # otherwise, it is passed to synthesize - abunds_set = [k for k in keys(kwargs) if k in atomic_symbols] - - A_X = format_A_X(metals_H, alpha_H, Dict(k => kwargs[k] for k in abunds_set)) + synthesize_kwargs=Dict(), + abundances...,) + A_X = format_A_X(metals_H, alpha_H, abundances) atm = interpolate_marcs(Teff, logg, A_X) - synthesize_kwargs = [k => kwargs[k] for k in keys(kwargs) if !(k in abunds_set)] + # synthesize kwargs currently must be symbols, which is annoying spectrum = synthesize(atm, linelist, A_X, wavelengths; synthesize_kwargs...) flux = if rectify spectrum.flux ./ spectrum.cntm @@ -24,6 +21,7 @@ function synth(; spectrum.flux end if isfinite(R) + # TODO this induces edge effects flux = apply_LSF(flux, spectrum.wavelengths, R) end if vsini > 0