FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CRootBox/python/example4b.py at master · Plant-Root-Soil-Interactions-Modelling/CRootBox · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Plant-Root-Soil-Interactions-Modelling
/
CRootBox
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
20
Code
Issues
3
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
CRootBox
/
python
/
example4b.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (46 loc) · 1.66 KB
Breadcrumbs
CRootBox
/
python
/
example4b.py
Copy path
File metadata and controls
59 lines (46 loc) · 1.66 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import
py_rootbox
as
rb
# User tropism 1: print input arguments to command line
class
My_Info_Tropism
(
rb
.
Tropism
):
def
tropismObjective
(
self
,
pos
,
old
,
a
,
b
,
dx
,
root
):
print
(
"Postion
\t
"
,
pos
)
print
(
"Heading
\t
"
,
old
.
column
(
0
))
print
(
"Test for angle alpha =
\t
"
,
a
)
print
(
"Test for angle beta =
\t
"
,
b
)
print
(
"Eesolution of next segment
\t
"
,
dx
)
print
(
"Root id"
,
root
.
getId
())
print
()
return
0.
# User tropism 2: depending on root age use plagio- or gravitropism
class
My_Age_Tropism
(
rb
.
Tropism
):
def
__init__
(
self
,
n
,
sigma
,
age
):
super
(
My_Age_Tropism
,
self
).
__init__
()
self
.
plagio
=
rb
.
Plagiotropism
(
0.
,
0.
)
self
.
gravi
=
rb
.
Gravitropism
(
0.
,
0.
)
self
.
setTropismParameter
(
n
,
sigma
)
self
.
age
=
age
def
tropismObjective
(
self
,
pos
,
old
,
a
,
b
,
dx
,
root
):
age
=
root
.
getAge
()
if
age
<
self
.
age
:
d
=
self
.
plagio
.
tropismObjective
(
pos
,
old
,
a
,
b
,
dx
,
root
)
return
d
else
:
return
self
.
gravi
.
tropismObjective
(
pos
,
old
,
a
,
b
,
dx
,
root
)
# set up the root system
rs
=
rb
.
RootSystem
()
name
=
"Anagallis_femina_Leitner_2010"
rs
.
openFile
(
name
)
rs
.
initialize
()
# Set useer defined after initialize
mytropism1
=
My_Info_Tropism
()
mytropism1
.
setTropismParameter
(
2.
,
0.2
)
mytropism2
=
My_Age_Tropism
(
2.
,
0.5
,
5.
)
# after 5 days switch from plagio- to gravitropism
rs
.
setTropism
(
mytropism2
,
2
)
# 2 for laterals, -1 for all root types
# Simulate
simtime
=
100
# e.g. 30 or 60 days
dt
=
1
N
=
round
(
simtime
/
dt
)
for
_
in
range
(
0
,
N
):
rs
.
simulate
(
dt
)
# Export results (as vtp)
rs
.
write
(
"../results/example_4b.vtp"
)
print
(
"done."
)
Back
|
FazBrowse Home
|
New Git URL