piegy 2.1.8__cp38-cp38-win32.whl → 2.2.1__cp38-cp38-win32.whl

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/C_core/Makefile CHANGED
@@ -10,11 +10,11 @@ LDFLAGS_COMMON = -flto
10
10
 
11
11
  ## Flags for Debugging ##
12
12
  # slower, debuggable with lldb, with Address Sanitizer. Don't use in python
13
- #CFLAGS = -g -std=c99 -Wall -Wextra -MMD -MP -fsanitize=address,undefined -fno-omit-frame-pointer
14
- #LDFLAGS = -fsanitize=address,undefined
13
+ #CFLAGS_COMMON = -g -std=c99 -Wall -Wextra -MMD -MP -fsanitize=address,undefined -fno-omit-frame-pointer
14
+ #LDFLAGS_COMMON = -fsanitize=address,undefined
15
15
  # slower, regular build, allow lldb
16
- #CFLAGS = -g -std=c99 -Wall -Wextra -MMD -MP
17
- #LDFLAGS =
16
+ #CFLAGS_COMMON = -g -std=c99 -Wall -Wextra -MMD -MP
17
+ #LDFLAGS_COMMON =
18
18
 
19
19
 
20
20
  #### OS specific ####
@@ -54,7 +54,7 @@ DEPS = $(OBJ:.o=.d) $(RUNNER_DEPS)
54
54
  TEST = runner
55
55
  ifeq '$(findstring ;,$(PATH))' ';'
56
56
  # windows
57
- SHARED_LIB = piegyc.dll
57
+ SHARED_LIB = piegyc.pyd
58
58
  else
59
59
  SHARED_LIB = piegyc.so
60
60
  endif
@@ -83,7 +83,7 @@ $(SHARED_LIB): $(OBJ)
83
83
 
84
84
  # Clean build files
85
85
  clean:
86
- rm -f $(OBJ) $(RUNNER_OBJ) $(TEST) $(SHARED_LIB) $(DEPS)
86
+ rm -f $(OBJ) $(RUNNER_OBJ) $(TEST) $(SHARED_LIB) $(DEPS) *.so
87
87
 
88
88
  # Rebuild target: clean then all
89
89
  re: clean all
Binary file
piegy/C_core/sim_funcs.c CHANGED
@@ -506,7 +506,7 @@ void run(model_t* mod, char* message, size_t msg_len) {
506
506
  size_t i = 0;
507
507
 
508
508
  while (i < mod->sim_time) {
509
- char curr_msg[20 + msg_len]; // message for current round
509
+ char curr_msg[100 + msg_len]; // message for current round
510
510
  strcpy(curr_msg, message);
511
511
  strcat(curr_msg, "round ");
512
512
  snprintf(curr_msg + strlen(curr_msg), sizeof(curr_msg) - strlen(curr_msg), "%zu", i);
piegy/__init__.py CHANGED
@@ -27,8 +27,8 @@ from .data_tools import save_data, read_data
27
27
 
28
28
  from .analysis import rounds_expected, scale_maxtime, check_convergence, combine_sim
29
29
 
30
- from .figures import (UV_heatmap, UV_bar, UV_dyna, UV_hist, UV_std, UV_expected,
31
- pi_heatmap, pi_bar, pi_dyna, pi_hist, pi_std, UV_pi)
30
+ from .figures import (UV_hmap, UV_bar, UV_dyna, UV_hist, UV_std, UV_expected,
31
+ pi_hmap, pi_bar, pi_dyna, pi_hist, pi_std, UV_pi)
32
32
 
33
33
  from .test_var import (test_var1, var_UV1, var_pi1, var_convergence1, get_dirs1,
34
34
  test_var2, var_UV2, var_pi2, var_convergence2, get_dirs2)
@@ -42,8 +42,8 @@ data_members = ['save_data', 'read_data']
42
42
 
43
43
  analysis_members = ['expected_rounds', 'scale_maxtime', 'check_convergence', 'combine_mod']
44
44
 
45
- figures_members = ['UV_heatmap', 'UV_bar', 'UV_dyna', 'UV_hist', 'UV_std', 'UV_expected_val', 'UV_expected',
46
- 'pi_heatmap', 'pi_bar', 'pi_dyna', 'pi_hist', 'pi_std', 'UV_pi']
45
+ figures_members = ['UV_hmap', 'UV_bar', 'UV_dyna', 'UV_hist', 'UV_std', 'UV_expected_val', 'UV_expected',
46
+ 'pi_hmap', 'pi_bar', 'pi_dyna', 'pi_hist', 'pi_std', 'UV_pi']
47
47
 
48
48
  test_var_members = ['test_var1', 'var_UV1', 'var_pi1', 'var_convergence1', 'get_dirs1',
49
49
  'test_var2', 'var_UV2', 'var_pi2', 'var_convergence2', 'get_dirs2']
piegy/__version__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = '2.1.8'
1
+ __version__ = '2.2.1'
2
2
 
3
3
  '''
4
4
  version history:
@@ -29,5 +29,8 @@ version history:
29
29
  2.0.5: fix error in random number generator.
30
30
  2.1.0: redo random number generator. Update package upload so that more compatible across platforms.
31
31
  2.1.1: fix import bug for the C core.
32
- 2.1.2 ~ 2.1.8: updating wheel.
32
+ 2.1.2 ~ 2.1.9: updating & fixing wheel.
33
+ 2.1.10: fix print bug in run function.
34
+ 2.1.11: fix .so duplicate error.
35
+ 2.2.1: change heatmap plotting tool from Seaborn to Matplotlib. Change video maker to cv2 (opencv-python).
33
36
  '''
piegy/build_info.py CHANGED
@@ -4,9 +4,8 @@ Auto-generated at compile time.
4
4
  """
5
5
 
6
6
  build_info = {
7
- "version": "2.1.8",
8
- "built from": "wheel",
9
- "build date": "2025-06-28 08:04:33",
10
- "python version": "3.8.10",
7
+ "version": "2.2.1",
8
+ "build date": "2025-06-28 20:35:07",
9
+ "python used": "3.8.10",
11
10
  "platform": "win32"
12
11
  }
piegy/figures.py CHANGED
@@ -2,9 +2,9 @@
2
2
  Contains all the major plot functions.
3
3
 
4
4
  Plots for population:
5
- - UV_heatmap: Used for 2D space (both N, M > 1), plot distribution of U, V in all patches within a specified time interval.
5
+ - UV_hmap: Used for 2D space (both N, M > 1), plot distribution of U, V in all patches within a specified time interval.
6
6
  Average population over that interval is taken.
7
- - UV_bar: Used for 1D space (N or M == 1), counterpart of UV_heatmap.
7
+ - UV_bar: Used for 1D space (N or M == 1), counterpart of UV_hmap.
8
8
  Plot average distribution of U, V in a specified time interval in a barplot.
9
9
  - UV_dyna: Plot change of total U, V overtime.
10
10
  - UV_hist: Make a histogram of U, V in a specified time interval.
@@ -13,9 +13,9 @@ Plots for population:
13
13
 
14
14
 
15
15
  Plots for payoff:
16
- - pi_heatmap: Used for 2D space, plot distribution of Upi & Vpiwithin a specified time interval.
16
+ - pi_hmap: Used for 2D space, plot distribution of Upi & Vpiwithin a specified time interval.
17
17
  Average payoff over that interval is taken.
18
- - pi_bar: Used for 1D space, counterpart of pi_heatmap.
18
+ - pi_bar: Used for 1D space, counterpart of pi_hmap.
19
19
  Plot average distribution of Upi & Vpiin a specified time interval in a bar plot.
20
20
  - pi_dyna: Plot change of total Upi, Vpiovertime.
21
21
  - pi_hist: Make a histogram of Upi, Vpiin a specified time interval.
@@ -40,9 +40,12 @@ import numpy as np
40
40
  # used by UV_dyna, UV_std, and pi_dyna
41
41
  CURVE_TYPE = '-'
42
42
 
43
+ # default heatmap value range, which is None
44
+ DEFAULT_HMAP_VRANGE = (None, None)
43
45
 
44
46
 
45
- def UV_heatmap(mod, ax_U = None, ax_V = None, U_color = 'Purples', V_color = 'Greens', start = 0.95, end = 1.0, annot = False, fmt = '.3g'):
47
+
48
+ def UV_hmap(mod, ax_U = None, ax_V = None, U_color = 'Purples', V_color = 'Greens', start = 0.95, end = 1.0, vrange_U = DEFAULT_HMAP_VRANGE, vrange_V = DEFAULT_HMAP_VRANGE):
46
49
  '''
47
50
  Makes two heatmaps for U, V average distribution over a time interval, respectively. Works best for 2D space.
48
51
  1D works as well, but figures look bad.
@@ -76,8 +79,8 @@ def UV_heatmap(mod, ax_U = None, ax_V = None, U_color = 'Purples', V_color = 'Gr
76
79
  V_title = figure_t.gen_title('Popu V', start, end)
77
80
  V_text = figure_t.gen_text(np.mean(V_ave), np.std(V_ave))
78
81
 
79
- ax_U = figure_t.heatmap(U_ave, ax_U, U_color, annot, fmt, U_title, U_text)
80
- ax_V = figure_t.heatmap(V_ave, ax_V, V_color, annot, fmt, V_title, V_text)
82
+ figure_t.hmap(U_ave, ax_U, U_color, U_title, U_text, vmin = vrange_U[0], vmax = vrange_U[1])
83
+ figure_t.hmap(V_ave, ax_V, V_color, V_title, V_text, vmin = vrange_V[0], vmax = vrange_V[1])
81
84
 
82
85
  return ax_U, ax_V
83
86
 
@@ -252,7 +255,7 @@ def UV_std(mod, ax = None, interval = 20, grid = True):
252
255
 
253
256
 
254
257
 
255
- def UV_expected(mod, ax_U = None, ax_V = None, U_color = 'Purples', V_color = 'Greens', annot = False, fmt = '.3g'):
258
+ def UV_expected(mod, ax_U = None, ax_V = None, U_color = 'Purples', V_color = 'Greens', vrange_U = DEFAULT_HMAP_VRANGE, vrange_V = DEFAULT_HMAP_VRANGE):
256
259
  '''
257
260
  Calculate expected population distribution based on matrices, assuming no migration.
258
261
  For the formulas, see stochastic_mode.expected_UV
@@ -274,8 +277,8 @@ def UV_expected(mod, ax_U = None, ax_V = None, U_color = 'Purples', V_color = 'G
274
277
 
275
278
  if (mod.N != 1) and (mod.M != 1):
276
279
  # 2D
277
- ax_U = figure_t.heatmap(U_expected, ax_U, U_color, annot, fmt, title = 'Expected U', text = U_text)
278
- ax_V = figure_t.heatmap(V_expected, ax_V, V_color, annot, fmt, title = 'Expected V', text = V_text)
280
+ figure_t.hmap(U_expected, ax_U, U_color, title = 'Expected U', text = U_text, vmin = vrange_U[0], vmax = vrange_U[1])
281
+ figure_t.hmap(V_expected, ax_V, V_color, title = 'Expected V', text = V_text, vmin = vrange_V[0], vmax = vrange_V[1])
279
282
 
280
283
  else:
281
284
  # 1D
@@ -287,7 +290,7 @@ def UV_expected(mod, ax_U = None, ax_V = None, U_color = 'Purples', V_color = 'G
287
290
 
288
291
 
289
292
 
290
- def pi_heatmap(mod, ax_U = None, ax_V = None, U_color = 'BuPu', V_color = 'YlGn', start = 0.95, end = 1.0, annot = False, fmt = '.3g'):
293
+ def pi_hmap(mod, ax_U = None, ax_V = None, U_color = 'BuPu', V_color = 'YlGn', start = 0.95, end = 1.0, vrange_U = DEFAULT_HMAP_VRANGE, vrange_V = DEFAULT_HMAP_VRANGE):
291
294
  '''
292
295
  Make heatmaps for payoff in a specified interval.
293
296
  Works best for 2D. 1D works as well, but figures look bad.
@@ -296,7 +299,7 @@ def pi_heatmap(mod, ax_U = None, ax_V = None, U_color = 'BuPu', V_color = 'YlGn'
296
299
  Note the colors are matplotlib color maps.
297
300
 
298
301
  Returns:
299
- ax_U, ax_V: Seaborn heatmaps, for U's & V's payoff distribution, respectively.
302
+ ax_U, ax_V: matplotlibrn heatmaps, for U's & V's payoff distribution, respectively.
300
303
  '''
301
304
 
302
305
  start_index = int(mod.max_record * start)
@@ -310,8 +313,8 @@ def pi_heatmap(mod, ax_U = None, ax_V = None, U_color = 'BuPu', V_color = 'YlGn'
310
313
  V_title = figure_t.gen_title('Payoff ' + r'$p_V$', start, end)
311
314
  V_text = figure_t.gen_text(np.mean(V_pi_ave), np.std(V_pi_ave))
312
315
 
313
- ax_U = figure_t.heatmap(Upi_ave, ax_U, U_color, annot, fmt, U_title, U_text)
314
- ax_V = figure_t.heatmap(V_pi_ave, ax_V, V_color, annot, fmt, V_title, V_text)
316
+ figure_t.hmap(Upi_ave, ax_U, U_color, U_title, U_text, vmin = vrange_U[0], vmax = vrange_U[1])
317
+ figure_t.hmap(V_pi_ave, ax_V, V_color, V_title, V_text, vmin = vrange_V[0], vmax = vrange_V[1])
315
318
 
316
319
  return ax_U, ax_V
317
320
 
piegy/simulation.py CHANGED
@@ -12,7 +12,7 @@ Class & Functions:
12
12
  - check_overflow_func: check whether an overflow might happen in simulation. This is usually done automatically when init-ing a model.
13
13
  '''
14
14
 
15
- from . import find_C
15
+ from .tools import find_C
16
16
 
17
17
  import numpy as np
18
18
  import os
@@ -408,7 +408,7 @@ def run(mod, message = ""):
408
408
  if not mod.data_empty:
409
409
  raise ValueError('mod has non-empty data.')
410
410
 
411
- msg_len = len(message)
411
+ msg_len = len(message) * 2
412
412
  msg_bytes = message.encode('utf-8')
413
413
  msg_buffer = ctypes.create_string_buffer(msg_bytes, msg_len)
414
414
 
@@ -16,13 +16,13 @@ Functions:
16
16
 
17
17
  import matplotlib.pyplot as plt
18
18
  import numpy as np
19
- import seaborn as sns
19
+
20
20
 
21
21
  # move ax a bit left if add text
22
22
  # default value is [0.125, 0.11, 0.9, 0.88]
23
23
 
24
24
 
25
- def heatmap(data, ax = None, cmap = "Greens", annot = False, fmt = '.3g', title = None, text = None):
25
+ def hmap(data, ax = None, cmap = "Greens", title = None, text = None, vmin = None, vmax = None):
26
26
  '''
27
27
  Helper function for making heatmaps.
28
28
 
@@ -30,22 +30,23 @@ def heatmap(data, ax = None, cmap = "Greens", annot = False, fmt = '.3g', title
30
30
  data: 1D data for which you want to make a heatmap.
31
31
  ax: matplotlib ax to plot on.
32
32
  cmap: Color of heatmap. Uses matplotlib color maps
33
- annot: Whether to show numbers of every block.
34
- fmt: Number format for annotations. How many digits you want to keep.
35
33
  title: The title you want to add. None means no title.
36
34
  text: Adds some text in a text block at the top-right corner.
37
35
 
38
36
  Returns:
39
- fig: Seaborn heatmap.
37
+ ax: matplotlib axes with heatmap plotted upon.
40
38
  '''
41
39
 
42
40
  if ax == None:
43
- _, ax = plt.subplots()
41
+ fig, ax = plt.subplots()
42
+ else:
43
+ fig = ax.get_figure()
44
44
 
45
45
  if text != None:
46
46
  ax.text(0.8, 1.025, text, size = 10, linespacing = 1.5, transform = ax.transAxes)
47
47
 
48
- ax = sns.heatmap(data, ax = ax, cmap = cmap, annot = annot, fmt = fmt)
48
+ im = ax.imshow(data, cmap = cmap, vmin = vmin, vmax = vmax)
49
+ fig.colorbar(im, ax = ax)
49
50
  ax.set_title(title, x = 0.5, y = 1)
50
51
 
51
52
  return ax
@@ -66,19 +67,19 @@ def bar(data, ax = None, color = "green", xlabel = None, ylabel = None, title =
66
67
  text: Adds some text in a text block at the top-right corner.
67
68
 
68
69
  Returns:
69
- fig: A Matplotlib barplot.
70
+ ax: matplotlib axes with barplot made upon.
70
71
  '''
71
72
 
72
- N = np.array(data).size
73
- xaxis = np.array([i for i in range(N)])
73
+ NM = np.array(data).shape[0]
74
+ xaxis = np.array([i for i in range(NM)])
74
75
 
75
76
  if ax == None:
76
- if N > 60:
77
+ if NM > 60:
77
78
  # make figure larger if has more data points
78
- _, ax = plt.subplots(figsize = (min(N * 0.107, 6.4), 4.8))
79
+ _, ax = plt.subplots(figsize = (min(NM * 0.12, 7.2), 4.8))
79
80
  else:
80
81
  _, ax = plt.subplots()
81
-
82
+
82
83
  if text != None:
83
84
  ax.text(0.7, 1.025, text, size = 10, linespacing = 1.5, transform = ax.transAxes)
84
85
 
@@ -102,7 +103,7 @@ def scatter(X, Y, ax = None, color = "orange", alpha = 0.25, xlabel = "x", ylabe
102
103
  Note color is Matplotlib colors.
103
104
 
104
105
  Returns:
105
- fig: A Matplotlib scatter plot.
106
+ ax: matplotlib axes with scatter plot made upon.
106
107
  '''
107
108
 
108
109
  if ax == None:
@@ -6,12 +6,12 @@ import os
6
6
 
7
7
 
8
8
  def find_C():
9
- C_core_path = os.path.join(os.path.dirname(__file__), 'C_core')
9
+ C_core_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'C_core')
10
10
  C_list = os.listdir(C_core_path)
11
11
  for file in C_list:
12
12
  if file[-3:] == '.so':
13
13
  return C_core_path + '/' + file
14
- if file[-4:] == '.dll':
14
+ if file[-4:] == '.pyd':
15
15
  return C_core_path + '/' + file
16
16
 
17
17
  raise FileNotFoundError('C computation core not found. You can either compile manully or use the Python core instead. Please see docs.')
piegy/videos.py CHANGED
@@ -25,17 +25,18 @@ import matplotlib as mpl
25
25
  import matplotlib.pyplot as plt
26
26
  import numpy as np
27
27
  import os
28
+ from cv2 import imread, VideoWriter, VideoWriter_fourcc
28
29
  from moviepy import ImageSequenceClip
29
30
 
30
31
 
31
32
  # a list of supported figures
32
- SUPPORTED_FIGURES = ['UV_heatmap', 'pi_heatmap', 'UV_bar', 'pi_bar', 'UV_hist', 'pi_hist', 'UV_pi']
33
+ SUPPORTED_FIGURES = ['UV_hmap', 'pi_hmap', 'UV_bar', 'pi_bar', 'UV_hist', 'pi_hist', 'UV_pi']
33
34
 
34
35
 
35
36
  # map function name to functios in figures.py
36
37
  # functions not in this dictionary is not supported for videos.
37
- FUNC_DICT = {'UV_heatmap': figures.UV_heatmap, 'UV_bar': figures.UV_bar, 'UV_hist': figures.UV_hist,
38
- 'pi_heatmap': figures.pi_heatmap, 'pi_bar': figures.pi_bar, 'pi_hist': figures.pi_hist, 'UV_pi': figures.UV_pi}
38
+ FUNC_DICT = {'UV_hmap': figures.UV_hmap, 'UV_bar': figures.UV_bar, 'UV_hist': figures.UV_hist,
39
+ 'pi_hmap': figures.pi_hmap, 'pi_bar': figures.pi_bar, 'pi_hist': figures.pi_hist, 'UV_pi': figures.UV_pi}
39
40
 
40
41
 
41
42
  # Map some color maps to regular colors, used to change colors when an invalid color name is given
@@ -53,7 +54,7 @@ def convert_color(func_name, U_color, V_color):
53
54
  If making barplot or histogram videos but gave single colors, map to Matplotlib
54
55
  '''
55
56
 
56
- if 'heatmap' in func_name:
57
+ if 'hmap' in func_name:
57
58
  # if making heatmaps but give regular colors
58
59
  if U_color in PLT_SNS_COLOR_DICT.keys():
59
60
  print('Making heatmaps, changed \'' + U_color + '\' to \'' + PLT_SNS_COLOR_DICT[U_color] + '\'')
@@ -64,7 +65,7 @@ def convert_color(func_name, U_color, V_color):
64
65
 
65
66
  return U_color, V_color
66
67
 
67
- elif 'heatmap' not in func_name:
68
+ elif 'hmap' not in func_name:
68
69
  # if making barplots or histogram
69
70
  if U_color in SNS_PLT_COLOR_DICT.keys():
70
71
  print('Not making heatmaps, changed \'' + U_color + '\' to \'' + SNS_PLT_COLOR_DICT[U_color] + '\'')
@@ -166,10 +167,10 @@ def frame_heatmap_lim(mod, func, frames):
166
167
  for i in range(10):
167
168
  fig_U, ax_U = plt.subplots()
168
169
  fig_V, ax_V = plt.subplots()
169
- ax_U, ax_V = func(mod, ax_U = ax_U, ax_V = ax_V, start = i / 10, end = (i / 10 + 1 / frames))
170
+ func(mod, ax_U = ax_U, ax_V = ax_V, start = i / 10, end = (i / 10 + 1 / frames))
170
171
 
171
- U_list.append(ax_U.collections[0].get_clim())
172
- V_list.append(ax_V.collections[0].get_clim())
172
+ U_list.append(ax_U.images[0].get_clim())
173
+ V_list.append(ax_V.images[0].get_clim())
173
174
 
174
175
  plt.close(fig_U)
175
176
  plt.close(fig_V)
@@ -193,17 +194,25 @@ def make_mp4(video_dir, frame_dir, fps):
193
194
 
194
195
  frame_paths_incomplete = os.listdir(frame_dir)
195
196
  frame_paths_incomplete.sort(key=lambda f: int(''.join(filter(str.isdigit, f))))
196
- frame_paths = []
197
- for path in frame_paths_incomplete:
198
- if (path[-4:] == '.png') and ('frame' in path):
199
- frame_paths.append(frame_dir + '/' + path)
200
- clip = ImageSequenceClip(frame_paths, fps = fps)
201
- clip.write_videofile(video_dir, logger = None)
197
+ frame_path = []
198
+ for file in frame_paths_incomplete:
199
+ if (file[-4:] == '.png') and ('frame' in file):
200
+ frame_path.append(os.path.join(frame_dir, file))
201
+
202
+ first_frame = imread(frame_path[0])
203
+ height, width, _ = first_frame.shape
204
+ fourcc = VideoWriter_fourcc(*'mp4v')
205
+ video_writer = VideoWriter(video_dir, fourcc, fps, (width, height))
206
+
207
+ for file in frame_path:
208
+ frame = imread(file)
209
+ video_writer.write(frame)
210
+ video_writer.release()
202
211
 
203
212
 
204
213
 
205
214
 
206
- def make_video(mod, func_name = 'UV_heatmap', frames = 100, dpi = 200, fps = 30, U_color = 'Greens', V_color = 'Purples', annot = False, fmt = '.3g', del_frames = False, dirs = 'videos'):
215
+ def make_video(mod, func_name = 'UV_hmap', frames = 100, dpi = 200, fps = 30, U_color = 'Greens', V_color = 'Purples', annot = False, fmt = '.3g', del_frames = False, dirs = 'videos'):
207
216
  '''
208
217
  Make a mp4 video based on simulation results.
209
218
 
@@ -232,7 +241,7 @@ def make_video(mod, func_name = 'UV_heatmap', frames = 100, dpi = 200, fps = 30,
232
241
  one_progress = frames / 100
233
242
  current_progress = one_progress
234
243
 
235
- if 'heatmap' in func_name:
244
+ if 'hmap' in func_name:
236
245
  # make sure a fixed color bar for all frames
237
246
  U_clim, V_clim = frame_heatmap_lim(mod, func, frames)
238
247
  else:
@@ -249,7 +258,10 @@ def make_video(mod, func_name = 'UV_heatmap', frames = 100, dpi = 200, fps = 30,
249
258
  if os.path.exists(V_frame_dirs):
250
259
  file_t.del_dirs(V_frame_dirs)
251
260
  os.makedirs(V_frame_dirs)
261
+
262
+ figsize = (6.4, 4.8)
252
263
 
264
+
253
265
  #### for loop ####
254
266
 
255
267
  for i in range(frames):
@@ -257,17 +269,22 @@ def make_video(mod, func_name = 'UV_heatmap', frames = 100, dpi = 200, fps = 30,
257
269
  print('making frames', round(i / frames * 100), '%', end = '\r')
258
270
  current_progress += one_progress
259
271
 
260
- fig_U, ax_U = plt.subplots(figsize = (6.4, 4.8))#, constrained_layout = True)
261
- fig_V, ax_V = plt.subplots(figsize = (6.4, 4.8))#, constrained_layout = True)
272
+ if ('bar' in func_name) and (mod.M > 60):
273
+ figsize = (min(mod.M * 0.12, 7.2), 4.8)
274
+ fig_U, ax_U = plt.subplots(figsize = figsize)
275
+ fig_V, ax_V = plt.subplots(figsize = figsize)
276
+ else:
277
+ fig_U, ax_U = plt.subplots(figsize = figsize)#, constrained_layout = True)
278
+ fig_V, ax_V = plt.subplots(figsize = figsize)#, constrained_layout = True)
262
279
 
263
- if 'heatmap' in func_name:
264
- ax_U, ax_V = func(mod, ax_U = ax_U, ax_V = ax_V, U_color = U_color, V_color = V_color, start = i / frames, end = (i + 1) / frames, annot = annot, fmt = fmt)
280
+ if 'hmap' in func_name:
281
+ func(mod, ax_U = ax_U, ax_V = ax_V, U_color = U_color, V_color = V_color, start = i / frames, end = (i + 1) / frames, vrange_U = U_clim, vrange_V = V_clim)
265
282
  else:
266
- ax_U, ax_V = func(mod, ax_U = ax_U, ax_V = ax_V, U_color = U_color, V_color = V_color, start = i / frames, end = (i + 1) / frames)
283
+ func(mod, ax_U = ax_U, ax_V = ax_V, U_color = U_color, V_color = V_color, start = i / frames, end = (i + 1) / frames)
267
284
 
268
- if 'heatmap' in func_name:
269
- ax_U.collections[0].set_clim(U_clim)
270
- ax_V.collections[0].set_clim(V_clim)
285
+ if 'hmap' in func_name:
286
+ # color map lim already set at function call
287
+ pass
271
288
  else:
272
289
  # make sure y axis not changing if not heatmap and not UV_pi
273
290
  ax_U.set_ylim(U_ylim)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: piegy
3
- Version: 2.1.8
3
+ Version: 2.2.1
4
4
  Summary: Payoff-Driven Stochastic Spatial Model for Evolutionary Game Theory
5
5
  Author-email: Chenning Xu <cxu7@caltech.edu>
6
6
  License: BSD 3-Clause License
@@ -50,7 +50,7 @@ License-File: LICENSE.txt
50
50
  Requires-Dist: numpy
51
51
  Requires-Dist: matplotlib
52
52
  Requires-Dist: moviepy>=2.1.1
53
- Requires-Dist: seaborn>=0.13.2
53
+ Requires-Dist: opencv-python>=4
54
54
 
55
55
  # piegy
56
56
 
@@ -0,0 +1,29 @@
1
+ piegy/__init__.py,sha256=S7sneddaatLkZvvnQT34XbO34sTR4ZN1R5BinVj3Tkw,2162
2
+ piegy/__version__.py,sha256=5vRg60QoKwH4j7IsifSwaQ2bA9mMcJgdK0z4236oD28,1838
3
+ piegy/analysis.py,sha256=tJhJTSFJsK_Zr34s78Cy7Im1NtONctkdNmg0R0teTeU,8941
4
+ piegy/build_info.py,sha256=WhbVR2ixaVo73KxX4Eq2rsWUBCajJNiYH59BzKT5oF8,259
5
+ piegy/data_tools.py,sha256=uYEoCYO7ZVtKBsNDgco7kERvBlOFFK7wpTuqcCwCBEU,3573
6
+ piegy/figures.py,sha256=gRlydsRU0eVENZV4ZxAwg9ZuJ3B428vn0S1FL_inVuU,18714
7
+ piegy/simulation.py,sha256=rtl6wCZiN-Cm5s6PAHTuNrOvKMB5E6RAJpIij1NZxYk,20553
8
+ piegy/simulation_py.py,sha256=BC87ONd3-OG9e8ri_8EP83QagEPPp-dMJ5pJJTa1pcw,30319
9
+ piegy/test_var.py,sha256=weIaC-3jL9A3tLa_kpqPVLR0NQHwzzhaMtP8P0sFlA4,24145
10
+ piegy/videos.py,sha256=UooJuVyeHY-PUXInSbigwgz3H-wvOkCfFwNC8883pZM,10980
11
+ piegy/C_core/Makefile,sha256=zmz8o-XM6cqutVQ0odQk9eR8w56KK4snmn7dXAUqMEg,2199
12
+ piegy/C_core/model.c,sha256=v4vOs7HGcyOpIKWQPoT8uqLaA4NRSkaUuShowlrbjeM,2962
13
+ piegy/C_core/model.h,sha256=WijCKKxdHn4Zz_F5NDmCy9lBA5KonWuHR0kfUxcB5b0,1234
14
+ piegy/C_core/patch.c,sha256=eMzYYgOYWuWnviko50wQC5m5qxn0on3T9r-HXf9NrV0,1075
15
+ piegy/C_core/patch.h,sha256=EDuO7-0lgLmqvA7H1sCf0rlGkpUfJgbMreLImXfCqxo,1006
16
+ piegy/C_core/piegyc.cp38-win32.pyd,sha256=VU6nx9CwSzMXBFtIwT7UpfMtKJTt6aWvSIBE9QX2kvg,74801
17
+ piegy/C_core/piegyc.h,sha256=GDBAJriWzDWtwt8zq-2SecAdRcj-SD4BlDNP58lEjcg,1127
18
+ piegy/C_core/runner.c,sha256=oadftcKjDNtdWMgmJ0-aMLZTodEXtv6FBmhpYIGLg-k,1637
19
+ piegy/C_core/sim_funcs.c,sha256=9hy9iNASWgnGKZCiUPT_QZq7AsKgKT2eYgpaXSNN170,19392
20
+ piegy/C_core/sim_funcs.h,sha256=6EsxZeT4gqVdmU7DMfZ4PW7k_zANyS4nYJxKju_5rR4,15691
21
+ piegy/tools/__init__.py,sha256=Zcr2OExiwY_Zeh_vVwDjbuHtTaI_eHOe8xwzgsVdja0,315
22
+ piegy/tools/figure_tools.py,sha256=SxAdNmsrlP5Gpbs7zF8X70--ttM_osJCu2lm8Bi69a8,7184
23
+ piegy/tools/file_tools.py,sha256=ThXsc2gBX8SbJWW07afolz1oHH0dJQfMvn9D3b-y7TE,659
24
+ piegy/tools/find_C.py,sha256=qjKsG41apLvP3I2tQIQQgXGNVefIioOueD49VyfA-2Q,530
25
+ piegy-2.2.1.dist-info/LICENSE.txt,sha256=1ihCy5mwfvcRiquE82AHAMhd4iVUzDfgL7eG8_tPwQ0,1526
26
+ piegy-2.2.1.dist-info/METADATA,sha256=uQc25w0_M4fqOSs3exu1lpZgZVrzUkAdfnpKjaz07HI,5526
27
+ piegy-2.2.1.dist-info/WHEEL,sha256=BsoMMMHJGneA25n2FDquZW143lDYOuIAMJ0po_3Su94,95
28
+ piegy-2.2.1.dist-info/top_level.txt,sha256=k4QLYL8PqdqDuy95-4NZD_FVLqJDsmq67tpKkBn4vMw,6
29
+ piegy-2.2.1.dist-info/RECORD,,
@@ -1,29 +0,0 @@
1
- piegy/__init__.py,sha256=rF5yoSworW16VW3zqWYTxzyMrZQowyT13yDkgIjXIgA,2174
2
- piegy/__version__.py,sha256=HvrCytFABttRcsFUVtfqnlgwTSD0kcKj5InsPROAoxc,1647
3
- piegy/analysis.py,sha256=tJhJTSFJsK_Zr34s78Cy7Im1NtONctkdNmg0R0teTeU,8941
4
- piegy/build_info.py,sha256=Ays6r8P3N4nJeP2LdpXCBTZt1tAiqh1ENLFGflX5F8Y,290
5
- piegy/data_tools.py,sha256=uYEoCYO7ZVtKBsNDgco7kERvBlOFFK7wpTuqcCwCBEU,3573
6
- piegy/figures.py,sha256=QAbCoIopa0FRkReXBG0ExFvG-wNevI8hK8Ar-Ph14II,18427
7
- piegy/find_C.py,sha256=WejlqnyDg_1MQYQsiaAnbmUNjC09--7peVOxdxnd20A,513
8
- piegy/simulation.py,sha256=c98akqy2fja61QwW7c3RFpxcSD0aeRzyiqnQ-TVcnc0,20544
9
- piegy/simulation_py.py,sha256=BC87ONd3-OG9e8ri_8EP83QagEPPp-dMJ5pJJTa1pcw,30319
10
- piegy/test_var.py,sha256=weIaC-3jL9A3tLa_kpqPVLR0NQHwzzhaMtP8P0sFlA4,24145
11
- piegy/videos.py,sha256=meG3kNCnmAsEc2LtLGk2VixQZ9Nx4dRYwK7DB17_LFk,10521
12
- piegy/C_core/Makefile,sha256=4EWFxgeCuecXy119zAV7lrdnv2JEdYNEvxIHf1Ztf9Q,2166
13
- piegy/C_core/model.c,sha256=v4vOs7HGcyOpIKWQPoT8uqLaA4NRSkaUuShowlrbjeM,2962
14
- piegy/C_core/model.h,sha256=WijCKKxdHn4Zz_F5NDmCy9lBA5KonWuHR0kfUxcB5b0,1234
15
- piegy/C_core/patch.c,sha256=eMzYYgOYWuWnviko50wQC5m5qxn0on3T9r-HXf9NrV0,1075
16
- piegy/C_core/patch.h,sha256=EDuO7-0lgLmqvA7H1sCf0rlGkpUfJgbMreLImXfCqxo,1006
17
- piegy/C_core/piegyc.cp38-win32.pyd,sha256=kd5JxF1eO00sczwlZazOTsHbctYoP7mtuVXCdWQiiKY,74801
18
- piegy/C_core/piegyc.h,sha256=GDBAJriWzDWtwt8zq-2SecAdRcj-SD4BlDNP58lEjcg,1127
19
- piegy/C_core/runner.c,sha256=oadftcKjDNtdWMgmJ0-aMLZTodEXtv6FBmhpYIGLg-k,1637
20
- piegy/C_core/sim_funcs.c,sha256=trYhRWL_KfsK96Mx7_izWHGJjgSbI7vv6DCU9bYxtug,19391
21
- piegy/C_core/sim_funcs.h,sha256=6EsxZeT4gqVdmU7DMfZ4PW7k_zANyS4nYJxKju_5rR4,15691
22
- piegy/tools/__init__.py,sha256=Zcr2OExiwY_Zeh_vVwDjbuHtTaI_eHOe8xwzgsVdja0,315
23
- piegy/tools/figure_tools.py,sha256=pz7Y2L1S1rVpbjwUwlsp1v1LRgi8IJq8ybLDn3woSNg,7213
24
- piegy/tools/file_tools.py,sha256=ThXsc2gBX8SbJWW07afolz1oHH0dJQfMvn9D3b-y7TE,659
25
- piegy-2.1.8.dist-info/LICENSE.txt,sha256=1ihCy5mwfvcRiquE82AHAMhd4iVUzDfgL7eG8_tPwQ0,1526
26
- piegy-2.1.8.dist-info/METADATA,sha256=SAWlbxfjHlU9mG4eLIn320iU0gkBfLeOYVY-M4DV4pE,5525
27
- piegy-2.1.8.dist-info/WHEEL,sha256=BsoMMMHJGneA25n2FDquZW143lDYOuIAMJ0po_3Su94,95
28
- piegy-2.1.8.dist-info/top_level.txt,sha256=k4QLYL8PqdqDuy95-4NZD_FVLqJDsmq67tpKkBn4vMw,6
29
- piegy-2.1.8.dist-info/RECORD,,
File without changes