Skip to content

Commit

Permalink
Add GaussianTransiogram
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed Nov 1, 2024
1 parent 4575b11 commit 231d44c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/GeoStatsFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export
# theoretical transiograms
Transiogram,
LinearTransiogram,
GaussianTransiogram,
SphericalTransiogram,
ExponentialTransiogram,
MatrixExponentialTransiogram,
Expand Down
1 change: 1 addition & 0 deletions src/theoretical/transiogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ isstationary(::Type{<:Transiogram}) = true
# ----------------

include("transiogram/linear.jl")
include("transiogram/gaussian.jl")
include("transiogram/spherical.jl")
include("transiogram/exponential.jl")
include("transiogram/matrixexponential.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/theoretical/transiogram/exponential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ExponentialTransiogram(; ranges, proportions)
ExponentialTransiogram(ball; proportions)
A spherical transiogram with `ranges`, and `proportions`.
A exponential transiogram with `ranges`, and `proportions`.
Optionally, use a custom metric `ball`.
"""
struct ExponentialTransiogram{P,B} <: Transiogram
Expand Down
32 changes: 32 additions & 0 deletions src/theoretical/transiogram/gaussian.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

"""
GaussianTransiogram(; ranges, proportions)
GaussianTransiogram(ball; proportions)
A Gaussian transiogram with `ranges`, and `proportions`.
Optionally, use a custom metric `ball`.
"""
struct GaussianTransiogram{P,B} <: Transiogram
prop::P
ball::B
end

GaussianTransiogram(ball; proportions=(0.5, 0.5)) = GaussianTransiogram(proportions, ball)

GaussianTransiogram(; ranges=(1.0u"m", 1.0u"m"), proportions=(0.5, 0.5)) =
GaussianTransiogram(proportions, MetricBall(ranges))

constructor(::GaussianTransiogram) = GaussianTransiogram

function (t::GaussianTransiogram)(h)
r = radius(t.ball)
p = t.prop
L = length(p)
h′, r′ = unitless(h, r)
v = 1 - exp(-3(h′ / r′)^2)
T = typeof(p[1] * v)
SMatrix{L,L}(i == j ? T(1 - (1 - p[j]) * v) : T((p[j] * v)) for i in 1:L, j in 1:L)
end

0 comments on commit 231d44c

Please sign in to comment.