# makes weyl plot of candidate gates with basic metrics
from slam.utils.gates.bare_candidates import build_gates
import numpy as np
from slam.utils.gates.duraton_scaling import atomic_cost_scaling
from matplotlib import colors
from slam.utils.visualize import coordinate_2dlist_weyl

unitary_list, coordinate_list = build_gates()
color_list = []
speed_method = "linear"
for u in unitary_list[1:]:
    h, _ = atomic_cost_scaling(
        params=u.params, scores=np.array([0]), speed_method=speed_method, duration_1q=0
    )
    color_list.append(h.duration)

fig = coordinate_2dlist_weyl(
    np.array(coordinate_list[1:]).reshape(-1, 3),
    c=color_list,
    elev=90,
    azim=-90,
    cmap="viridis",
);

fig = coordinate_2dlist_weyl(
    np.array(coordinate_list[1:]).reshape(-1, 3),
    c=color_list,
    elev=90,
    azim=-90,
    cmap="viridis",
);
# fig.tight_layout()
# save matplotlib fig as pdf
# fig.savefig(f'/home/evm9/decomposition_EM/images/weyl_plot_{speed_method}_haar.pdf', format='pdf')