Closed liu-zixiong closed 8 months ago
@tjstavenger-pnnl I cannot see any reason why the proposed rename would cause issues. Okay if we go ahead and adopt this change for cv_delay? @liu-zixiong has the fix ready to be pushed into main.
Fine with me. Looks like you added cv_delay
back in May, @kevincsmith.
Pushed cv_delay
gate label rename to main. No other gates were renamed.
Issue Currently, PhotonLossNoisePass._photon_loss_error() has two warning flags —
The first flag occurs whenever I run a circuit with just a single
cv_delay
, but otherwise does not affect the output . The second flag prevents me from applyingPhotonLossNoisePass
to circuits with a singlecv_delay
gate.Noise is not applied even though I am expecting amplitude damping.
Diagnostics Flag 1: The first warning occurs because
_photon_loss_error
is executed multiple times depending on the circuit. When I add print statements for diagnostics, the following outputs appear when I run the above circuit again:It seems that because
_photon_loss_error()
is called multiple times, the UserWarning will be generated even if a duration is provided. The code should probably be changed so that when the duration is provided, no warning is generated.Flag 2: The second warning happens because of how the label for cv_delay gate is
label="delay(" + str(duration) + " " + unit +")"
. This means that there is currently no difference between howcv_delay
and qiskit'sdelay
gates are labelled, and so_photon_loss_error()
is unable to differentiate between the two cases when they're called.This issue has an easy fix — replacing the label for
cv_delay
tolabel="cv_delay(" + str(duration) + " " + unit +")"
would be sufficient. But to prevent similar issues from happening with other gates, maybe it would be good practice to include a 'cv_' string in front of all bosonic qiskit gates? Doing so would however require a comprehensive renaming of all of the existing gates incircuit.py
.