piegy 2.3.2__tar.gz → 2.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {piegy-2.3.2/src/piegy.egg-info → piegy-2.3.4}/PKG-INFO +1 -1
- {piegy-2.3.2 → piegy-2.3.4}/pyproject.toml +1 -1
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/runner.c +5 -5
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/sim_funcs.c +16 -23
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/sim_funcs.h +13 -11
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/__version__.py +3 -1
- {piegy-2.3.2 → piegy-2.3.4/src/piegy.egg-info}/PKG-INFO +1 -1
- {piegy-2.3.2 → piegy-2.3.4}/LICENSE.txt +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/MANIFEST.in +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/README.md +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/setup.cfg +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/setup.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/Makefile +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/model.c +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/model.h +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/patch.c +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/C_core/patch.h +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/__init__.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/analysis.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/build_info.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/data_tools.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/figures.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/simulation.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/simulation_py.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/test_var.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/tools/__init__.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/tools/figure_tools.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/tools/file_tools.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/tools/find_C.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy/videos.py +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy.egg-info/SOURCES.txt +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy.egg-info/dependency_links.txt +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy.egg-info/requires.txt +0 -0
- {piegy-2.3.2 → piegy-2.3.4}/src/piegy.egg-info/top_level.txt +0 -0
@@ -11,14 +11,14 @@
|
|
11
11
|
int main() {
|
12
12
|
size_t N = 1;
|
13
13
|
size_t M = 100;
|
14
|
-
double maxtime =
|
14
|
+
double maxtime = 600;
|
15
15
|
double record_itv = 0.1;
|
16
|
-
size_t sim_time =
|
16
|
+
size_t sim_time = 1;
|
17
17
|
bool boundary = true;
|
18
|
-
uint32_t I_single[2] = {
|
18
|
+
uint32_t I_single[2] = {440, 220};
|
19
19
|
double X_single[4] = {-1, 4, 0, 2};
|
20
|
-
double P_single[6] = {0.5, 0.5,
|
21
|
-
int32_t print_pct =
|
20
|
+
double P_single[6] = {0.5, 0.5, 100, 100, 0.001, 0.001};
|
21
|
+
int32_t print_pct = 1;
|
22
22
|
int32_t seed = 36; // -1 for None
|
23
23
|
|
24
24
|
uint32_t I[N * M * 2];
|
@@ -303,25 +303,21 @@ static uint8_t single_test(model_t* restrict mod, uint32_t update_sum_freq, char
|
|
303
303
|
uint8_t rela_loc = signal.rela_loc;
|
304
304
|
if (rela_loc == NO_MIG) {
|
305
305
|
// if only one
|
306
|
-
|
307
|
-
|
308
|
-
sum_rates -= picked_rate;
|
306
|
+
sum_rates_by_row[si1] -= patch_rates[sij1];
|
307
|
+
sum_rates -= patch_rates[sij1];
|
309
308
|
|
310
309
|
update_pi_k(&world[sij1], &(mod->X[sij1 * 4]), &(mod->P[sij1 * 6]));
|
311
|
-
|
310
|
+
init_mig(&world[sij1], &(mod->P[sij1 * 6]));
|
312
311
|
|
313
|
-
|
314
|
-
patch_rates[sij1]
|
315
|
-
|
316
|
-
sum_rates += picked_rate;
|
312
|
+
patch_rates[sij1] = world[sij1].sum_pi_death_rates + world[sij1].sum_mig_rates;
|
313
|
+
sum_rates_by_row[si1] += patch_rates[sij1];
|
314
|
+
sum_rates += patch_rates[sij1];
|
317
315
|
} else {
|
318
316
|
// two
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
sum_rates -= picked_rate1;
|
324
|
-
sum_rates -= picked_rate2;
|
317
|
+
sum_rates_by_row[si1] -= patch_rates[sij1];
|
318
|
+
sum_rates_by_row[si2] -= patch_rates[sij2];
|
319
|
+
sum_rates -= patch_rates[sij1];
|
320
|
+
sum_rates -= patch_rates[sij2];
|
325
321
|
|
326
322
|
update_pi_k(&world[sij1], &(mod->X[sij1 * 4]), &(mod->P[sij1 * 6])); // update both patches' payoffs first
|
327
323
|
update_pi_k(&world[sij2], &(mod->X[sij2 * 4]), &(mod->P[sij2 * 6]));
|
@@ -335,15 +331,12 @@ static uint8_t single_test(model_t* restrict mod, uint32_t update_sum_freq, char
|
|
335
331
|
return SIM_OVERFLOW;
|
336
332
|
}
|
337
333
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
patch_rates[
|
343
|
-
|
344
|
-
sum_rates_by_row[si2] += picked_rate2;
|
345
|
-
sum_rates += picked_rate1;
|
346
|
-
sum_rates += picked_rate2;
|
334
|
+
patch_rates[sij1] = world[sij1].sum_pi_death_rates + world[sij1].sum_mig_rates;
|
335
|
+
patch_rates[sij2] = world[sij2].sum_pi_death_rates + world[sij2].sum_mig_rates;
|
336
|
+
sum_rates_by_row[si1] += patch_rates[sij1];
|
337
|
+
sum_rates_by_row[si2] += patch_rates[sij2];
|
338
|
+
sum_rates += patch_rates[sij1];
|
339
|
+
sum_rates += patch_rates[sij2];
|
347
340
|
}
|
348
341
|
|
349
342
|
// update neighbors of last-changed patches
|
@@ -117,18 +117,18 @@ static inline void update_pi_k(patch_t* restrict p, const double* restrict M_sta
|
|
117
117
|
double U = (double) p->U;
|
118
118
|
double V = (double) p->V;
|
119
119
|
double sum = U + V;
|
120
|
+
double U_ratio = U / sum;
|
121
|
+
double V_ratio = V / sum;
|
120
122
|
|
121
123
|
if (sum > 0) {
|
122
|
-
if (U
|
123
|
-
p->U_pi =
|
124
|
-
(V / sum) * M_start[1];
|
124
|
+
if (U > 0) {
|
125
|
+
p->U_pi = U_ratio * M_start[0] + V_ratio * M_start[1];
|
125
126
|
} else {
|
126
127
|
p->U_pi = 0.0;
|
127
128
|
}
|
128
129
|
|
129
|
-
if (V
|
130
|
-
p->V_pi =
|
131
|
-
(V / sum) * M_start[3];
|
130
|
+
if (V > 0) {
|
131
|
+
p->V_pi = U_ratio * M_start[2] + V_ratio * M_start[3];
|
132
132
|
} else {
|
133
133
|
p->V_pi = 0.0;
|
134
134
|
}
|
@@ -153,13 +153,16 @@ static inline void update_pi_k(patch_t* restrict p, const double* restrict M_sta
|
|
153
153
|
|
154
154
|
|
155
155
|
static inline void update_mig_just_rate(patch_t* restrict p, const double* restrict P_start) {
|
156
|
+
// BUGGY - not using
|
156
157
|
// update migration weight for patch p, in location loc. Only rate is updated
|
157
|
-
// used by
|
158
|
+
// used by last-changed patch, when there is only one last-changed patch
|
158
159
|
double* p_U_weight = p->U_weight;
|
159
160
|
double* p_V_weight = p->V_weight;
|
160
161
|
|
161
162
|
double mu1_U = P_start[0] * (double)p->U;
|
162
163
|
double mu2_V = P_start[1] * (double)p->V;
|
164
|
+
p->sum_mig_rates = mu1_U + mu2_V;
|
165
|
+
|
163
166
|
double mu1_U_divide_sum = mu1_U / p->sum_U_weight;
|
164
167
|
double mu2_V_divide_sum = mu2_V / p->sum_V_weight;
|
165
168
|
|
@@ -167,14 +170,13 @@ static inline void update_mig_just_rate(patch_t* restrict p, const double* restr
|
|
167
170
|
p->mig_rates[i] = mu1_U_divide_sum * p_U_weight[i];
|
168
171
|
p->mig_rates[i + 4] = mu2_V_divide_sum * p_V_weight[i];
|
169
172
|
}
|
170
|
-
p->sum_mig_rates = mu1_U + mu2_V;
|
171
173
|
}
|
172
174
|
|
173
175
|
|
174
176
|
static inline uint8_t update_mig_weight_rate(patch_t* restrict p, const double* P_start, uint8_t loc) {
|
175
177
|
// update migration weight as well as rates, in one direction
|
176
178
|
// used by neighbors of last-changed patches
|
177
|
-
// also used by last-changed patches themselve, when there
|
179
|
+
// also used by last-changed patches themselve, when there are two patch changed, to update mig rates of in each other's direction
|
178
180
|
|
179
181
|
double* p_U_weight = p->U_weight;
|
180
182
|
double* p_V_weight = p->V_weight;
|
@@ -321,7 +323,7 @@ static inline void change_popu(patch_t* restrict p, uint8_t s) {
|
|
321
323
|
return;
|
322
324
|
case 2:
|
323
325
|
// Natural birth/death for U due to payoff
|
324
|
-
if (p->U_pi > 0
|
326
|
+
if (p->U_pi > 0) {
|
325
327
|
p->U += 1;
|
326
328
|
} else if (p->U > 0) {
|
327
329
|
p->U -= 1;
|
@@ -337,7 +339,7 @@ static inline void change_popu(patch_t* restrict p, uint8_t s) {
|
|
337
339
|
return;
|
338
340
|
default:
|
339
341
|
// Natural birth/death for V due to payoff
|
340
|
-
if (p->V_pi > 0
|
342
|
+
if (p->V_pi > 0) {
|
341
343
|
p->V += 1;
|
342
344
|
} else if (p->V > 0) {
|
343
345
|
p->V -= 1;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = '2.3.
|
1
|
+
__version__ = '2.3.4'
|
2
2
|
|
3
3
|
'''
|
4
4
|
version history:
|
@@ -39,4 +39,6 @@ version history:
|
|
39
39
|
Add video_fig function to figures module, which plots change of patch popu/payoff overtime in a 2D figure. Add auto-sorting for values passed to test_var plot functions.
|
40
40
|
2.3.2: allow play-with-self in payoff calculation. Changed migration function to e^(w*pi) (removed "1+" term).
|
41
41
|
Simplified update-migration functions, improve speed by ~10%. Add -march=native flag to Makefile.
|
42
|
+
2.3.3: fix error in calculation of migration rates.
|
43
|
+
2.3.4: change back to the mig & payoff rules in version 2.3.2
|
42
44
|
'''
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|