Skip to content

Commit

Permalink
Rename lengths --> meanlengths
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed Nov 1, 2024
1 parent 71a73d9 commit 2a89f5b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ext/transioplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function transioplot(
l = isnothing(levels) ? (1:L) : levels

# mean lengths
λ = GeoStatsFunctions.lengths(t)
λ = meanlengths(t)

# relative proportions at h → ∞
p = Tuple(normalize(diag(t(100H)), 1))
Expand Down
1 change: 1 addition & 0 deletions src/GeoStatsFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export
isstationary,
isisotropic,
metricball,
meanlengths,

# theoretical variograms
Variogram,
Expand Down
2 changes: 1 addition & 1 deletion src/theoretical/transiogram/matrixexponential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ MatrixExponentialTransiogram(ball::MetricBall, lens::Tuple, props::Tuple) =
MatrixExponentialTransiogram(lens::Tuple, props::Tuple) =
MatrixExponentialTransiogram(baseratematrix(lens, props))

lengths(t::MatrixExponentialTransiogram) = Tuple(1 ./ -diag(t.rate))
meanlengths(t::MatrixExponentialTransiogram) = Tuple(1 ./ -diag(t.rate))

(t::MatrixExponentialTransiogram)(h) = exp(h * t.rate)

Expand Down
4 changes: 2 additions & 2 deletions test/theoretical/transiogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
# corresponding exponential transiogram
t = MatrixExponentialTransiogram((1.0u"m", 2.0u"m", 3.0u"m"), (0.2, 0.5, 0.3))
@test t isa MatrixExponentialTransiogram
@test GeoStatsFunctions.lengths(t) == (1.0u"m", 2.0u"m", 3.0u"m")
@test meanlengths(t) == (1.0u"m", 2.0u"m", 3.0u"m")

# random transition rate matrix
A = rand(3, 3)
R = A ./ sum(A, dims=2)
t = MatrixExponentialTransiogram(R)
@test t isa MatrixExponentialTransiogram
@test range(t) == maximum(1 ./ -diag(R)) * u"m"
@test meanlengths(t) == Tuple((1 ./ -diag(R)) * u"m")

# invalid transition rate matrix
A = rand(3, 2)
Expand Down

0 comments on commit 2a89f5b

Please sign in to comment.