Skip to content

Commit 7eb6a2b

Browse files
committed
Upda API and README
1 parent ea568bd commit 7eb6a2b

13 files changed

Lines changed: 167 additions & 120 deletions

File tree

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
id: referencetests
3636
continue-on-error: true
3737
run: >
38-
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --color=yes -e 'using Pkg; Pkg.test("VPL", coverage=true)'
38+
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --color=yes -e 'using Pkg; Pkg.test("VirtualPlantLab", coverage=true)'
3939
&& echo "TESTS_SUCCESSFUL=true" >> $GITHUB_ENV
4040
env:
4141
CI: true

Project.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name = "VPL"
1+
name = "VirtualPlantLab"
22
uuid = "b977ecfa-1b9a-418d-909d-4ebe565736ce"
33
authors = ["Alejandro Morales Sierra <alejandro.moralessierra@wur.nl> and contributors"]
4-
version = "0.0.1"
4+
version = "0.0.2"
55

66
[deps]
77
PlantGeomPrimitives = "7eef3cc5-4580-4ff0-8f6f-933507db6664"
@@ -12,10 +12,10 @@ PlantViz = "358bd95d-d12c-439f-94b7-04b17e500c7f"
1212
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1313

1414
[compat]
15-
PlantGeomPrimitives = "0.0.1"
16-
PlantGeomTurtle = "0.0.1"
17-
PlantGraphs = "0.0.1"
18-
PlantRayTracer = "0.0.1"
19-
PlantViz = "0.0.1"
15+
PlantGeomPrimitives = "0.0.2"
16+
PlantGeomTurtle = "0.0.2"
17+
PlantGraphs = "0.0.2"
18+
PlantRayTracer = "0.0.2"
19+
PlantViz = "0.0.2"
2020
Reexport = "1.2.2"
2121
julia = "1.9"

README.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,56 @@
1-
# VPL
1+
# VirtualPlantLab
22

33
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](http://virtualplantlab.com/)
4-
[![CI](https://github.com/VirtualPlantLab/VPL.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/VirtualPlantLab/VPL.jl/actions/workflows/CI.yml)
4+
[![CI](https://github.com/VirtualPlantLab/VirtualPlantLab.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/VirtualPlantLab/VirtualPlantLab.jl/actions/workflows/CI.yml)
55
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)
66
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
77
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
88

9-
Main package in the [Virtual Plant Lab](http://virtualplantlab.com/).
9+
This is the main package in the [Virtual Plant Lab](http://virtualplantlab.com/) that users
10+
are meant to download and use. It is a meta-package that includes all the other packages
11+
in the VirtualPlantLab organization where the different features are implemented. The user
12+
does not need to be aware of the other packages, except in cases where methods need to be
13+
define for user-defined types (currently that is the case for `PlantGeomTurtle.feed!()`
14+
which is required to generate geometry from user-defined types).
15+
16+
# 1. Instalation
17+
18+
You can install the latest stable version of PlantGraphs.jl with the Julia package manager:
19+
20+
```julia
21+
] add VirtualPlantLab
22+
```
23+
24+
Or the development version directly from here:
25+
26+
```julia
27+
import Pkg
28+
Pkg.add(url="https://github.com/VirtualPlantLab/VirtualPlantLab.jl", rev = "master")
29+
```
30+
or
31+
32+
```julia
33+
] add VirtualPlantLab#master
34+
```
35+
36+
# 2. Usage
37+
38+
To start using VirtualPlantLab.jl, you need to load it first:
39+
40+
```julia
41+
using VirtualPlantLab
42+
```
43+
44+
The entire API of the Virtual Plant Lab will become available after loading.
45+
46+
For people starting, it is recommended to follow the tutorials in the
47+
[documentation](http://virtualplantlab.com/). The entire API is also documented there.
48+
49+
# 3. Additional packages
50+
51+
The following packages are also of interest when building models with the Virtual Plant Lab:
52+
53+
- [PlantSimEngine.jl](https://github.com/VirtualPlantLab/PlantSimEngine.jl)
54+
- [PlantBiophysics.jl](https://github.com/VEZY/PlantBiophysics.jl.git)
55+
- [SkyDomes.jl](https://github.com/VirtualPlantLab/SkyDomes.jl)
56+
- [Ecophys.jl](https://github.com/VirtualPlantLab/Ecophys.jl.git)

src/VPL.jl renamed to src/VirtualPlantLab.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
module VPL
1+
module VirtualPlantLab
22

33
using Reexport
44

5-
# Load the VPL components
5+
# Load the VirtualPlantLab components
66
@reexport using PlantGraphs
77
@reexport using PlantGeomPrimitives
88
@reexport using PlantGeomTurtle

test/algae.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ The model described here is based on the non-branching model of [algae
1010
growth](https://en.wikipedia.org/wiki/L-system#Example_1:_Algae) proposed by
1111
Lindermayer as one of the first L-systems.
1212
13-
First, we need to load the VPL metapackage, which will automatically load all
14-
the packages in the VPL ecosystem.
13+
First, we need to load the VirtualPlantLab metapackage, which will automatically load all
14+
the packages in the VirtualPlantLab ecosystem.
1515
=#
16-
using VPL
16+
using VirtualPlantLab
1717

1818
#=
1919
The rewriting rules of the L-system are as follows:
@@ -24,14 +24,14 @@ The rewriting rules of the L-system are as follows:
2424
2525
**rule 2**: B $\rightarrow$ A
2626
27-
In VPL, this L-system would be implemented as a graph where the nodes can be of
27+
In VirtualPlantLab, this L-system would be implemented as a graph where the nodes can be of
2828
type `A` or `B` and inherit from the abstract type `Node`. It is advised to
2929
include type definitions in a module to avoid having to restart the Julia
3030
session whenever we want to redefine them. Because each module is an independent
31-
namespace, we need to import `Node` from the VPL package inside the module:
31+
namespace, we need to import `Node` from the VirtualPlantLab package inside the module:
3232
=#
3333
module algae
34-
import VPL: Node
34+
import VirtualPlantLab: Node
3535
struct A <: Node end
3636
struct B <: Node end
3737
end
@@ -47,15 +47,15 @@ let
4747
axiom = algae.A()
4848

4949
#=
50-
The rewriting rules are implemented in VPL as objects of type `Rule`. In VPL, a
50+
The rewriting rules are implemented in VirtualPlantLab as objects of type `Rule`. In VirtualPlantLab, a
5151
rewriting rule substitutes a node in a graph with a new node or subgraph and is
5252
therefore composed of two parts:
5353
5454
1. A condition that is tested against each node in a graph to choose which nodes
5555
to rewrite.
5656
2. A subgraph that will replace each node selected by the condition above.
5757
58-
In VPL, the condition is split into two components:
58+
In VirtualPlantLab, the condition is split into two components:
5959
6060
1. The type of node to be selected (in this example that would be `A` or `B`).
6161
2. A function that is applied to each node in the graph (of the specified type)
@@ -68,7 +68,7 @@ let
6868
objects that inherit from `Node`. The operation `+` implies a linear
6969
relationship between two nodes and `[]` indicates branching.
7070
71-
The implementation of the two rules of algae growth model in VPL is as follows:
71+
The implementation of the two rules of algae growth model in VirtualPlantLab is as follows:
7272
=#
7373
rule1 = Rule(algae.A, rhs = x -> algae.A() + algae.B())
7474
rule2 = Rule(algae.B, rhs = x -> algae.A())

test/context.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ also to use properties of those neighbours in the right hand side component of
1818
the rule. This is know as "capturing the context" of the node being updated.
1919
This can be done by returning the additional nodes from the `lhs` component (in
2020
addition to `true` or `false`) and by accepting these additional nodes in the
21-
`rhs` component. In addition, we tell VPL that this rule is capturing the
21+
`rhs` component. In addition, we tell VirtualPlantLab that this rule is capturing the
2222
context with `captures = true`.
2323
2424
In the example below, each `Cell` keeps track of a `state` variable (which is
@@ -30,9 +30,9 @@ parent node that was captured. Note that that now, the rhs component gets a new
3030
argument, which corresponds to the context of the father node captured in the
3131
lhs.
3232
=#
33-
using VPL
33+
using VirtualPlantLab
3434
module types
35-
using VPL
35+
using VirtualPlantLab
3636
struct Cell <: Node
3737
state::Int64
3838
end
@@ -82,7 +82,7 @@ let
8282
return collection of nodes rather than reconstruct the topology of a graph). If
8383
we need to process nodes in a particular order, then it is best to use a
8484
traversal algorithm on the graph that follows a particular order (for example
85-
depth-first traversal with `traverseDFS()`). This algorithm requires a function
85+
depth-first traversal with `traverse_dfs()`). This algorithm requires a function
8686
that applies to each node in the graph. In this simple example we can just store
8787
the `state` of each node in a vector (unlike Rules and Queries, this function
8888
takes the actual node as argument rather than a `Context` object, see the
@@ -91,13 +91,13 @@ let
9191

9292
pop = Graph(axiom = axiom, rules = rule)
9393
states = Int64[]
94-
traversedfs(pop, fun = node -> push!(states, node.state))
94+
traverse_dfs(pop, fun = node -> push!(states, node.state))
9595
states
9696

9797
# Now the states of the nodes are in the same order as they were created:
9898
rewrite!(pop)
9999
states = Int64[]
100-
traversedfs(pop, fun = node -> push!(states, node.state))
100+
traverse_dfs(pop, fun = node -> push!(states, node.state))
101101
states
102102

103103
end

test/forest.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ requires using the Distributions.jl package:
1010
The data types, rendering methods and growth rules are the same as in the binary
1111
tree example:
1212
=#
13-
using VPL
13+
using VirtualPlantLab
1414
using Distributions, ColorTypes
1515
import GLMakie
1616
import Base.Threads: @threads
1717
# Data types
1818
module TreeTypes
19-
import VPL
19+
import VirtualPlantLab
2020
# Meristem
21-
struct Meristem <: VPL.Node end
21+
struct Meristem <: VirtualPlantLab.Node end
2222
# Bud
23-
struct Bud <: VPL.Node end
23+
struct Bud <: VirtualPlantLab.Node end
2424
# Node
25-
struct Node <: VPL.Node end
25+
struct Node <: VirtualPlantLab.Node end
2626
# BudNode
27-
struct BudNode <: VPL.Node end
27+
struct BudNode <: VirtualPlantLab.Node end
2828
# Internode (needs to be mutable to allow for changes over time)
29-
Base.@kwdef mutable struct Internode <: VPL.Node
29+
Base.@kwdef mutable struct Internode <: VirtualPlantLab.Node
3030
length::Float64 = 0.10 # Internodes start at 10 cm
3131
end
3232
# Leaf
33-
Base.@kwdef struct Leaf <: VPL.Node
33+
Base.@kwdef struct Leaf <: VirtualPlantLab.Node
3434
length::Float64 = 0.20 # Leaves are 20 cm long
3535
width::Float64 = 0.1 # Leaves are 10 cm wide
3636
end
@@ -48,7 +48,7 @@ import .TreeTypes
4848

4949
let
5050
# Create geometry + color for the internodes
51-
function VPL.feed!(turtle::Turtle, i::TreeTypes.Internode, data)
51+
function VirtualPlantLab.feed!(turtle::Turtle, i::TreeTypes.Internode, data)
5252
# Rotate turtle around the head to implement elliptical phyllotaxis
5353
rh!(turtle, data.phyllotaxis)
5454
HollowCylinder!(
@@ -63,7 +63,7 @@ let
6363
end
6464

6565
# Create geometry + color for the leaves
66-
function VPL.feed!(turtle::Turtle, l::TreeTypes.Leaf, data)
66+
function VirtualPlantLab.feed!(turtle::Turtle, l::TreeTypes.Leaf, data)
6767
# Rotate turtle around the arm for insertion angle
6868
ra!(turtle, -data.leaf_angle)
6969
# Generate the leaf
@@ -80,7 +80,7 @@ let
8080
end
8181

8282
# Insertion angle for the bud nodes
83-
function VPL.feed!(turtle::Turtle, b::TreeTypes.BudNode, data)
83+
function VirtualPlantLab.feed!(turtle::Turtle, b::TreeTypes.BudNode, data)
8484
# Rotate turtle around the arm for insertion angle
8585
ra!(turtle, -data.branch_angle)
8686
end
@@ -101,7 +101,7 @@ let
101101
node = parent(bud)
102102
# We count the number of internodes between node and the first Meristem
103103
# moving down the graph
104-
check, steps = hasdescendant(node, condition = n -> data(n) isa TreeTypes.Meristem)
104+
check, steps = has_descendant(node, condition = n -> data(n) isa TreeTypes.Meristem)
105105
steps = Int(ceil(steps / 2)) # Because it will count both the nodes and the internodes
106106
# Compute probability of bud break and determine whether it happens
107107
if check
@@ -282,20 +282,20 @@ let
282282
simplest approach is two use a special constructor `Rectangle` where one species
283283
a corner of the rectangle and two vectors defining the two sides of the vectors.
284284
Both the sides and the corner need to be specified with `Vec` just like in the
285-
above when we determined the origin of each plant. VPL offers some shortcuts:
285+
above when we determined the origin of each plant. VirtualPlantLab offers some shortcuts:
286286
`O()` returns the origin (`Vec(0.0, 0.0, 0.0)`), whereas `X`, `Y` and `Z`
287287
returns the corresponding axes and you can scale them by passing the desired
288288
length as input. Below, a rectangle is created on the XY plane with the origin
289289
as a corner and each side being 11 units long:
290290
=#
291291
soil = Rectangle(length = 21.0, width = 21.0)
292292
rotatey!(soil, pi / 2)
293-
VPL.translate!(soil, Vec(0.0, 10.5, 0.0))
293+
VirtualPlantLab.translate!(soil, Vec(0.0, 10.5, 0.0))
294294

295295
#=
296296
We can now add the `soil` to the `scene` object with the `add!` function.
297297
=#
298-
VPL.add!(scene, mesh = soil, color = RGB(1, 1, 0))
298+
VirtualPlantLab.add!(scene, mesh = soil, color = RGB(1, 1, 0))
299299

300300
#=
301301
We can now render the scene that combines the random forest of binary trees and

test/growthforest.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dimensions of the organs are updated accordingly (assuming a particular shape).
1414
1515
The following packages are needed:
1616
=#
17-
using VPL, ColorTypes
17+
using VirtualPlantLab, ColorTypes
1818
using Base.Threads: @threads
1919
import Random
2020
using FastGaussQuadrature
@@ -37,28 +37,28 @@ module. The differences with respect to the previous example are:
3737
=#
3838
# Data types
3939
module TreeTypes
40-
using VPL
40+
using VirtualPlantLab
4141
using Distributions
4242
# Meristem
43-
Base.@kwdef mutable struct Meristem <: VPL.Node
43+
Base.@kwdef mutable struct Meristem <: VirtualPlantLab.Node
4444
age::Int64 = 0 # Age of the meristem
4545
end
4646
# Bud
47-
struct Bud <: VPL.Node end
47+
struct Bud <: VirtualPlantLab.Node end
4848
# Node
49-
struct Node <: VPL.Node end
49+
struct Node <: VirtualPlantLab.Node end
5050
# BudNode
51-
struct BudNode <: VPL.Node end
51+
struct BudNode <: VirtualPlantLab.Node end
5252
# Internode (needs to be mutable to allow for changes over time)
53-
Base.@kwdef mutable struct Internode <: VPL.Node
53+
Base.@kwdef mutable struct Internode <: VirtualPlantLab.Node
5454
age::Int64 = 0 # Age of the internode
5555
biomass::Float64 = 0.0 # Initial biomass
5656
length::Float64 = 0.0 # Internodes
5757
width::Float64 = 0.0 # Internodes
5858
sink::Exponential{Float64} = Exponential(5)
5959
end
6060
# Leaf
61-
Base.@kwdef mutable struct Leaf <: VPL.Node
61+
Base.@kwdef mutable struct Leaf <: VirtualPlantLab.Node
6262
age::Int64 = 0 # Age of the leaf
6363
biomass::Float64 = 0.0 # Initial biomass
6464
length::Float64 = 0.0 # Leaves
@@ -96,7 +96,7 @@ let
9696
the previous example.
9797
=#
9898
# Create geometry + color for the internodes
99-
function VPL.feed!(turtle::Turtle, i::TreeTypes.Internode, vars)
99+
function VirtualPlantLab.feed!(turtle::Turtle, i::TreeTypes.Internode, vars)
100100
# Rotate turtle around the head to implement elliptical phyllotaxis
101101
rh!(turtle, vars.phyllotaxis)
102102
HollowCylinder!(
@@ -111,7 +111,7 @@ let
111111
end
112112

113113
# Create geometry + color for the leaves
114-
function VPL.feed!(turtle::Turtle, l::TreeTypes.Leaf, vars)
114+
function VirtualPlantLab.feed!(turtle::Turtle, l::TreeTypes.Leaf, vars)
115115
# Rotate turtle around the arm for insertion angle
116116
ra!(turtle, -vars.leaf_angle)
117117
# Generate the leaf
@@ -128,7 +128,7 @@ let
128128
end
129129

130130
# Insertion angle for the bud nodes
131-
function VPL.feed!(turtle::Turtle, b::TreeTypes.BudNode, vars)
131+
function VirtualPlantLab.feed!(turtle::Turtle, b::TreeTypes.BudNode, vars)
132132
# Rotate turtle around the arm for insertion angle
133133
ra!(turtle, -vars.branch_angle)
134134
end
@@ -406,11 +406,11 @@ let
406406
using a dedicated graph and generate a `Scene` object which can later be
407407
merged with the rest of scene generated in daily step:
408408
=#
409-
Base.@kwdef struct Soil <: VPL.Node
409+
Base.@kwdef struct Soil <: VirtualPlantLab.Node
410410
length::Float64
411411
width::Float64
412412
end
413-
function VPL.feed!(turtle::Turtle, s::Soil, vars)
413+
function VirtualPlantLab.feed!(turtle::Turtle, s::Soil, vars)
414414
Rectangle!(
415415
turtle,
416416
length = s.length,

0 commit comments

Comments
 (0)