Skip to content

Instantly share code, notes, and snippets.

@bodokaiser
Created June 28, 2023 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bodokaiser/191c659a4281fc336a93be012cbdc94a to your computer and use it in GitHub Desktop.
Save bodokaiser/191c659a4281fc336a93be012cbdc94a to your computer and use it in GitHub Desktop.
Refractive indices for fused silica using the Sellmeier equation
### A Pluto.jl notebook ###
# v0.19.24
using Markdown
using InteractiveUtils
# ΓòöΓòÉΓòí ec26df3c-14b8-11ee-282f-c51a3afd5185
begin
using Unitful
using Statistics
end
# ΓòöΓòÉΓòí 2e0e1698-263a-4d80-b4a6-daaba2a67993
struct SellmeierCoefficients{T1<:Float64,T2<:Unitful.Area}
B::Vector{T1}
C::Vector{T2}
end
# ΓòöΓòÉΓòí 65d41a78-568a-4c63-9be3-f6e899343368
function refractive_index(sm::SellmeierCoefficients, ╬╗::Unitful.Length)
"""
Sellmeier equation for calculating refractive index.
https://en.wikipedia.org/wiki/Sellmeier_equation
"""
#@assert length(sm.B) == length(sm.C) "Number of Sellmeier coefficients should be equal"
return sqrt(1 + sum(sm.B .* ╬╗^2 ./ (╬╗^2 .- sm.C)))
end
# ΓòöΓòÉΓòí f771de1e-4f7f-4870-a111-65f9e4995de5
fused_silica = SellmeierCoefficients(
[0.696166300, 0.407942600, 0.897479400],
[4.67914826e-3u"╬╝m^2", 1.35120631e-2u"╬╝m^2", 97.9340025u"╬╝m^2"],
)
# ΓòöΓòÉΓòí 79b83f24-fd9e-4c47-9796-72219d88b4e6
wavelengths = [
302u"nm",
#399u"nm",
#556u"nm",
578u"nm",
649u"nm",
1389u"nm",
]
# ΓòöΓòÉΓòí d4d47b38-5da3-49a5-9e63-0ebb4db76aaf
refractive_index.(Ref(fused_silica), wavelengths)
# ΓòöΓòÉΓòí 7c642eff-2939-4494-81ee-682692f99e29
mean(refractive_index.(Ref(fused_silica), wavelengths))
# ΓòöΓòÉΓòí 58aaf4a0-9310-4773-b13e-b8c7b2bc271e
refractive_index(fused_silica, 556u"nm")
# ΓòöΓòÉΓòí 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[compat]
Unitful = "~1.14.0"
"""
# ΓòöΓòÉΓòí 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.8.5"
manifest_format = "2.0"
project_hash = "d73274217701f87793657d7eb6522f21aeafc39c"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.1+0"
[[deps.ConstructionBase]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "738fec4d684a9a6ee9598a8bfee305b26831f28c"
uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
version = "1.5.2"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[deps.LinearAlgebra]]
deps = ["Libdl", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.20+0"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[deps.Random]]
deps = ["SHA", "Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
version = "0.7.0"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[deps.SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[deps.Unitful]]
deps = ["ConstructionBase", "Dates", "LinearAlgebra", "Random"]
git-tree-sha1 = "ba4aa36b2d5c98d6ed1f149da916b3ba46527b2b"
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
version = "1.14.0"
[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl", "OpenBLAS_jll"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.1.1+0"
"""
# ΓòöΓòÉΓòí Cell order:
# ΓòáΓòÉec26df3c-14b8-11ee-282f-c51a3afd5185
# ΓòáΓòÉ2e0e1698-263a-4d80-b4a6-daaba2a67993
# ΓòáΓòÉ65d41a78-568a-4c63-9be3-f6e899343368
# ΓòáΓòÉf771de1e-4f7f-4870-a111-65f9e4995de5
# ΓòáΓòÉ79b83f24-fd9e-4c47-9796-72219d88b4e6
# ΓòáΓòÉd4d47b38-5da3-49a5-9e63-0ebb4db76aaf
# ΓòáΓòÉ7c642eff-2939-4494-81ee-682692f99e29
# ΓòáΓòÉ58aaf4a0-9310-4773-b13e-b8c7b2bc271e
# ΓòƒΓöÇ00000000-0000-0000-0000-000000000001
# ΓòƒΓöÇ00000000-0000-0000-0000-000000000002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment