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

Commit 117fdd2

Browse files
committed
Fix union process
1 parent a2ded2c commit 117fdd2

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

src/processes/union.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ struct UnionSampling end
1818

1919
default_sampling_algorithm(::UnionProcess) = UnionSampling()
2020

21-
function rand_single(p::UnionProcess, ::Geometry, algo::UnionSampling)
22-
pp₁ = rand(p.p₁, r)
23-
pp₂ = rand(p.p₂, r)
21+
function rand_single(p::UnionProcess, g::Geometry, algo::UnionSampling)
22+
pp₁ = rand(p.p₁, g)
23+
pp₂ = rand(p.p₂, g)
2424

25-
X = coordinates(pp₁)
26-
Y = coordinates(pp₂)
25+
X = coordinates(pp₁, 1:nelements(pp₁))
26+
Y = coordinates(pp₂, 1:nelements(pp₂))
2727

2828
PointSet(hcat(X, Y))
2929
end

src/thinning.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ abstract type AbstractThinning end
1414
1515
Thin spatial point process `p` with thinning method `t`.
1616
"""
17-
thin(p::PointProcess, t::AbstractThinning) = @error "not implemented"
17+
function thin end
1818

1919
"""
2020
thin(pp, t)
2121
2222
Thin spatial point pattern `pp` with thinning method `t`.
2323
"""
24-
thin(pp::PointSet, t::AbstractThinning) = @error "not implemented"
24+
thin(::PointSet, ::AbstractThinning)
2525

2626
#-----------------
2727
# IMPLEMENTATIONS

test/processes.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,17 @@
1616
@testset "Poisson" begin
1717
# TODO
1818
end
19+
20+
@testset "Union" begin
21+
b = Box((0.,0.), (100.,100.))
22+
p₁ = BinomialProcess(50)
23+
p₂ = BinomialProcess(50)
24+
p = p₁ p₂ # 100 points
25+
26+
s = rand(p, b, 2)
27+
@test length(s) == 2
28+
@test s[1] isa PointSet
29+
@test s[2] isa PointSet
30+
@test nelements.(s) == [100,100]
31+
end
1932
end

0 commit comments

Comments
 (0)