@@ -111,38 +111,27 @@ def _out_port(port: Union[str, int]) -> QubitId:
111111 return port if isinstance (port , int ) else _digits (port )
112112
113113
114- def infer_los (cluster : dict ) -> dict [tuple [QubitId , bool ], str ]:
115- """Infer LOs names for output channels.
116-
117- ``cluster`` should be a mapping compatible with the same input of :func:`map_ports`.
114+ def _infer_outputs (cluster : dict , suffix : str ) -> dict [tuple [QubitId , bool ], str ]:
115+ """``cluster`` should be a mapping compatible with the same input of :func:`map_ports`.
118116
119117 The result is a mapping from ``(qubit, channel)``, where ``qubit`` is the identifier,
120118 and ``channel`` is a boolean toggle: ``True`` for probe channels, ``False`` for
121119 drive.
122120 """
123121 return {
124- (q , "qrm" in mod ): f"{ mod } /o{ _out_port (port )} /lo "
122+ (q , "qrm" in mod ): f"{ mod } /o{ _out_port (port )} /{ suffix } "
125123 for mod , specs in cluster .items ()
126124 if "_rf" in mod
127125 for port , qs in specs [1 ].items ()
128126 for q in qs
129127 }
130128
131129
132- def infer_mixers (cluster : dict ) -> dict [tuple [QubitId , bool ], str ]:
133- """Infer mixer names for output channels.
130+ def infer_los (cluster : dict ) -> dict [tuple [QubitId , bool ], str ]:
131+ """Infer LOs names for output channels."""
132+ return _infer_outputs (cluster , "lo" )
134133
135- ``cluster`` should be a mapping compatible with the same input of :func:`map_ports`.
136134
137- The result is a mapping from ``(qubit, channel)``, where ``qubit`` is the identifier,
138- and ``channel`` is a boolean toggle: ``True`` for probe channels, ``False`` for
139- drive.
140- """
141- # TODO: same as infer_los, avoid duplicating
142- return {
143- (q , "qrm" in mod ): f"{ mod } /o{ _out_port (port )} /mixer"
144- for mod , specs in cluster .items ()
145- if "_rf" in mod
146- for port , qs in specs [1 ].items ()
147- for q in qs
148- }
135+ def infer_mixers (cluster : dict ) -> dict [tuple [QubitId , bool ], str ]:
136+ """Infer mixer names for output channels."""
137+ return _infer_outputs (cluster , "mixer" )
0 commit comments