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
Main.BandPyrometry.Vander
— MethodVander(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
Main.BandPyrometry.box_constraints
— Methodbox_constraints(bp::BandPyrometryPoint)
Evaluates box-constraint of the problem
Main.BandPyrometry.denormalize_x
— Methoddenormalize_x(normalized_x::AbstractVector, x_min,x_max)
Creates normal vector from one created with @normalize_x function
Main.BandPyrometry.disc
— Methoddisc(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
Main.BandPyrometry.disc
— Methoddisc(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
Main.BandPyrometry.em_cons!
— MethodIn-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)
Main.BandPyrometry.emissivity!
— Methodemissivity!(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
Main.BandPyrometry.eval_poly
— MethodFunction to evaluate polynomials
Main.BandPyrometry.feval!
— Methodfeval!(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
Main.BandPyrometry.feval!
— Methodfeval!(e::EmPoint,t::Float64)
Evaluates bb intensity for temperature t
Main.BandPyrometry.fit_T!
— Methodfit_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)
Main.BandPyrometry.grad!
— Methodgrad!(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
Main.BandPyrometry.grad!
— Methodgrad!(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
Main.BandPyrometry.hess!
— Methodhess!(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
Main.BandPyrometry.hess!
— Methodhess!(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
Main.BandPyrometry.hess_approx!
— Methodhess_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
Main.BandPyrometry.jacobian!
— Methodjacobian!(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
Main.BandPyrometry.normalize_x
— Methodnormalize_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
Main.BandPyrometry.optimizer_switch
— Methodoptimizer_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)
Main.BandPyrometry.polyfit
— Methodpolyfit(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
Main.BandPyrometry.residual!
— Methodresidual!(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
Main.BandPyrometry.residual!
— Methodresidual!(e::EmPoint,t::Float64)
Evaluates the residual vector between calculated and measured bb thermal
emission intensity spectrum
Main.BandPyrometry.∇!
— Method∇!(t::Float64,e::EmPoint)
Fills the first derivative of Planck function
Input:
T - temperature
e - (modified) current bb thermal emission point
Main.BandPyrometry.∇²!
— Method∇²!(t::Float64,e::EmPoint)
Fills the second derivative of Planck function
Input:
T - temperature
e - (modified) current bb thermal emission point
Core.Union
— Method(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
Main.BandPyrometry.BandPyrometryPoint
— Type 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)
Main.BandPyrometry.EmPoint
— TypeEmPoint 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)
Main.BandPyrometry.VanderMatrix
— TypeVanderMatrix(λ,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