-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix_sim_0_bt_1_D_3_cannib.py
121 lines (107 loc) · 3.79 KB
/
mix_sim_0_bt_1_D_3_cannib.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import os
import sys
import parameters.model_parameters as param
import models.development as develop
import models.forage as forage
import models.growth as growth
import models.init_biomass as init_bio
import models.movement as move
import models.reproduction as repro
import models.simulator as simulator
import models.survival as survive
bt_prop = param.bt_prop_0
dominance = param.dominance_1
cannib = param.cannib_3
sur = param.larva_prob_bt_low_ss
nums = (
(0, 0, 0),
(0, 0, 0),
(0, 0, 0),
(0, 0, 0),
(param.mix_preg_rr, 0, param.mix_preg_ss)
)
input_models = [
growth.max_gut(),
growth.growth(param.alpha_ss,
param.alpha_rr,
param.beta_ss,
param.beta_rr,
dominance),
init_bio.init_num(param.lam_0_egg),
init_bio.init_mass(param.mu_0_egg_ss,
param.mu_0_egg_rr,
param.sig_0_egg_ss,
param.sig_0_egg_rr,
dominance),
init_bio.init_juvenile(param.mu_0_larva_ss,
param.mu_0_larva_rr,
param.sig_0_larva_ss,
param.sig_0_larva_rr,
dominance),
init_bio.init_mature(param.mu_0_mature_ss,
param.mu_0_mature_rr,
param.sig_0_mature_ss,
param.sig_0_mature_rr,
dominance),
init_bio.init_plant(param.mu_leaf,
param.sig_leaf),
develop.egg_dev(param.mu_egg_dev,
param.sig_egg_dev),
develop.larva_dev(param.mu_larva_dev_ss,
param.mu_larva_dev_rr,
param.sig_larva_dev_ss,
param.sig_larva_dev_rr,
dominance),
develop.pupa_dev(param.mu_pupa_dev,
param.sig_pupa_dev),
forage.adlibitum(param.forage_steps),
forage.egg(param.egg_factor),
forage.larva(param.larva_factor),
forage.fight(param.fight_slope),
forage.encounter(cannib),
forage.radius(param.cannibalism_radius),
move.larva(param.larva_scale,
param.larva_shape),
move.adult(param.adult_scale,
param.adult_shape),
repro.mating(param.mate_encounter),
repro.radius(param.mate_radius),
repro.fecundity(param.fecundity_maximum,
param.fecundity_decay),
repro.density(param.eta,
param.gamma),
repro.init_sex(param.female_prob),
survive.egg_sur(param.egg_prob),
survive.pupa_sur(param.pupa_prob),
survive.adult_sur(param.adult_prob),
survive.larva_sur(param.larva_prob_non_bt_rr,
param.larva_prob_non_bt_ss,
param.larva_prob_bt_rr,
sur,
dominance)
]
base_dir = sys.argv[0].split('.')[0]
base_save = base_dir.split('/')[-1]
try:
work_path = os.environ['WORK']
path_save = '{}/{}/{}'.format(work_path,
'FallArmyworm_Thesis',
base_save)
if not os.path.isdir(path_save):
print('Creating save directory')
os.mkdir(path_save)
except KeyError:
path_save = os.path.dirname(os.path.abspath(__file__))
print('Falling back to local save')
print('Save path: {}'.format(path_save))
if __name__ == '__main__':
if len(sys.argv) > 1:
run_number = sys.argv[1]
else:
run_number = 0
simulator.Simulator.run(run_number,
nums,
bt_prop,
input_models,
path_save,
base_save)