本文整理汇总了Python中Grid.Grid.rndGenerator方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.rndGenerator方法的具体用法?Python Grid.rndGenerator怎么用?Python Grid.rndGenerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grid.Grid
的用法示例。
在下文中一共展示了Grid.rndGenerator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Grid
# 需要导入模块: from Grid import Grid [as 别名]
# 或者: from Grid.Grid import rndGenerator [as 别名]
# IMAGE FILES
fname = 'milford1971_21.jpg'
ref_name = 'milford1999_21.jpg'
#ref_name = 'milford1999_21.jpg'
simulation = False;
# generate grid
prob_grid1 = Grid(add='prob_')
prob_grid2 = Grid(add='prob_')
grid1 = Grid()
grid2 = Grid()
#grid = Grid()
if simulation:
# generate random grid with size m
grid1.rndGenerator(grid_size=250, savePlots=False, name='rnd_simulation')
else:
# load Image to grid
grid1.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=False)
grid2.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=True)
prob_grid1.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=False)
prob_grid2.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=True)
# save initial state
#init = grid.grid.copy()
# Create CA with reference image
ca = CellularAutomata(prob_grid2, neighbourhood='Moore', rules='Conway', ref_name=ref_name)
#ca2 = CellularAutomata(grid2, neighbourhood='Moore', rules='Probabilistic', ref_name=ref_name)
#ca3 = CellularAutomata(prob_grid1, neighbourhood='Moore', rules='Conway', ref_name=ref_name)
#ca4 = CellularAutomata(prob_grid2, neighbourhood='Moore', rules='Probabilistic', ref_name=ref_name)