ThinFilmsTools packages Error: type TMMOptics has no field beam

When using the ThinFilmsTools.jl to run these examples, I always get an error of:

ERROR: type TMMOptics has no field beam
[1] getproperty(x::TMMOptics{ThinFilmsTools.TransferMatrixMethod.Spectra{Float64, ComplexF64}, ThinFilmsTools.TransferMatrixMethod.Field{Any}, ThinFilmsTools.TransferMatrixMethod.Bloch{Any, Any}, ThinFilmsTools.TransferMatrixMethod.Misc{Float64, ComplexF64}, ThinFilmsTools.TransferMatrixMethod.AdmPhase{ComplexF64}, PlaneWave{Float64, Float64, Float64}, LayerTMMO{ComplexF64, Symbol, Float64, Float64}}, f::Symbol)
@ Base .\Base.jl:42
[2] top-level scope
@ Untitled-1:22

Any solution/suggestion to solve this?

Many thanks.


Hi @willliyg! Which specific examples are you trying to run? Can you post the code that leads to this error for you?

Hi @ digital_carver,

I am using the example given on the package wiki:

Load modules

using Plots, LaTeXStrings
using ThinFilmsTools

function main()
# Define beam
λ = LinRange(400,1000,600) # wavelength range [nm]
θ = [0.] # angle of incidence [degrees]
beam = PlaneWave(λ,θ)
# Define layers with their parameters
n = [RIdb.air(beam.λ) RIdb.silicon(beam.λ)]
p1 = 0.89
p2 = 0.70
p3 = 0.41
layers = [
LayerTMMO(n[:,1]), # incident medium
LayerTMMO(RI.looyenga([p1 1-p1],n); d=77.),
LayerTMMO(RI.looyenga([p2 1-p2],n); d=56.),
LayerTMMO(RI.looyenga([p3 1-p3],n), d=39.),
LayerTMMO(n[:,2]), # emergent (substrate) medium
# solve
return tmm_optics(beam, layers)

sol = main()

plot the R, T and A spectra

[sol.Spectra.Rp, sol.Spectra.Tp, 1.0 .- (sol.Spectra.Rp .+ sol.Spectra.Tp)],
label=[“Reflectance” “Transmittance” “Absorbance”],
line=([:solid :dash :dashdot]),

plot the refractive index profile

plot(RIprofile(), sol)

Here is the link of the code:

Just a very small typo: In the first plot call, after Spectrum1D(), the second argument should be sol.Beam.λ instead of sol.beam.λ.