You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Performs the inverse operatiion taking flat binary files and rebuilding the Python list of dictionaries required for plotting.
119
119
120
120
We use ```np.savez_compressed``` to reduce disk footprint for large arrays such as PCF results.
121
+
121
122
---
122
123
123
124
@@ -147,4 +148,73 @@ Since larger systems usually take longer to each SS, we scale the warmup and mea
147
148
148
149
Phase Space Utility: ```run_2d_sweep```
149
150
151
+
This is a high-throuput pipeline to generate raw data for boundary identification of the hydra effect and evo advantages.
152
+
153
+
We construct a massive list of individual sim jobs (tasks) to be executed in parallel.
154
+
Iterate through each combination of ```prey_births``` and ```prey_deaths``1.
155
+
156
+
For each parameter coordinate, we create two jobs:
157
+
1. Baseline (no evo)
158
+
2. Experimental (with evo)
159
+
160
+
Before launchng the parallel threads, we warm up the kernels to avoid JIT (Just in Time) Numba Compilation overhead.
161
+
162
+
Each task calls ```run_single_simulation``` indepdendetly and returns a dict of results collected into a master list.
163
+
164
+
We compress the results efficiently using ```save_sweep_binary``` to keep a managable output size. We log the metatdat by generating a ```sweep_metadat.json```.
165
+
166
+
---
167
+
168
+
169
+
Plotting Utility: ```generate_plots```
170
+
171
+
We resahpe the flat list of results into a grid based on the ```prey_birth``` and ```prey_death``` parameters. We get the mean population across replicates for eevry point and filter out random noise of individual runs. To get derivatives effectively, we use a Gaussian filter to make the Hydra calculation reliable.
172
+
173
+
The Hydra effect is quantified as follows:
174
+
- Use a numerical gradient acorss the smoothed population grid
175
+
- Idenitfy the region where the derivative is positive that marks counter-intuitive ecosystem dynamics.
176
+
- Compare evo with no-evo sets.
177
+
178
+
The function also computes spatial and criticality analysis as follows:
179
+
- Plot the power law exponent to show near phase transition regime
180
+
- Visualize PCF results. A low segregation index indicates predator and prey spatial separation, which indicates the Hydra effect in the CA model
181
+
- Overlay the Hydra boundary on top of the segreation heatmap to show correlation between spatial structure and population response (if existing)
182
+
183
+
184
+
We also calculate a relative advantage score to quantify the benifit of adaptation. We highlight regions where the baseline population went extinct but the evo population survived to show "evolutionary rescue".
185
+
186
+
----
187
+
Usage of the analysis script is recommended as follows:
188
+
189
+
bash
190
+
```
191
+
python pp_analysis.py --mode full # Run everything
192
+
python pp_analysis.py --mode sweep # Only 2D sweep
193
+
python pp_analysis.py --mode sensitivity # Only evolution sensitivity
194
+
python pp_analysis.py --mode fss # Only finite-size scaling
195
+
python pp_analysis.py --mode plot # Only generate plots from saved data
0 commit comments