Skip to content

Commit 8937f4d

Browse files
committed
Sort the internal data.
As reported by @gaffney2010, it is possible that the rows of the cooperation rate array are now longer in order (I believe this to happen on python < 3.6 because of ordering of dicts). This simple fix ensures that this doesn't happen.
1 parent c3433d8 commit 8937f4d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

axelrod/fingerprint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ def fingerprint(self, turns: int = 50, repetitions: int = 1000,
411411
noise: float = None, processes: int = None,
412412
filename: str = None,
413413
progress_bar: bool = True) -> np.array:
414-
"""Creates a spatial tournament to run the necessary matches to obtain
414+
"""Creates a spatial tournament to run the necessary matches to obtain
415415
fingerprint data.
416-
416+
417417
Creates the opponents and their edges then builds a spatial tournament.
418418
419419
Parameters
@@ -499,7 +499,7 @@ def analyse_cooperation_ratio(filename):
499499
cooperation_rates[index] = np.mean(rates, axis=0)
500500

501501
return np.array([cooperation_rates[index]
502-
for index in cooperation_rates])
502+
for index in sorted(cooperation_rates)])
503503

504504
def plot(self, cmap: str = 'viridis', interpolation: str = 'none',
505505
title: str = None, colorbar: bool = True, labels: bool = True,
@@ -568,4 +568,4 @@ def plot(self, cmap: str = 'viridis', interpolation: str = 'none',
568568
cbar = fig.colorbar(mat, cax=cax, ticks=ticks)
569569

570570
plt.tight_layout()
571-
return fig
571+
return fig

0 commit comments

Comments
 (0)