22import csv
33import itertools
44from multiprocessing import cpu_count
5+ import warnings
56
67import numpy as np
78import tqdm
@@ -405,12 +406,14 @@ def _build_initial_cooperation_count(self, initial_cooperation_count_series):
405406
406407 @update_progress_bar
407408 def _build_normalised_cooperation (self ):
408- normalised_cooperation = [
409- list (np .nan_to_num (row ))
410- for row in np .array (self .cooperation )
411- / sum (map (np .array , self .match_lengths ))
412- ]
413- return normalised_cooperation
409+ with warnings .catch_warnings ():
410+ warnings .simplefilter ("ignore" )
411+ normalised_cooperation = [
412+ list (np .nan_to_num (row ))
413+ for row in np .array (self .cooperation )
414+ / sum (map (np .array , self .match_lengths ))
415+ ]
416+ return normalised_cooperation
414417
415418 @update_progress_bar
416419 def _build_initial_cooperation_rate (self , interactions_series ):
@@ -420,10 +423,12 @@ def _build_initial_cooperation_rate(self, interactions_series):
420423 for player_index in range (self .num_players )
421424 ]
422425 )
423- initial_cooperation_rate = list (
424- np .nan_to_num (np .array (self .initial_cooperation_count ) / interactions_array )
425- )
426- return initial_cooperation_rate
426+ with warnings .catch_warnings ():
427+ warnings .simplefilter ("ignore" )
428+ initial_cooperation_rate = list (
429+ np .nan_to_num (np .array (self .initial_cooperation_count ) / interactions_array )
430+ )
431+ return initial_cooperation_rate
427432
428433 @update_progress_bar
429434 def _build_ranking (self ):
0 commit comments