from mpqp import QCircuit, Language
from mpqp.gates import *
from mpqp.noise import Depolarizing
from mpqp.measures import BasisMeasure
from mpqp.execution import *

Depolarizing(0.5, [0, 1, 2])

Depolarizing(0.1, [0, 1, 2], dimension=2)

Depolarizing(0.23, [2, 3], gates=[H, Rx, U])

d = Depolarizing(0.45, [1, 3, 4], dimension=2, gates=[CNOT, CZ])

d.to_other_language(Language.BRAKET)

print(d.to_other_language(Language.MY_QLM))

circuit_1 = QCircuit([H(0), CNOT(0,1), Y(1), BasisMeasure([0,1], shots=100), Depolarizing(0.3, [0], gates=[H])])
print(circuit_1)

circuit_2 = QCircuit([H(0), CNOT(0,1), Y(1), BasisMeasure([0,1], shots=100)])
circuit_2.add([Depolarizing(0.08, [0]), Depolarizing(0.13, [1])])
circuit_2.pretty_print()

print(circuit_2.noises)

circuit_2.without_noises()

noisy_braket_circuit = circuit_2.to_other_language(Language.BRAKET)
print(noisy_braket_circuit)

for device in AWSDevice:
    print(device.name, "|", device.is_noisy_simulator())

result = run(circuit_2, AWSDevice.BRAKET_LOCAL_SIMULATOR) # this line is valid for both noisy and non noisy cases
print(result)