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

Commit 7dfefdd

Browse files
ErickChaconjuliohm
andcommitted
Cleanup examples
Co-authored-by: Júlio Hoffimann <[email protected]>
1 parent 2a2f4f2 commit 7dfefdd

File tree

2 files changed

+6
-36
lines changed

2 files changed

+6
-36
lines changed

src/processes/cluster.jl

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,28 @@ parent point and returns a geometry or domain for the offspring process.
1818
## Examples
1919
2020
```julia
21-
import CairoMakie
22-
using Meshes, MeshViz
23-
using PointPatterns
24-
2521
# Matern cluster process
26-
d = Box((0,0), (5,5))
2722
p = ClusterProcess(
2823
PoissonProcess(1),
2924
PoissonProcess(1000),
3025
parent -> Ball(parent, 0.2)
3126
)
32-
ps = rand(p, d)
33-
34-
fig = viz(d, alpha = 0.5; axis = (;title = "Matern cluster process"))
35-
viz!(ps, color = :black, pointsize = 5)
36-
3727
# Inhomogenegeous parent process with fixed number of offsprings
38-
39-
d = Box((-2.5,-2.5), (2.5,2.5))
4028
p = ClusterProcess(
4129
PoissonProcess(s -> 1 * sum(coordinates(s) .^ 2)),
4230
BinomialProcess(100),
4331
parent -> Ball(parent, 0.2)
4432
)
45-
ps = rand(p, d)
46-
47-
fig = viz(d, alpha = 0.5; axis = (;title = "Inhomogeneneous with fixed number of offsprings"))
48-
viz!(ps, color = :black, pointsize = 5)
49-
5033
# Inhomogenegeous parent process and inhomogeneneous offspring process
51-
52-
d = Box((0,0), (5,5))
5334
p = ClusterProcess(
5435
PoissonProcess(s -> 0.1 * sum(coordinates(s) .^ 2)),
5536
parent -> rand(PoissonProcess(x -> 5000 * sum((x - parent).^2)), Ball(parent, 0.5))
5637
)
57-
ps = rand(p, d)
58-
59-
fig = viz(d, alpha = 0.5; axis = (;title = "Inhomogenegeous parent and inhomogeneneous offspring"))
60-
viz!(ps, color = :black, pointsize = 5)
61-
6238
# Inhomogenegeous parent process and regularsampling
63-
64-
d = Box((0,0), (5,5))
6539
p = ClusterProcess(
6640
PoissonProcess(s -> 0.2 * sum(coordinates(s) .^ 2)),
6741
parent -> PointSet(sample(Sphere(parent, 0.1), RegularSampling(10)))
6842
)
69-
ps = rand(p, d)
70-
71-
fig = viz(d, alpha = 0.5; axis = (;title = "Inhomogenegeous parent and regular sampling"))
72-
viz!(ps, color = :black, pointsize = 5)
7343
```
7444
"""
7545
struct ClusterProcess{P<:PointProcess,F<:Function} <: PointProcess

test/processes.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@
5858
@testset "Inhibition" begin end
5959

6060
@testset "Cluster" begin
61-
offspring1 = parent -> rand(BinomialProcess(10), Ball(parent, 0.2))
62-
offspring2 = parent -> rand(PoissonProcess(100), Ball(parent, 0.2))
63-
offspring3 = parent -> rand(PoissonProcess(x -> 100 * sum((x - parent).^2)), Ball(parent, 0.5))
64-
offspring4 = parent -> PointSet(sample(Sphere(parent, 0.1), RegularSampling(10)))
65-
offspringfuns = [offspring1, offspring2, offspring3, offspring4]
66-
for p in procs, ofun in offspringfuns, g in geoms
61+
ofun1 = parent -> rand(BinomialProcess(10), Ball(parent, 0.2))
62+
ofun2 = parent -> rand(PoissonProcess(100), Ball(parent, 0.2))
63+
ofun3 = parent -> rand(PoissonProcess(x -> 100 * sum((x - parent).^2)), Ball(parent, 0.5))
64+
ofun4 = parent -> PointSet(sample(Sphere(parent, 0.1), RegularSampling(10)))
65+
ofuns = [ofun1, ofun2, ofun3, ofun4]
66+
for p in procs, ofun in ofuns, g in geoms
6767
cp = ClusterProcess(p, ofun)
6868
pp = rand(cp, g)
6969
@test all((g), pp)

0 commit comments

Comments
 (0)