@@ -47,6 +47,8 @@ class CouplerPulse(cirq.ops.Gate):
4747 coupling_mhz: Target qubit-qubit coupling reached at the plateau.
4848 rise_time: Width of the rising (or falling) section of the trapezoidal pulse.
4949 padding_time: Symmetric padding around the coupler pulse.
50+ q0_detune_mhz: Detuning of the first qubit.
51+ q1_detune_mhz: Detuning of the second qubit.
5052 """
5153
5254 def __init__ (
@@ -55,6 +57,8 @@ def __init__(
5557 coupling_mhz : cirq .TParamVal ,
5658 rise_time : Optional [cirq .Duration ] = cirq .Duration (nanos = 8 ),
5759 padding_time : Optional [cirq .Duration ] = cirq .Duration (nanos = 2.5 ),
60+ q0_detune_mhz : cirq .TParamVal = 0.0 ,
61+ q1_detune_mhz : cirq .TParamVal = 0.0 ,
5862 ):
5963 """Inits CouplerPulse.
6064
@@ -63,12 +67,16 @@ def __init__(
6367 coupling_mhz: Target qubit-qubit coupling reached at the plateau.
6468 rise_time: Width of the rising (or falling) action of the trapezoidal pulse.
6569 padding_time: Symmetric padding around the coupler pulse.
70+ q0_detune_mhz: Detuning of the first qubit.
71+ q1_detune_mhz: Detuning of the second qubit.
6672
6773 """
6874 self .hold_time = hold_time
6975 self .coupling_mhz = coupling_mhz
7076 self .rise_time = rise_time or cirq .Duration (nanos = 8 )
7177 self .padding_time = padding_time or cirq .Duration (nanos = 2.5 )
78+ self .q0_detune_mhz = q0_detune_mhz
79+ self .q1_detune_mhz = q1_detune_mhz
7280
7381 def num_qubits (self ) -> int :
7482 return 2
@@ -79,18 +87,22 @@ def _unitary_(self) -> np.ndarray:
7987 def __repr__ (self ) -> str :
8088 return (
8189 'cirq_google.experimental.ops.coupler_pulse.'
82- + f'CouplerPulse(hold_time={ proper_repr (self .hold_time )} , '
83- + f'coupling_mhz={ proper_repr (self .coupling_mhz )} , '
84- + f'rise_time={ proper_repr (self .rise_time )} , '
85- + f'padding_time={ proper_repr (self .padding_time )} )'
90+ f'CouplerPulse(hold_time={ proper_repr (self .hold_time )} , '
91+ f'coupling_mhz={ proper_repr (self .coupling_mhz )} , '
92+ f'rise_time={ proper_repr (self .rise_time )} , '
93+ f'padding_time={ proper_repr (self .padding_time )} , '
94+ f'q0_detune_mhz={ proper_repr (self .q0_detune_mhz )} , '
95+ f'q1_detune_mhz={ proper_repr (self .q1_detune_mhz )} )'
8696 )
8797
8898 def __str__ (self ) -> str :
8999 return (
90100 f'CouplerPulse(hold_time={ self .hold_time } , '
91- + f'coupling_mhz={ self .coupling_mhz } , '
92- + f'rise_time={ self .rise_time } , '
93- + f'padding_time={ self .padding_time } )'
101+ f'coupling_mhz={ self .coupling_mhz } , '
102+ f'rise_time={ self .rise_time } , '
103+ f'padding_time={ self .padding_time } , '
104+ f'q0_detune_mhz={ self .q0_detune_mhz } , '
105+ f'q1_detune_mhz={ self .q1_detune_mhz } )'
94106 )
95107
96108 def _is_parameterized_ (self ) -> bool :
@@ -99,6 +111,8 @@ def _is_parameterized_(self) -> bool:
99111 or cirq .is_parameterized (self .coupling_mhz )
100112 or cirq .is_parameterized (self .rise_time )
101113 or cirq .is_parameterized (self .padding_time )
114+ or cirq .is_parameterized (self .q0_detune_mhz )
115+ or cirq .is_parameterized (self .q1_detune_mhz )
102116 )
103117
104118 def _parameter_names_ (self : Any ) -> AbstractSet [str ]:
@@ -107,6 +121,8 @@ def _parameter_names_(self: Any) -> AbstractSet[str]:
107121 | cirq .parameter_names (self .coupling_mhz )
108122 | cirq .parameter_names (self .rise_time )
109123 | cirq .parameter_names (self .padding_time )
124+ | cirq .parameter_names (self .q0_detune_mhz )
125+ | cirq .parameter_names (self .q1_detune_mhz )
110126 )
111127
112128 def _resolve_parameters_ (
@@ -117,16 +133,37 @@ def _resolve_parameters_(
117133 coupling_mhz = cirq .resolve_parameters (self .coupling_mhz , resolver , recursive = recursive ),
118134 rise_time = cirq .resolve_parameters (self .rise_time , resolver , recursive = recursive ),
119135 padding_time = cirq .resolve_parameters (self .padding_time , resolver , recursive = recursive ),
136+ q0_detune_mhz = cirq .resolve_parameters (
137+ self .q0_detune_mhz , resolver , recursive = recursive
138+ ),
139+ q1_detune_mhz = cirq .resolve_parameters (
140+ self .q1_detune_mhz , resolver , recursive = recursive
141+ ),
120142 )
121143
122144 def _value_equality_values_ (self ) -> Any :
123- return self .hold_time , self .coupling_mhz , self .rise_time , self .padding_time
145+ return (
146+ self .hold_time ,
147+ self .coupling_mhz ,
148+ self .rise_time ,
149+ self .padding_time ,
150+ self .q0_detune_mhz ,
151+ self .q1_detune_mhz ,
152+ )
124153
125154 def _circuit_diagram_info_ (self , args : cirq .CircuitDiagramInfoArgs ) -> Tuple [str , ...]:
126155 s = f'/‾‾({ self .hold_time } @{ self .coupling_mhz } MHz)‾‾\\ '
127156 return (s , s )
128157
129158 def _json_dict_ (self ):
130159 return cirq .obj_to_dict_helper (
131- self , ['hold_time' , 'coupling_mhz' , 'rise_time' , 'padding_time' ]
160+ self ,
161+ [
162+ 'hold_time' ,
163+ 'coupling_mhz' ,
164+ 'rise_time' ,
165+ 'padding_time' ,
166+ 'q0_detune_mhz' ,
167+ 'q1_detune_mhz' ,
168+ ],
132169 )
0 commit comments