Functions and type to fit the temperature of blackbody and real surface thermal emission

This Module introduces two main types: - EmPoint for blackbody thermal emission - BandPyrometryPoint for real surface (with spectrally dependent emissivity) This types can be used to solve the least-square optimization problm to fit the temperature and spectral emissivity

Base.:*Method
*(V::VanderMatrix,a::AbstractVector)

VanderMatrix object can be directly multiplyed by a vector
source
Main.BandPyrometry.VanderMethod
Vander(x::AbstractArray, poly_degree::Number;poly_type::String="stand")

Creates VanderMatrix object of predefied type, all supported polynomial type can 
be found in @supported_polynomial_types
source
Main.BandPyrometry.discMethod
disc(x::AbstractVector,bp::BandPyrometryPoint)

Fills emissivity, thermal emission spectrum,evaluates the residuals vector
and calculates its norm for the current BandPyrometry point
Input:
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature 
    bp - (modified) current spectral band pytometry point
source
Main.BandPyrometry.discMethod
disc(T,e::EmPoint)

Evaluates the least-square discrepancy between measured and calculates spectra
Input:
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature 
    e - (modified) current bb thermal emission point
source
Main.BandPyrometry.em_cons!Method
In-place filling of two-elemnt vector of [minimum,maximum] emissivity in the whole 
wavelength range  
This function is used in the constraints
Inputs:
    constraint_value - (modified)  two-element vector to be modified in-place
    x - optimization variables vector, x=[a1...an,T], where a1...an - emissivity approximations coefficients, T  - temperature 
    bp - (modified)
source
Main.BandPyrometry.emissivity!Method
emissivity!(bp::BandPyrometryPoint,x::AbstractVector)


Fills emissivity for the current BandPyrometry point
Input:
    bp - (modified) current spectral band pytometry point
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature
source
Main.BandPyrometry.feval!Method
feval!(bp::BandPyrometryPoint,x::AbstractVector)

Fills both the emissivity and the thermal emission spectrum for the current BandPyrometry point
Input:
    bp - (modified) current spectral band pytometry point
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature
source
Main.BandPyrometry.fit_T!Method
fit_T!(point::Union{EmPoint,BandPyrometryPoint};
    optimizer_name="Default",is_constraint::Bool=false,
    is_lagrange_constraint::Bool=false)

    Input:
        point - (modified) real suraface (BandPyrometryPoint) of blackbody thermal emission object
        (optional)
        optimizer_name - the name of optimizer must be the key of optim_dic
        is_constraint - is box-constraint flag
        is_lagrange_constraint - is Lagrange-constraint flag
    Returns:
        if the point type is EmPoint, the output is:
            named tuple with (T - fitted temperature,
                                res - optimization output object,
                                optimizer - chosen optimizer)
        if the point is of the BandPyrometryPoint type, the output is:
            named tuple with (T - fitted temperature ,a - fitted emissivity approximation coefficients,
                                ϵ - emissivity spectrum in the whole wavelemgth range,
                                res - optimization output object,
                                optimizer - chosen optimizer)
source
Main.BandPyrometry.grad!Method
grad!(g::AbstractVector,x::AbstractVector,bp::BandPyrometryPoint)

In-place filling of the gradient vector of BandPyrometryPoint at point x
Input:
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature
    bp - (modified, recalculates residual vector and Jacobian if the 
    currently stored value was obtaibed for another optimization variables array)
    current spectral band pytometry point
source
Main.BandPyrometry.grad!Method
grad!(g::AbstractVector,t::Float64 ,e::EmPoint)

In-place filling of the gradient of least-square problem of bb thermal emission spectrum fitting 
Input:
    g - gradient vector to be filled
    t  - temperature 
    e - (modified) current bb thermal emission ppoint
source
Main.BandPyrometry.hess!Method
hess!(h,x::AbstractVector,bp::BandPyrometryPoint)

In-place filling of the whole hessian matrix for BandPyrometryPoint at point x
Input:
    ha - Hessian matrix to be filled in-place
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature
    bp - (modified) current spectral band pytometry point
source
Main.BandPyrometry.hess!Method
hess!(h,t::Float64,e::EmPoint)

In-place filling of least-square problem hessian matrix 
    Input:
        h - hessian 
        T - temperature 
        e - (modified) current bb thermal emission point
source
Main.BandPyrometry.hess_approx!Method
hess_approx!(ha, x::AbstractVector,bp::BandPyrometryPoint)

In-place filling of the approximate hessian (Hₐ = Jᵀ*J (J - Jacobian)) 
of BandPyrometryPoint at point vector x, approximate Hessian can be used 
in optimization methods to approximate the full Hessian (e.g. in Gauss-Newton
or Levenberg-Marquardt methods)
Input:
    ha - Hessian matrix to be filled in-place
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature
    bp - (modified) current spectral band pytometry point
source
Main.BandPyrometry.jacobian!Method
jacobian!(x::AbstractVector,bp::BandPyrometryPoint)

Fills the Jacobian matrix for current bandpyrometry point
Input:
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature
    bp - (modified, stores Jacobian internally) current spectral band pytometry point
source
Main.BandPyrometry.normalize_xMethod
normalize_x(x::AbstractVector)

Makes all elements of vector x to fit in range -1...1
returns normalized vector , xmin and xmax values
All elements of x must be unique
source
Main.BandPyrometry.optimizer_switchMethod
optimizer_switch(name::String;is_constraint::Bool=false,
            is_lagrange_constraint::Bool=false)
Returns the appropriate optimizer constructor
Input:
    name - the name of th eoptimizer, 
    is_constraint - is box constraint problem formulation, 
    is_lagrange_constraint - use Lagrange constraints (supported only by IPNewton)
source
Main.BandPyrometry.polyfitMethod
polyfit(V::VanderMatrix,x::T,y::T) where T<:AbstractVector

Fits data x - coordinates, y - values using the VanderMatrix
basis function

Input:
    x - coordinates, [Nx0]
    y - values, [Nx0]
returns tuple with vector of polynomial coefficints, values of y_fitted at x points
    and the norm of goodness of fit
source
Main.BandPyrometry.residual!Method
residual!(bp::BandPyrometryPoint,x::AbstractVector)

Fills emissivity, thermal emission spectrum
and evaluates the residuals vector for the current BandPyrometry point
Input:
    bp - (modified) current spectral band pytometry point
    x - optimization variables vector, x=[a1...an,T],
    where a1...an - emissivity approximations coefficients, T  - temperature
source
Main.BandPyrometry.residual!Method
residual!(e::EmPoint,t::Float64)

Evaluates the residual vector between calculated and measured bb thermal 
emission intensity spectrum
source
Main.BandPyrometry.∇!Method
∇!(t::Float64,e::EmPoint)

Fills the first derivative of Planck function 
Input:
    T  - temperature 
    e - (modified) current bb thermal emission point
source
Main.BandPyrometry.∇²!Method
∇²!(t::Float64,e::EmPoint)

Fills the second derivative of Planck function 
    Input:
        T  - temperature 
        e - (modified) current bb thermal emission point
source
Core.UnionMethod

(poly::Union{LegPolyWrapper,TrigPoly})(x::Number)

Function returns the summation of polynomials values with coefficients 
LegPolyWrapper wraps the LegendrePolynomials.jl library function to 
make it consistent with Polynomials.jl 
TrigPoly simple type for trigonometric function polynomils
source
Main.BandPyrometry.BandPyrometryPointType
    BandPyrometryPoint type stores data of thermal emission spectrum of a real body with 
    emissivity polynomial approximation, and  its first and second derivatives
    it also stores "measurements" vector which further can be fitted, it also 
    provides the constructor BandPyrometryPoint(I_measured,λ,initial_x,polynomial_type) 
    where:
        -  I_measured is a measured spectrum
        -  λ - wavelength vector (in μm)
        - initial_x - starting parameters vector (initial_x[end] - starting temperature,
            x[1:end-1] - emissivity approximation coefficients)
        - polynomial_type - string of polynomial (this value governs the Vandermonde matrix form)
source
Main.BandPyrometry.EmPointType

EmPoint type stores data on thermal emission spectrum and its first and second derivatives it also stores "Measurements " vector which further can be fitted? it also provides the constructor EmPoint(Imeasured,λ) - Imeasured is a measured spectrum - λ - wavelength vector (in μm)

source
Main.BandPyrometry.VanderMatrixType
VanderMatrix(λ,polynomial_degree,MatrixType,polynomial_type)

This type stores the Vandemonde matrix (fundamental matrix of basis functions),
supports various types of internal polynomials including provided externally
Structure VanderMatrix has the following fields:
    v - the matrix itself (each column of this matrix is the value of basis function)
    x_first -  first element of the initial vector 
    x_last  -  the last value of the initial vector
    xi - normalized vector 
    poly_type  - string of polynomial type name (nothing depends on this name)
    poly_constructor  - the constructor of the polynomial object, accepts the value of 
        polynomial coefficients and returns a callable object to evaluate the obtained 
        polynomial at a praticular point. V-matrix is filled by first creating the polynomial 
        obj with only one non-zero polynomial coefficient and then sending the values of xi
        to the created object
source