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

Commit a75e966

Browse files
committed
Add thinning API
1 parent 42995ae commit a75e966

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

src/PointPatterns.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import GeoStatsBase: npoints, coordinates, coordinates!
1414

1515
include("pattern.jl")
1616
include("processes.jl")
17+
include("thinning.jl")
1718

1819
# plot recipes
1920
include("plotrecipes/pattern.jl")
@@ -30,6 +31,11 @@ export
3031
BinomialProcess,
3132
PoissonProcess,
3233
UnionProcess,
33-
ishomogeneous
34+
ishomogeneous,
35+
36+
# thinning methods
37+
AbstractThinning,
38+
RandomThinning,
39+
thin
3440

3541
end # module

src/thinning.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ------------------------------------------------------------------
2+
# Licensed under the ISC License. See LICENSE in the project root.
3+
# ------------------------------------------------------------------
4+
5+
"""
6+
AbstractThinning
7+
8+
A method for thinning spatial point processes and patterns.
9+
"""
10+
abstract type AbstractThinning end
11+
12+
"""
13+
thin(p, t)
14+
15+
Thin spatial point process `p` with thinning method `t`.
16+
"""
17+
thin(p::PointProcess, t::AbstractThinning) = @error "not implemented"
18+
19+
#-----------------
20+
# IMPLEMENTATIONS
21+
#-----------------
22+
include("thinning/random.jl")

src/thinning/random.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# ------------------------------------------------------------------
2+
# Licensed under the ISC License. See LICENSE in the project root.
3+
# ------------------------------------------------------------------
4+
5+
"""
6+
RandomThinning(p)
7+
8+
Random thining with retention probability `p`.
9+
"""
10+
struct RandomThinning{T<:Real} <: AbstractThinning
11+
p::T
12+
end
13+
14+
function thin(p::PointProcess, t::RandomThinning)
15+
# TODO
16+
end

0 commit comments

Comments
 (0)