qilimanjaro-tech/qililab

[Feature] Get QCM sequencer id from QUBIT_IDX

Closed this issue · 1 comments

4dri8 commented

Feature details

Just the same as the platform.get_qrm_ch_id_from_qubit but for a QCM, the code below is working, the structure is the same as the platform.get_qrm_ch_id_from_qubit.

(The code is Written by Victor btw)

Implementation

Function for the platform.py.

   def get_qcm_ch_id_from_qubit(self, alias: str, qubit_index: int) -> int:
        """TODO

        Args:
            alias (str): bus alias
            qubit_index (int): qubit index

        Returns:
            int: sequencer id
        """
        bus = next((bus for bus in self._get_bus_by_qubit_index(qubit_index=qubit_index) if bus.alias == alias), None)
        if bus is None:
            raise ValueError(f"Could not find bus with alias {alias} for qubit {qubit_index}")
        instrument = next(
            instrument
            for instrument in bus.system_control.instruments
            if instrument.name in [InstrumentName.QBLOX_QCM, InstrumentName.QCMRF]
        )
        return next(sequencer.identifier for sequencer in instrument.awg_sequencers if sequencer.chip_port_id == bus.port)

How important would you say this feature is?

1: Not important. Would be nice to have.

Additional information

No response