Points
Base.rand
— Methodrand([rng], process::PointProcess, geometry, [nreals])
rand([rng], process::PointProcess, domain, [nreals])
Generate one or nreals
realizations of the point process
inside geometry
or domain
. Optionally specify the random number generator rng
.
# geometry of interest
sphere = Sphere((0, 0, 0), 1)
# homogeneous Poisson process
proc = PoissonProcess(5.0)
# sample two point patterns
pset = rand(proc, sphere, 2)
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], sphere)
viz!(fig[1,1], pset[1], color = :black)
viz(fig[1,2], sphere)
viz!(fig[1,2], pset[2], color = :black)
fig
GeoStatsProcesses.ishomogeneous
— Functionishomogeneous(process::PointProcess)
Tells whether or not the spatial point process process
is homogeneous.
Processes
GeoStatsProcesses.BinomialProcess
— TypeBinomialProcess(n)
A Binomial point process with n
points.
# geometry of interest
box = Box((0, 0), (100, 100))
# Binomial process
proc = BinomialProcess(1000)
# sample point patterns
pset = rand(proc, box, 2)
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], box)
viz!(fig[1,1], pset[1], color = :black)
viz(fig[1,2], box)
viz!(fig[1,2], pset[2], color = :black)
fig
GeoStatsProcesses.PoissonProcess
— TypePoissonProcess(λ)
A Poisson process with intensity λ
. For a homogeneous process, define λ
as a constant real value, while for an inhomogeneous process, define λ
as a function or vector of values. If λ
is a vector, it is assumed that the process is associated with a Domain
with the same number of elements as λ
.
# geometry of interest
box = Box((0, 0), (100, 100))
# intensity function
λ(p) = sum(to(p))^2 / 10000
# homogeneous process
proc₁ = PoissonProcess(0.5)
# inhomogeneous process
proc₂ = PoissonProcess(λ)
# sample point patterns
pset₁ = rand(proc₁, box)
pset₂ = rand(proc₂, box)
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], box)
viz!(fig[1,1], pset₁, color = :black)
viz(fig[1,2], box)
viz!(fig[1,2], pset₂, color = :black)
fig
GeoStatsProcesses.InhibitionProcess
— TypeInhibitionProcess(δ)
An inhibition point process with minimum distance δ
.
# geometry of interest
box = Box((0, 0), (100, 100))
# inhibition process
proc = InhibitionProcess(2.0)
# sample point pattern
pset = rand(proc, box, 2)
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], box)
viz!(fig[1,1], pset[1], color = :black)
viz(fig[1,2], box)
viz!(fig[1,2], pset[2], color = :black)
fig
GeoStatsProcesses.ClusterProcess
— TypeClusterProcess(proc, ofun)
A cluster process with parent process proc
and offsprings generated with ofun
. It is a function that takes a parent point and returns a point pattern from another point process.
ClusterProcess(proc, offs, gfun)
Alternatively, specify the parent process proc
, the offspring process offs
and the geometry function gfun
. It is a function that takes a parent point and returns a geometry or domain for the offspring process.
# geometry of interest
box = Box((0, 0), (5, 5))
# Matérn process
proc₁ = ClusterProcess(
PoissonProcess(1),
PoissonProcess(1000),
p -> Ball(p, 0.2)
)
# inhomogeneous parent and offspring processes
proc₂ = ClusterProcess(
PoissonProcess(p -> 0.1 * sum(to(p) .^ 2)),
p -> rand(PoissonProcess(x -> 5000 * sum((x - p).^2)), Ball(p, 0.5))
)
# sample point patterns
pset₁ = rand(proc₁, box)
pset₂ = rand(proc₂, box)
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], box)
viz!(fig[1,1], pset₁, color = :black)
viz(fig[1,2], box)
viz!(fig[1,2], pset₂, color = :black)
fig
Operations
Base.union
— Methodp₁ ∪ p₂
Return the union of point processes p₁
and p₂
.
# geometry of interest
box = Box((0, 0), (100, 100))
# superposition of two Binomial processes
proc₁ = BinomialProcess(500)
proc₂ = BinomialProcess(500)
proc = proc₁ ∪ proc₂ # 1000 points
pset = rand(proc, box, 2)
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], box)
viz!(fig[1,1], pset[1], color = :black)
viz(fig[1,2], box)
viz!(fig[1,2], pset[2], color = :black)
fig
GeoStatsProcesses.thin
— Functionthin(process, method)
Thin spatial point process
with thinning method
.
GeoStatsProcesses.RandomThinning
— TypeRandomThinning(p)
Random thinning with retention probability p
, which can be a constant probability value in [0,1]
or a function mapping a point to a probability.
Examples
RandomThinning(0.5)
RandomThinning(p -> sum(to(p)))
# geometry of interest
box = Box((0, 0), (100, 100))
# reduce intensity of Poisson process by half
proc₁ = PoissonProcess(0.5)
proc₂ = thin(proc₁, RandomThinning(0.5))
# sample point patterns
pset₁ = rand(proc₁, box)
pset₂ = rand(proc₂, box)
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], box)
viz!(fig[1,1], pset₁, color = :black)
viz(fig[1,2], box)
viz!(fig[1,2], pset₂, color = :black)
fig
# geometry of interest
box = Box((0, 0), (100, 100))
# Binomial process
proc = BinomialProcess(2000)
# sample point pattern
pset₁ = rand(proc, box)
# thin point pattern with probability 0.5
pset₂ = thin(pset₁, RandomThinning(0.5))
fig = Mke.Figure(size = (800, 400))
viz(fig[1,1], box)
viz!(fig[1,1], pset₁, color = :black)
viz(fig[1,2], box)
viz!(fig[1,2], pset₂, color = :black)
fig