@@ -84,7 +84,7 @@ def calculate_H(flatgrid, grid_size):
8484 probabilities = get_sliding_window_probabilities (windows )
8585 Hs .append (entropy (probabilities ))
8686
87- return Hs [1 ], Hs [ grid_size ], np .mean (Hs )
87+ return Hs [1 ], np .mean (Hs )
8888
8989if __name__ == "__main__" :
9090 grid_size = 15
@@ -96,17 +96,17 @@ def calculate_H(flatgrid, grid_size):
9696 # 4) Random pattern
9797
9898 all_black = np .ones (grid_size * grid_size , dtype = int )
99- # assert calculate_entropy_profile (all_black, grid_size) == 0.0
99+ assert calculate_H (all_black , grid_size ) == ( 0.0 , 0.0 )
100100 print (calculate_H (all_black , grid_size ))
101101
102102 grid_with_one_centre = np .zeros (grid_size * grid_size , dtype = int )
103103 grid_with_one_centre [(grid_size * grid_size ) // 2 ] = 1
104- # assert calculate_H(grid_with_one_centre, grid_size) == 0.25
104+ assert calculate_H (grid_with_one_centre , grid_size ) == ( 0.18454249646999404 , 2.74023274483865 )
105105 print (calculate_H (grid_with_one_centre , grid_size ))
106106
107107 checkerboard = np .zeros (grid_size * grid_size , dtype = int )
108108 checkerboard [1 ::2 ] = 1
109- # assert calculate_H(checkerboard, grid_size) == 0.5
109+ assert calculate_H (checkerboard , grid_size ) == ( 1.0 , 0.932628161077425 )
110110 print (calculate_H (checkerboard , grid_size ))
111111
112112 random = np .random .choice ([0 , 1 ], size = (grid_size , grid_size ))
0 commit comments