def make_alternating_boolean_array(shape, first_value=True):
 if (len(shape) != 2):
  raise ValueError('Shape must be 2-dimensional. Given shape was {}'.format(shape))
 alternating = np.empty(shape, dtype=np.bool)
 for row in alternating:
  row[::2] = first_value
  row[1::2] = (not first_value)
  first_value = (not first_value)
 return alternating

def make_alternating_boolean_array ( shape , first_value = True ) : if ( len ( shape ) != 2 ) : raise ValueError ( 'Shape must be 2-dimensional. Given shape was {}' . format ( shape ) ) alternating = np . empty ( shape , dtype = np . bool ) for row in alternating : row [ : : 2 ] = first_value row [ 1 : : 2 ] = ( not first_value ) first_value = ( not first_value ) return alternating
create a 2d numpy array with the given shape containing alternating values of false .