def bauman(): proto = ((0, 0), (0, 1), (0, 2), (1, 2), (1, 1), (1, 0), (2, 0), (2, 1), (2, 2)) base_maps = [ BaseMap(perm=[1, 0], flip=[False, False]), BaseMap(perm=[1, 0], flip=[True, False]), BaseMap.id_map(dim=2), BaseMap(perm=[1, 0], flip=[False, True]), BaseMap(perm=[1, 0], flip=[True, True]), BaseMap(perm=[0, 1], flip=[False, True]), BaseMap(perm=[1, 0], flip=[False, False]), BaseMap(perm=[1, 0], flip=[True, False]), BaseMap.id_map(dim=2), ] bauman = FractalCurve(dim=2, div=3, proto=proto, base_maps=base_maps) bauman.estimate_ratio_vertex_brkline(ratio_l2, 3) #good.estimate_ratio(ratio, rel_tol=0.002, verbose=1) bauman = bauman.get_subdivision(1) pcurve = bauman.forget() pcurve = pcurve.changed(allow_time_rev=True) pcurve.estimate_ratio(ratio_l2, lower_bound=32.2, upper_bound=32.1, sat_pack=1000, find_model=True)
def pristalno(): proto = [ (0, 0), (1, 0), (1, 1), (0, 1), (0, 2), (1, 2), (1, 3), (0, 3), (0, 4), (1, 4), (2, 4), (2, 3), (3, 3), (3, 4), (4, 4), (4, 3), (4, 2), (3, 2), (2, 2), (2, 1), (2, 0), (3, 0), (3, 1), (4, 1), (4, 0), ] bmstrs = [ '(x,y)->(x,y)', '(x,y)->(y,1-x),t->1-t', '(x,y)->(y,1-x),t->1-t', '(x,y)->(1-x,1-y)', '(x,y)->(x,y)', '(x,y)->(y,1-x),t->1-t', '(x,y)->(y,1-x),t->1-t', '(x,y)->(1-x,1-y)', '(x,y)->(x,y)', '(x,y)->(x,y)', '(x,y)->(x,y)', '(x,y)->(1-y,x),t->1-t', '(x,y)->(y,1-x),t->1-t', '(x,y)->(x,y)', '(x,y)->(x,y)', '(x,y)->(1-y,x),t->1-t', '(x,y)->(1-x,1-y)', '(x,y)->(1-x,1-y)', '(x,y)->(1-y,x),t->1-t', '(x,y)->(1-y,x),t->1-t', '(x,y)->(1-y,x),t->1-t', '(x,y)->(y,1-x),t->1-t', '(x,y)->(x,y)', '(x,y)->(x,y)', '(x,y)->(1-y,x),t->1-t', ] base_maps = [bmstr2base_map(x) for x in bmstrs] curve = FractalCurve(dim=2, div=5, proto=proto, base_maps=base_maps) curve.check() print(curve.get_junctions()) print('entr:', curve.get_entrance()) print('exit:', curve.get_exit()) curve.estimate_ratio_new(ratio_l2, rel_tol=0.001, max_iter=1000) pcurve = curve.forget() pcurve.allow_time_rev = True result = pcurve.estimate_ratio(ratio_l2, lower_bound=31.2, upper_bound=31.3, find_model=True) if result: print('found:', result.proto, result.base_maps) else: print('NOT FOUND')