# La lecture directe ne voit que la hauteur z du point
import cmath

import numpy as np
from common import bloch_vector, rounded
from qsim.etape1_un_qubit import make_state, probabilities, sample

for name, b in [("0", 0.8), ("π/2", 0.8j), ("π", -0.8), ("2", 0.8 * cmath.exp(2j))]:
    state = make_state(0.6, b)
    x, y, z = bloch_vector(state)
    p0 = probabilities(state)[0]
    print(f"φ = {name:<4} point = {rounded([x, y, z])}   P(0) = {p0:.3f}   (1 + z)/2 = {(1 + z) / 2:.3f}")

print("counts :", sample(make_state(0.6, 0.8j), 1000, seed=42))
