# load the package badic (you can install it with "sage -pip install badic [--user]")
from badic import *
# we define a simple automaton
a = DetAutomaton([(0,1,0),(0,2,2),(1,1,0),(1,1,1),(1,1,2), (2,2,0),(2,2,2)], i=0)
a.plot()
# we take a beta-adic set with this automaton, for beta = 1/(1+sqrt(2))
# we see that it is a intervalle union a Cantor set
m = BetaAdicSet(1/(1+sqrt(2)), a)
print(m)
m.plot()
# compute a substitution from it
d = m.substitution()
d
# check that the Rauzy fractal is the one expected
s = WordMorphism(d)
print(s)
s.rauzy_fractal_plot()