API reference

General reference

SpectralFitting.Reflection.add_objective_reduction!Method
add_objective_reduction!(ra::CompositeAggregation, op::Symbol)

Reduces the current objective count and applies the reduction operation op to them. For example, if op is :+, and the objective count is 3, then after this function has been called the objective count will be 2 and the reduction expression

@. flux2 = flux2 + flux3

will have been added to the CompositeAggregation.

source
SpectralFitting.Reflection.assemble_objective_unpackMethod
assemble_objective_unpack(N)

Assembles the statements for unpacking the objective cache into a number of views. Assembles the part of the model call that looks like:

objective1 = view(objectives, :, 1), objective2 = ...

for N objectives slices.

source
SpectralFitting.Reflection.make_constructorMethod
make_constructor(model::Type{<:AbstractSpectralModel}, closures::Vector, params::Vector, T::Type)

Create a constructor expression for the model. Should return something similar to

:(PowerLaw{T}(arg1, arg2, arg3)))

unpacking the closures and params vectors in the appropriate places.

source
SpectralFitting.Reflection.CompositeModelInfoType
struct CompositeModelInfo
    "The parameter symbols of the model with the respective lens to the actual parameter."
    parameter_symbols::Vector{Pair{Symbol,Lens}}
    "Each model assigned to a unique symbol."
    models::Vector{Pair{Symbol,ModelInfo}}
    "The expression representing the folding operations of this composite model."
    model_expression::Expr
    "Constructor and objective folding expressions, used in generating the invocation call."
    expressions::Vector{Expr}
    "The maximum number of objective caches this model will need."
    maximum_objective_cache_count::Int
    "How many objective caches are currently active."
    objective_cache_count::Int
end

The composite equivalent of ModelInfo, augmented to track the model symbol (a1, m3, etc.), and the model parameters (K_1, a_3, etc.)

source
SpectralFitting.Reflection.ModelInfoType
struct ModelInfo
    "All parameter symbols for the model."
    symbols::Vector{Symbol}
    "Unique symbols generated for the parameter assignment when buildin the function call."
    generated_symbols::Vector{Symbol}
    "Additional closure parameters that need to be handled when invoking the model."
    closure_symbols::Vector{Symbol}
    "Unique closure generated symbols."
    generated_closure_symbols::Vector{Symbol}
    "The lens that takes you to this model from some parent."
    lens::Lens
    "The model type itself."
    model::Type
end

All models are parsed into a ModelInfo struct relative to their parent (in the case of composite models).

The symbols field contains all of the model parameter symbols as they are in the structure, not as they have been generated. Recall when the invocation expressions are generated, we create anonymous paramter names to avoid conflicts. These are the generated_symbols instead.

source