Exemple #1
0
### Main Function

r = Graph()

if init_fname == "":
    r.init_rectgrid(model_size, include_corners=False, wrap=False, cellsize=1)
    if block_size.a == 0:
        init_r = 30 * [0]
        init_r[0] = 1
        r.init_rvals([init_r, [-1], [0]])
    else:
        r.init_block(model_size=model_size,
                     block_size=block_size,
                     no_vals=param[10],
                     increment=param[11])
    r.to_csv(f_name, path)
else:
    #    r.init_ppm(init_fname,base_path+'\\maps\\',color_dict)
    r.from_csv(init_fname, base_path)

p = r.parcel_list()

footprint = r.parcel_fp(p[0], len(state_dict))
floor_area = r.parcel_flr(p[0], len(state_dict))
if out_fname != "":
    r.to_csv(out_fname, base_path)

t = History(r)
t.set_dict(color_dict, state_dict)

t.set_rule(base_path + '\\rules\\' + rule_fname)
## make it a loop
for i in range(0,param[29]-1):
    s = i*((param[29])-1.0)
    print

    r = Graph()

    if init_fname == "":
        r.init_rectgrid(model_size,include_corners=False,wrap=False,cellsize=1)
        if block_size.a == 0:
            init_r = 30 * [0]
            init_r[0] = 1
            r.init_rvals([init_r,[-1],[0]])
        else:
            r.init_block(model_size=model_size,block_size=block_size, no_vals = param[10], increment = param[11])
        r.to_csv(f_name,path)
    else:
    #    r.init_ppm(init_fname,base_path+'\\maps\\',color_dict)
        r.from_csv(init_fname,base_path)

    p = r.parcel_list()

    footprint = r.parcel_fp(p[0], len(state_dict))
    floor_area = r.parcel_flr(p[0], len(state_dict))
    if out_fname != "":
        r.to_csv(out_fname,base_path)


    t= History(r)
    t.set_dict(color_dict,state_dict)
Exemple #3
0
## make it a loop
for i in range(0,param[29]+1):
    print "test ",i
    s = round(i/(float(param[29])),2)
    random.seed(s)
    r = Graph()

    if init_fname == "":
        r.init_rectgrid(model_size,include_corners=False,wrap=False,cellsize=1)
        if block_size.a == 0:
            init_r = 30 * [0]
            init_r[0] = 1
            r.init_rvals([init_r,[-1],[0]])
        else:
            r.init_block(model_size=model_size,block_size=block_size, no_vals = param[10], increment = param[11])
        r.to_csv(f_name,path)
    else:
    #    r.init_ppm(init_fname,base_path+'\\maps\\',color_dict)
        r.from_csv(init_fname,base_path)
#
#    p = r.parcel_list()

#    footprint = r.parcel_fp(p[0], len(state_dict))
#    floor_area = r.parcel_flr(p[0], len(state_dict))
#    print "starting : ",footprint,"  far: ", floor_area
#    if out_fname != "":
#        r.to_csv(out_fname,base_path)


    t= History(r)
    t.set_dict(color_dict,state_dict)