Skip to content
Snippets Groups Projects
Verified Commit 22450031 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Add example and restructure

parent fa6359a7
No related branches found
No related tags found
No related merge requests found
Pipeline #51093 failed
......@@ -14,7 +14,7 @@ makedocs(;
pages = [
"Home" => "index.md",
"Examples" => Any[
"examples/an_example.md",
"examples/directlightfrommuon.md",
],
"API" => "api.md"
],
......
# An example
The following function determines the meaning of life.
```@example usage
using LumenManufaktur
meaningoflife()
```
Examples with the same "tag" (like `usage` above) share the same Julia
process, so that everything is in the same scope. The package is therefore already
imported, so we can determine the meaning of life again `;)`
```@example usage
meaningoflife()
```
# Direct light from muon
The following example demonstrates how to calculate the number of photoelectrons
for a given environment and PMT.
```@example directlightfrommuon
using LumenManufaktur
```
Let's create the parameters with the defaults but override the dispersion model
with the one used in KM3NeT ORCA detectors in the Mediterranean:
```@example directlightfrommuon
params = LMParameters(dispersion_model=DispersionORCA)
```
To calculate the number of photoelectrons from direct light induced by a muon at
the closest distance of `R=23.5`, with a standard KM3NeT PMT pointing in the
direction of `θ=π` and `ϕ=π/2`, we call `directlightfrommuon()`:
```@example directlightfrommuon
directlight(params, LumenManufaktur.PMTKM3NeT, 23.5, π, π/2)
```
......@@ -3,10 +3,11 @@ module LumenManufaktur
using BasicInterpolators
using FastGaussQuadrature
include("dispersion.jl")
#include("scattering.jl")
#include("absorption.jl")
include("exports.jl")
abstract type MediumProperties end
abstract type DispersionModel end
abstract type ScatteringModel end
abstract type AbsorptionModel end
......@@ -64,25 +65,6 @@ const KM3NeTPMT = PMTModel(
)
"""
Light dispersion for water in deep sea based on David J.L. Bailey's work: "Monte Carlo
tools and analysis methods for understanding the ANTARES experiment and
predicting its sensitivity to Dark Matter" - PhD thesis, University of Oxford,
United Kingdom, 2002.
"""
Base.@kwdef struct BaileyDispersion <: DispersionModel
P::Float64 = 1 # ambient pressure [atm]
a0::Float64 = 1.3201 # offset
a1::Float64 = 1.4e-5 # dn/dP
a2::Float64 = 16.2566 # d^1n/(dx)^1
a3::Float64 = -4383.0 # d^2n/(dx)^2
a4::Float64 = 1.1455e6 # d^3n/(dx)^3
end
BaileyDispersion(P) = BaileyDispersion(P=P)
const DispersionORCA = BaileyDispersion(240)
const DispersionARCA = BaileyDispersion(350)
Base.@kwdef struct LMParameters{D<:DispersionModel, S<:ScatteringModel, A<:AbsorptionModel}
minimum_distance::Float64 = 1.0e-1
lambda_min::Float64 = 300.0
......@@ -102,13 +84,6 @@ function Base.show(io::IO, p::LMParameters)
print(io, " absorption model = $(p.absorption_model)")
end
@inline function refractionindexphase(dp::BaileyDispersion, λ)
x = 1.0 / λ
dp.a0 + dp.a1*dp.P + x*(dp.a2 + x*(dp.a3 + x*dp.a4))
end
@inline function refractionindexgroup(dp::BaileyDispersion, λ)
error("Not implemented yet")
end
const absorptionlengthinterpolator = LinearInterpolator(
[0, 290, 310, 330, 350, 375, 412, 440, 475, 488, 510, 532, 555, 650, 676, 715, 720, 999999],
......
abstract type DispersionModel end
"""
Light dispersion model for water in deep sea based on David J.L. Bailey's work:
"Monte Carlo tools and analysis methods for understanding the ANTARES experiment
and predicting its sensitivity to Dark Matter" - PhD thesis, University of
Oxford, United Kingdom, 2002.
"""
Base.@kwdef struct BaileyDispersion <: DispersionModel
P::Float64 = 1 # ambient pressure [atm]
a0::Float64 = 1.3201 # offset
a1::Float64 = 1.4e-5 # dn/dP
a2::Float64 = 16.2566 # d^1n/(dx)^1
a3::Float64 = -4383.0 # d^2n/(dx)^2
a4::Float64 = 1.1455e6 # d^3n/(dx)^3
end
BaileyDispersion(P) = BaileyDispersion(P=P)
const DispersionORCA = BaileyDispersion(240)
const DispersionARCA = BaileyDispersion(350)
@inline function refractionindexphase(dp::BaileyDispersion, λ)
x = 1.0 / λ
dp.a0 + dp.a1*dp.P + x*(dp.a2 + x*(dp.a3 + x*dp.a4))
end
@inline function refractionindexgroup(dp::BaileyDispersion, λ)
error("Not implemented yet")
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment