-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into compathelper/new_version/2023-07-11-19-07-14…
…-916-01957477830
- Loading branch information
Showing
20 changed files
with
1,479 additions
and
224 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
module ScatteringOptics | ||
|
||
# Import Modules | ||
using Bessels | ||
import ComradeBase: | ||
AbstractModel, IsPrimitive, IsAnalytic, NotAnalytic, | ||
IsPolarized, NotPolarized, | ||
visanalytic, imanalytic, isprimitive, ispolarized | ||
using DocStringExtensions | ||
using EHTUtils: mas2rad | ||
using HypergeometricFunctions | ||
using SpecialFunctions | ||
using NonlinearSolve | ||
using QuadGK | ||
using SpecialFunctions | ||
|
||
# kζ finders | ||
include("./kzetafinders/abstractkzetafinder.jl") | ||
include("./kzetafinders/dipole.jl") | ||
include("./kzetafinders/periodicboxcar.jl") | ||
include("./kzetafinders/vonmises.jl") | ||
|
||
# scattering models: general defenitions | ||
include("./scatteringmodels/commonfunctions.jl") | ||
include("./scatteringmodels/abstractscatteringmodel.jl") | ||
|
||
#k finders | ||
include("./kfinders/abstractkfinder.jl") | ||
include("./kfinders/kfinder.jl") | ||
# scattering kernels | ||
include("./scatteringmodels/kernels/abstract.jl") | ||
include("./scatteringmodels/kernels/approx.jl") | ||
include("./scatteringmodels/kernels/exact.jl") | ||
include("./scatteringmodels/kernels/kernelmodel.jl") | ||
|
||
#scattering kernels | ||
include("./scatteringkernels/abstractscatteringkernel.jl") | ||
include("./scatteringkernels/phasestructure.jl") | ||
# implementation of specific models | ||
include("./scatteringmodels/models/dipole.jl") | ||
include("./scatteringmodels/models/periodicboxcar.jl") | ||
include("./scatteringmodels/models/vonmises.jl") | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
AbstractKzetaFinder | ||
This is an abstract data type to set up equations and provide a solver for the concentration parameter k_ζ | ||
for an anistropic interstellar scattering model. See Psaltis et al. 2018, arxiv::1805.01242v1 for details. | ||
**Mandatory methods** | ||
- `kzetafinder_equation(kzeta, finder::AbstractKzetaFinder)`: should privide a equation where k will be derived. | ||
**Methods provided** | ||
- `findkzeta_exact(finder::AbstractKzetaFinder)`: solves the equation for k_ζ,2 given the set of parameters in the finder. | ||
""" | ||
abstract type AbstractKzetaFinder end | ||
|
||
|
||
""" | ||
findkzeta_exact(finder::AbstractKzetaFinder; kwargs...) | ||
Solves the equation for the concentration parameter k_ζ,2 given the set of parameters in the finder. | ||
It uses NonlinearSolve.jl. | ||
""" | ||
@inline function findkzeta_exact(finder::AbstractKzetaFinder; solver=NewtonRaphson()) | ||
probN = NonlinearProblem(kzetafinder_equation, [0.0, 0.0], finder) | ||
return solve(probN, solver)[1] | ||
end | ||
|
||
|
||
""" | ||
kzetafinder_equation(kzeta, finder::AbstractKzetaFinder) | ||
This equation privide a root-finding function `f(kzeta, finder)` to find kzeta from the equation `f(kzeta, finder)=0`. | ||
""" | ||
function kzetafinder_equation(kzeta, ::AbstractKzetaFinder) end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
$(TYPEDEF) | ||
The finder of the concentration parameter k_ζ,2 for dipole anistropic scattering models. | ||
See Psaltis et al. 2018, arxiv::1805.01242v1 for details. The equation for k_ζ,2 is | ||
given by the equation 43 of Psaltis et al. 2018. | ||
**Mandatory fields** | ||
- `α::Number`: The power-law index of the phase fluctuations (Kolmogorov is 5/3). | ||
- `A::Number`: The anisotropy parameter of the angular broaderning defined by θmaj/θmin. | ||
""" | ||
struct Dipole_KzetaFinder{T<:Number} <: AbstractKzetaFinder | ||
α::T | ||
A::T | ||
end | ||
|
||
|
||
# Equation 43 of Psaltis et al. 2018. | ||
@inline function kzetafinder_equation(kzeta, finder::Dipole_KzetaFinder) | ||
α = finder.α | ||
A = finder.A | ||
ᾱ = (α + 2) / 2 | ||
return _₂F₁.(ᾱ, 0.5, 2, .-kzeta) ./ _₂F₁.(ᾱ, 1.5, 2, .-kzeta) .- A^2 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
$(TYPEDEF) | ||
The finder of the concentration parameter k_ζ,3 for the Periodic Box Car anistropic scattering model. | ||
See Psaltis et al. 2018, arxiv::1805.01242v1 for details. The equation for k_ζ,3 is | ||
given by the equation 47 of Psaltis et al. 2018. | ||
**Mandatory fields** | ||
- `A::Number`: The anisotropy parameter of the angular broaderning defined by θmaj/θmin. | ||
""" | ||
struct PeriodicBoxCar_KzetaFinder{T<:Number} <: AbstractKzetaFinder | ||
ζ0::T | ||
end | ||
|
||
|
||
# Equation 47 of Psaltis et al. 2018. | ||
@inline function kzetafinder_equation(kzeta, finder::PeriodicBoxCar_KzetaFinder) | ||
k̃zeta .= π ./ (1 .+ kzeta) | ||
return sin(k̃zeta) ./ k̃zeta .- finder.ζ0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
$(TYPEDEF) | ||
The finder of the concentration parameter k_ζ,1 for the von Mises anistropic scattering model. | ||
See Psaltis et al. 2018, arxiv::1805.01242v1 for details. The equation for k_ζ,1 is originally | ||
given by the equation 37 of Psaltis et al. 2018, but this is different in the implementation of | ||
Johnson et al. 2018 in eht-imaging library. We follow eht-imaging's implementation. | ||
**Mandatory fields** | ||
- `A::Number`: The anisotropy parameter of the angular broaderning defined by θmaj/θmin. | ||
""" | ||
struct vonMises_KzetaFinder{T<:Number} <: AbstractKzetaFinder | ||
A::T | ||
end | ||
|
||
|
||
# Originally Equation 37 of Psaltis et al. 2018, but apparely different equation is used in eht-imaging library. | ||
# We here use the version used in eht-imaging library. | ||
@inline function kzetafinder_equation(kzeta, finder::vonMises_KzetaFinder) | ||
return besseli0.(kzeta) ./ besseli1.(kzeta) .- finder.A^2 | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.