# ThinFilmsTools packages Error: type TMMOptics has no field beam

**URL:** <https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535>\
**Category:** General Usage\
**Tags:** package\
**Created:** [August 9, 2022, 2:04pm UTC](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535 "2022-08-09T14:04:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![willliyg](https://avatars.discourse-cdn.com/v4/letter/w/439d5e/32.png) [@willliyg](https://discourse.julialang.org/u/willliyg)\
**Post date:** [August 9, 2022, 2:04pm UTC](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535/1 "2022-08-09T14:04:33Z")

</div>

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

ERROR: type TMMOptics has no field beam  
Stacktrace:  
[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.

Willliyg

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [August 9, 2022, 2:08pm UTC](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535/2 "2022-08-09T14:08:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![willliyg](https://avatars.discourse-cdn.com/v4/letter/w/439d5e/32.png) [@willliyg](https://discourse.julialang.org/u/willliyg)\
**Post date:** [August 9, 2022, 2:12pm UTC](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535/3 "2022-08-09T14:12:09Z")

</div>

Hi @ digital\_carver,

I am using the example given on the package wiki:

# Load modules

using Plots, LaTeXStrings  
pyplot()  
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)  
end

sol = main()

# plot the R, T and A spectra

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

# plot the refractive index profile

plot(RIprofile(), sol)  
gui()

---

<div class="post-metadata">

**Author:** ![willliyg](https://avatars.discourse-cdn.com/v4/letter/w/439d5e/32.png) [@willliyg](https://discourse.julialang.org/u/willliyg)\
**Post date:** [August 9, 2022, 2:12pm UTC](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535/4 "2022-08-09T14:12:46Z")

</div>

Here is the link of the code:

> <https://github.com/lnacquaroli/ThinFilmsTools.jl/blob/master/examples/arCoating.jl>

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [August 9, 2022, 5:41pm UTC](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535/5 "2022-08-09T17:41:19Z")

</div>

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