Skip to content

Example: Fit single layer transmittance spectrum

Leandro Acquaroli edited this page Nov 28, 2019 · 6 revisions

In this example, we will fit the transmittance spectrum of a scandium oxide thin film coating atop a fused silica UV graded glass substrate. The light hits the air medium, then the oxide film and finally passes through the substrate.

The complete code can be found here.

Load modules

using Optim
using Plots
pyplot()
using ThinFilmsTools

Light source

# Wavelength range [nm]
λ = 200:1100
# Angle of incidence [degrees]
θ = [0.]
# Polarisation (1.0 = p, 0.0 = s, between 0.0 and 1.0 = average)
pol = 0.5
beam = PlaneWave(λ, θ; p=pol)

System of layers

We define the layers as the incident medium to be air and the substrate is fused silica, with the indices of refraction from the database. We model the layer with the Forouhi-Bloomer model.

incident = RIdb.air(beam.λ)
emergent = RIdb.fused_silica_uv(beam.λ)

layers = [
   LayerTMMO(incident),
   ModelFit(:forouhibloomer),
   LayerTMMO(emergent),
]

Measured absolute transmittance

Get the transmittance spectrum from the spectra database.

Texp = SpectraDB.scandia_spectrum(beam.λ)

Optimisation

options = Optim.Options(
   g_abstol=1e-8, g_reltol=1e-8, iterations=10^5, show_trace=true, store_trace=false,
);

One oscillator

seed = [vcat(95.0, # thickness
             [1.6, 5.0, # ϵinf, Eg
              0.15, 16, 65, # A1, B1, C1 for oscillator 1
             ], 
        ),
]

solOptim = fit_tmm_optics(
    Transmittance(Texp), seed, beam, layers;
    options=options, alg=LBFGS(),
)

plot(FitSpectrum(),
    solOptim.beam.λ, solOptim.spectrumExp, solOptim.spectrumFit,
    xaxis=("Wavelength [nm]"), yaxis=("Transmittance"),
)
gui()

Fit results

The results are as follow:

julia> solOptim.optParams
1-element Array{Array{Float64,1},1}:
  [90.88655754983442, 
   1.66146996602935, 4.46759332648431, 
   0.1259720051120285, 16.050999236624072, 65.05502550184274]

julia> solOptim.objfunMin
5.3174022618089364e-5
Clone this wiki locally