def evolve(population_grid):

    cv_array = np.ones((3,3))
    nbrs_count = convolve2d(population_grid, cv_array, mode='same', boundary='wrap') - population_grid
    mask = (nbrs_count == 2)
    mask &= population_grid.astype(np.bool)
    mask |= (nbrs_count == 3)    

    return mask
Use convolve to update conways game
dataset/ETHPy150Open dgasmith/SICM2-Software-Summer-School-2014/Software_Carpentry/Conway/numpy_grid_conway.py/evolve