Index

StellarSpectraObservationFitting.OrderModelMethod
OrderModel(d; kwargs...)

Constructor for the OrderModel-type objects (SSOF model for a set of 1D spectra)

Optional arguments

  • instrument::String="None": The name of the instrument(s) the data was taken from. For bookkeeping
  • order::Int=0: What order (if any) the data was taken from. For bookkeeping
  • star_str::String="None": The name of the star the data was taken from. For bookkeeping
  • n_comp_tel::Int=5: Amount of telluric feature vectors
  • n_comp_star::Int=5: The maximum amount of stellar feature vectors
  • oversamp::Bool=true: Whether or not to integrate the model or do linear interpolation (for the telluric model)
  • dpca::Bool=false: Whether to use Doppler-constrained PCA or variable interpolation location to determine the RVs
  • log_λ_gp_star::Real=1/SOAP_gp_params.λ: The log λ lengthscale of the stellar regularization GP
  • log_λ_gp_tel::Real=1/LSF_gp_params.λ: The log λ lengthscale of the telluric regularization GP
  • tel_log_λ::Union{Nothing,AbstractRange}=nothing: The log
  • star_log_λ::Union{Nothing,AbstractRange}=nothing: The log λ lengthscale of the telluric regularization GP
  • kwargs...: kwargs passed to Submodel constructors
source
ParameterHandling.flattenMethod
flatten([eltype=Real], x::LinearModel)

Returns a "flattened" representation of x::LinearModel as a vector of vectors and a function unflatten that takes a vector of reals of the same length and returns a LinearModel object

source
ParameterHandling.flattenMethod
flatten([eltype=Real], x::SubArray)

Returns a "flattened" representation of x::SubArray as a vector and a function unflatten that takes a vector of reals of the same length and returns an Array object

source
StellarSpectraObservationFitting.D_to_rvMethod
D_to_rv(D)

Approximately converting a Doppler shift D ≡ log(λ1/λ0) in log-wavelength space to an RV using (λ1-λ0)/λ0 = λ1/λ0 - 1 = e^D - 1 ≈ β = v / c (with an extra negative sign from somewhere)

source
StellarSpectraObservationFitting._spectra_interp_gp!Method
_spectra_interp_gp!(fluxes, log_λ, flux_obs, var_obs, log_λ_obs; gp_mean=0., gp_base=SOAP_gp, mask_flux=Array{Bool}(undef, length(flux_obs)), mask_var=Array{Bool}(undef, length(flux_obs)))

Use a GP to interpolate flux_obs observed at log_λ_obs onto log_λ

source
StellarSpectraObservationFitting.calculate_initial_modelMethod
calculate_initial_model(data; kwargs...)

Find a SSOF model for a given dataset, data. Defaults to returning the AIC-minimum model

Optional arguments

  • instrument::String="None": The name of the instrument(s) the data was taken from. For bookkeeping
  • desired_order::Int=0: What order (if any) the data was taken from. For bookkeeping
  • star::String="None": The name of the star the data was taken from. For bookkeeping
  • times::AbstractVector=1:size(data.flux, 2): The list of times (in days). Used to calculate intra-night RMS
  • μ_min::Real=0: Set the minimum flux value for the output of make_template()
  • μ_max::Real=Inf: Set the maximum flux value for the output of make_template()
  • use_mean::Bool=true: Whether to use the mean or median for make_template()
  • stop_early::Bool=false: Whether to stop the model search the first time adding a component increases the AIC
  • remove_reciprocal_continuum::Bool=false: Whether you should attempt to remove places where the telluric template and stellar template are opposing each other (i.e. where continuum goes up in one and down in the other)
  • return_full_path::Bool=false: Whether to return all of the searched models and metrics
  • max_n_tel::Int=5: The maximum amount of telluric feature vectors to look for
  • max_n_star::Int=5: The maximum amount of stellar feature vectors to look for
  • use_all_comps::Bool=false: Whether to use all feature vectors, regardless of AIC
  • careful_first_step::Bool=true: Whether to shrink the learning rates until the loss improves on the first iteration
  • speed_up::Bool=false: Whether to inflate the learning rates until the loss is no longer improving throughout the optimization
  • log_λ_gp_star::Real=1/SOAP_gp_params.λ: The log λ lengthscale of the stellar regularization GP
  • log_λ_gp_tel::Real=1/LSF_gp_params.λ: The log λ lengthscale of the telluric regularization GP
  • kwargs...: kwargs passed to OrderModel constructor
source
StellarSpectraObservationFitting.estimate_σ_bootstrapMethod
estimate_σ_bootstrap(mws; n=50, return_holders=false, recalc_mean=false, multithread=nthreads() > 3, verbose=true)

Estimate the uncertainties (and potentially covariances) for the RVs and scores in mws based on looking at the distribution of best-fit parameters after re-injecting photon noise. Slower than estimate_σ_curvature(), but more reliable.

source
StellarSpectraObservationFitting.estimate_σ_curvatureMethod
estimate_σ_curvature(mws; kwargs...)

Estimate the uncertainties for the RVs and scores in mws based on the local curvature of the loss function. Faster than estimate_σ_bootstrap(), but less reliable from ignoring cross terms in the Hessian.

source
StellarSpectraObservationFitting.eval_regularizationMethod
eval_regularization(reg_fields, reg_key, reg_val, mws, training_inds, testing_inds; kwargs...)

Setting regularizaiton values for a copy of mws.om then training it on the training data and evaluating _loss() on the testing data after optimizing the RVs and scores

source
StellarSpectraObservationFitting.first_iterate!Method
first_iterate!(l, l0, θs, θ, ∇θ, opt; ind=[], verbose=false)

Perform an ADAM optimization step based on the contents of opt on θ and decreases the learning rate to ensure the loss actually decreases

source
StellarSpectraObservationFitting.fit_regularization!Method
fit_regularization!(mws; verbose=true, testing_ratio=0.33, careful_first_step=true, speed_up=false, kwargs...)

Find the best fit model without regularization then fit all of the regularization values in key_list for the model in mws

source
StellarSpectraObservationFitting.fit_regularization_helper!Method
fit_regularization_helper!(reg_fields, reg_key, before_ℓ, mws, training_inds, testing_inds, test_factor, reg_min, reg_max; start=10e3, cullable=Symbol[], robust_start=true, thres=8, kwargs...)

Setting reg_key values in each Dict in mws.om.x (where x is each symbol in $reg_fields$) for a copy of mws.om then training it on the training data and evaluating _loss() on the testing data after optimizing the RVs and scores

source
StellarSpectraObservationFitting.gp_ℓ_nablaMethod
gp_ℓ_nabla(y, A_k, Σ_k; σ²_meas=_σ²_meas_def, H_k=H_k, P∞=P∞)

Getting the posterior likelihood that y is from a LTISDE described by A_k and Σ_k, equivalent to a GP. Same as gp_ℓ() but removing things that Nabla doesn't like

source
StellarSpectraObservationFitting.mask_telluric_feature!Method
mask_stellar_feature!(var, log_λ_obs, log_λ_star, log_λ_low, log_λ_high; verbose=true, include_bary_shifts=true, kwargs...)

Masking where log_λ_obs is between log_λ_low and log_λ_high. Can also perform in the stellar frame to prevent different lines from coming in at different times with include_bary_shifts

source
StellarSpectraObservationFitting.rv_to_DMethod
rv_to_D(v)

Approximately converting an RV to a Doppler shift D ≡ log(λ1/λ0) in log-wavelength space using (λ1-λ0)/λ0 = λ1/λ0 - 1 = e^D - 1 ≈ β = v / c (with an extra negative sign from somewhere)

source
StellarSpectraObservationFitting.train_OrderModel!Method
train_OrderModel!(mws; ignore_regularization=false, verbose=_verbose_def, shift_scores=true, μ_positive=true, tel_μ_lt1=false, rm_doppler=true, kwargs...)

Train the model in mws with some optional modifications to the optimization (ignoreregularization, shiftscore, μpositive, telμlt1, rmdoppler)

source
StellarSpectraObservationFitting.train_OrderModel!Method
train_OrderModel!(ow::OptimTelStarWorkspace; verbose=_verbose_def, iter=_iter_def, f_tol=_f_reltol_def, g_tol=_g_L∞tol_def, train_telstar=true, ignore_regularization=false, μ_positive=false, careful_first_step=true, speed_up=false, kwargs...)

Train the model in ow, training the telluric and stellar parameters, then the RVs

source
StellarSpectraObservationFitting.train_OrderModel!Method
train_OrderModel!(ow::OptimTelStarWorkspace; verbose=_verbose_def, iter=_iter_def, f_tol=_f_reltol_def, g_tol=_g_L∞tol_def, train_telstar=true, ignore_regularization=false, μ_positive=false, careful_first_step=true, speed_up=false, kwargs...)

Train the model in ow, training the telluric and stellar parameters, then the RVs

source
StellarSpectraObservationFitting.train_SubModel!Method
train_SubModel!(aws; iter=_iter_def, f_reltol=_f_reltol_def, g_reltol=_g_reltol_def, g_L∞tol=_g_L∞tol_def, cb=(as::AdamState)->(), careful_first_step=true, speed_up=false, kwargs...)

Train the model parameters in aws for up to iter Adam iterations until it converges based on check_converged()

source