Cannot call QuantumChannelKraus type noise as gate noise in Hardware model. Use of lambda function leads to another error, bug raised as a previous issue. #28
Expected:
Either lambda function should be allowed, which accepts QuantumChannelKraus object or specifying the custom noise duration should be acceptable.
Exception: QLMServiceException: QLMServiceException(message="Internal Error: 'QuantumChannelKraus' object is not callable", service_name='Scheduler')
MWE: from qat.lang.AQASM import Program, H, CNOT, RX, RY, RZ #Gates from qlmaas.qpus import NoisyQProc import numpy as np from qat.hardware import GatesSpecification, HardwareModel, DefaultGatesSpecification, DefaultHardwareModel from qat.quops import ParametricGateNoise from qat.quops.quantum_channels import ParametricAmplitudeDamping from qlmaas.noisy import compute_fidelity from qat.quops import QuantumChannelKraus
T1 = 44000 # noise parameter T2 = 38000 # noise parameter gdur1 = 50 # gate duration T = 20 # noise model duration
alp = np.pi #rotation angle considered for the gate
simple program follows below
prog = Program() reg = prog.qalloc(1) prog.apply(RX(alp), reg[0]) circ = prog.to_circ()
gate specs and noise model follows
g_times = {"RX" : gdur1} #this works, lambda function specification does not gates_spec = DefaultGatesSpecification(gate_times=g_times) amp_damp = ParametricAmplitudeDamping(T_1 = T1)
the line commented below works, but restricts the noise duration to the gate duration
g_noise = {"RX": ParametricGateNoise(gates_spec, "RX", [ParametricAmplitudeDamping(T_1 = T1)])}
g_noise = {"RX" : amp_damp(tau = T)} #this does not work, raises error
hardware model instantiated
h_model = DefaultHardwareModel(gate_times=g_times, gate_noise= g_noise, idle_noise=None)
qpu with the noisy proc and above hardware model
qpu_predef = NoisyQProc(hardware_model = h_model, sim_method = 'stochastic')
calculate the fidelity
res3 = compute_fidelity(circ,qpu_predef) tes3 = res3.join() print(tes3)
Expected: Either lambda function should be allowed, which accepts QuantumChannelKraus object or specifying the custom noise duration should be acceptable.