33import os
44
55import matplotlib .pyplot as plt
6- import microstructpy as msp
76import numpy as np
87from matplotlib import collections
9- from matplotlib .offsetbox import OffsetImage , AnnotationBbox
8+ from matplotlib .offsetbox import AnnotationBbox
9+ from matplotlib .offsetbox import OffsetImage
1010
11- __author__ = 'Kenneth (Kip) Hart'
11+ import microstructpy as msp
1212
1313
1414def main (n_seeds , size_rng , pos_rng , k_lw ):
@@ -106,14 +106,13 @@ def main(n_seeds, size_rng, pos_rng, k_lw):
106106 # Create the Logo
107107 logo_im = np .copy (plt_im )
108108
109- xx , yy = np .meshgrid (np .arange (logo_im . shape [ 0 ]), np . arange ( logo_im .shape [ 1 ]) )
110- zz = - 0.2 * xx + 0.9 * yy
109+ xx , yy = np .meshgrid (* [ np .arange (n ) for n in logo_im .shape ] )
110+ zz = - 0.2 * xx + 0.9 * yy
111111 ss = (zz - zz .min ()) / (zz .max () - zz .min ())
112112
113113 c1 = [67 , 206 , 162 ]
114114 c2 = [24 , 90 , 157 ]
115115
116-
117116 logo_im [mask , - 1 ] = 0 # transparent background
118117
119118 # gradient
@@ -124,9 +123,9 @@ def main(n_seeds, size_rng, pos_rng, k_lw):
124123 logo_im = logo_im [inds ]
125124 logo_im = logo_im [:, inds ]
126125
127- pad_width = logo_im .shape [0 ]
128- pad_height = 0.5 * logo_im .shape [1 ]
129- pad_shape = np .array ([pad_width , pad_height , logo_im .shape [2 ]]).astype ('int' )
126+ pad_w = logo_im .shape [0 ]
127+ pad_h = 0.5 * logo_im .shape [1 ]
128+ pad_shape = np .array ([pad_w , pad_h , logo_im .shape [2 ]]).astype ('int' )
130129 logo_pad = np .zeros (pad_shape , dtype = logo_im .dtype )
131130 pad_im = np .concatenate ((logo_pad , logo_im , logo_pad ), axis = 1 )
132131 doc_im = np .concatenate ((logo_pad , pad_im , logo_pad ), axis = 1 )
@@ -141,7 +140,7 @@ def main(n_seeds, size_rng, pos_rng, k_lw):
141140 inds = np .linspace (0 , fav_im .shape [0 ] - 1 , favicon_size ).astype ('int' )
142141 fav_im = fav_im [inds ]
143142 fav_im = fav_im [:, inds ]
144-
143+
145144 plt .imsave (favicon_filename , fav_im , dpi = dpi , format = 'png' )
146145
147146 # Create the Social Banner
@@ -172,7 +171,6 @@ def main(n_seeds, size_rng, pos_rng, k_lw):
172171 plt .close ('all' )
173172
174173
175-
176174if __name__ == '__main__' :
177175 n_seeds = 14
178176 size_rng = 4
0 commit comments