Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit cd81849

Browse files
committed
Rename ThinnedSampling -> LewisShedler
1 parent 25b9dde commit cd81849

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/PointPatterns.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export
2222
UnionProcess,
2323
ishomogeneous,
2424

25+
# algorithms
26+
LewisShedler,
27+
2528
# thinning methods
2629
AbstractThinning,
2730
RandomThinning,

src/processes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ function default_sampling_algorithm end
5555
# --------------------
5656

5757
"""
58-
ThinnedSampling(λmax)
58+
LewisShedler(λmax)
5959
6060
Generate sample using Lewis-Shedler algorithm (1979) with
6161
maximum real value `λmax` of the intensity function.
6262
"""
63-
struct ThinnedSampling{T<:Real}
63+
struct LewisShedler{T<:Real}
6464
λmax::T
6565
end
6666

src/processes/poisson.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ishomogeneous(p::PoissonProcess{<:AbstractVector}) = false
3434

3535
default_sampling_algorithm(::PoissonProcess, ::Any) = DiscretizedSampling()
3636

37-
default_sampling_algorithm(p::PoissonProcess{<:Function}, g) = ThinnedSampling(default_lambda_max(p, g))
37+
default_sampling_algorithm(p::PoissonProcess{<:Function}, g) = LewisShedler(default_lambda_max(p, g))
3838

3939
function default_lambda_max(p::PoissonProcess{<:Function}, g)
4040
points = sample(g, HomogeneousSampling(10000))
@@ -67,7 +67,7 @@ end
6767
# INHOMOGENEOUS CASE
6868
#--------------------
6969

70-
function rand_single(rng::Random.AbstractRNG, p::PoissonProcess{<:Function}, g, algo::ThinnedSampling)
70+
function rand_single(rng::Random.AbstractRNG, p::PoissonProcess{<:Function}, g, algo::LewisShedler)
7171
# simulate a homogeneous process
7272
pp = rand_single(rng, PoissonProcess(algo.λmax), g, DiscretizedSampling())
7373

src/thinning.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ thin(::PointSet, ::AbstractThinning)
2626
#-----------------
2727
# IMPLEMENTATIONS
2828
#-----------------
29+
2930
include("thinning/random.jl")

test/processes.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,12 @@
4646
# inhomogeneous with intensity function
4747
p = PoissonProcess(λ)
4848
for g in [seg, tri, quad, box, ball, poly, grid, mesh]
49-
# default thinnedsampling
5049
pp = rand(p, g)
5150
@test all((g), pp)
52-
# custom thinnedsampling using λmax
53-
pp = rand(p, g, algo=PointPatterns.ThinnedSampling(λ(Point2(12.0, 12.0))))
51+
52+
pp = rand(p, g, algo=LewisShedler(λ(Point2(12.0, 12.0))))
5453
@test all((g), pp)
55-
# discretizedsampling
54+
5655
g = discretize(g)
5756
pp = rand(p, g, algo=PointPatterns.DiscretizedSampling())
5857
@test all((g), g)

0 commit comments

Comments
 (0)