Beispiel #1
0
    def _prepare_CCL_dio_calibration(self, CCL, verbose=False):
        """
        Prepares the appropriate program to calibrate DIO and returns
        expected sequence.
        N.B. only works for microwave on DIO4 and for Flux on DIO3
            (TODO add support for microwave on DIO5)
        """
        log.info('Calibrating DIO delays')
        if verbose: print("Calibrating DIO delays")

        cs_filepath = os.path.join(pycqed.__path__[0], 'measurement',
                                   'openql_experiments', 'output', 'cs.txt')

        opc_filepath = os.path.join(pycqed.__path__[0], 'measurement',
                                    'openql_experiments', 'output',
                                    'qisa_opcodes.qmap')

        # Configure CCL
        CCL.control_store(cs_filepath)
        CCL.qisa_opcode(opc_filepath)

        if self.cfg_codeword_protocol() == 'flux':
            test_fp = os.path.abspath(
                os.path.join(pycqed.__path__[0], '..', 'examples',
                             'CCLight_example', 'qisa_test_assembly',
                             'calibration_cws_flux.qisa'))

            sequence_length = 8
            staircase_sequence = np.arange(1, sequence_length)
            expected_sequence = [(0, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (1, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (2, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (3, list(staircase_sequence))]
        elif self.cfg_codeword_protocol() == 'microwave':
            test_fp = os.path.abspath(
                os.path.join(pycqed.__path__[0], '..', 'examples',
                             'CCLight_example', 'qisa_test_assembly',
                             'calibration_cws_mw.qisa'))

            sequence_length = 32
            staircase_sequence = range(1, sequence_length)
            expected_sequence = [(0, list(reversed(staircase_sequence))), \
                                 (1, list(reversed(staircase_sequence))), \
                                 (2, list(reversed(staircase_sequence))), \
                                 (3, list(reversed(staircase_sequence)))]

        else:
            zibase.ziConfigurationError(
                "Can only calibrate DIO protocol for 'flux' or 'microwave' mode!"
            )

        # Start the CCL with the program configured above
        CCL.eqasm_program(test_fp)
        CCL.start()
        return expected_sequence
Beispiel #2
0
    def _prepare_CC_dio_calibration(self, CC, verbose=False):
        """
        Prepares the appropriate program to calibrate DIO and returns
        expected sequence.
        """
        log.info('Calibrating DIO delays')
        if verbose: print("Calibrating DIO delays")

        if self.cfg_codeword_protocol() == 'flux':
            test_fp = os.path.abspath(
                os.path.join(pycqed.__path__[0], '..', 'examples',
                             'CC_examples', 'flux_calibration.vq1asm'))

            sequence_length = 8
            staircase_sequence = np.arange(1, sequence_length)

            # expected sequence should be ([9, 18, 27, 36, 45, 54, 63])
            expected_sequence = [(0, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (1, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (2, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (3, list(staircase_sequence+ (staircase_sequence << 3)))]

        elif self.cfg_codeword_protocol() == 'microwave':

            test_fp = os.path.abspath(
                os.path.join(pycqed.__path__[0], '..', 'examples',
                             'CC_examples', 'old_hdawg_calibration.vq1asm'))

            sequence_length = 32
            staircase_sequence = range(0, sequence_length)
            expected_sequence = [(0, list(staircase_sequence)), \
                                 (1, list(staircase_sequence)), \
                                 (2, list(reversed(staircase_sequence))), \
                                 (3, list(reversed(staircase_sequence)))]

        elif self.cfg_codeword_protocol() == 'new_microwave':
            raise NotImplementedError

        elif self.cfg_codeword_protocol() == 'new_novsm_microwave':
            raise NotImplementedError

        else:
            raise zibase.ziConfigurationError(
                "Can only calibrate DIO protocol for 'flux' or 'microwave' mode!"
            )

        # Start the QCC with the program configured above
        CC.eqasm_program(test_fp)
        CC.start()
        return expected_sequence
Beispiel #3
0
    def _prepare_QCC_dio_calibration(self, QCC, verbose=False):
        """
        Prepares the appropriate program to calibrate DIO and returns
        expected sequence.
        N.B. only works for microwave on DIO4 and for Flux on DIO3
            (TODO add support for microwave on DIO5)
        """
        log.info('Calibrating DIO delays')
        if verbose: print("Calibrating DIO delays")

        cs_filepath = os.path.join(pycqed.__path__[0], 'measurement',
                                   'openql_experiments', 's17', 'cs.txt')

        opc_filepath = os.path.join(pycqed.__path__[0], 'measurement',
                                    'openql_experiments', 's17',
                                    'qisa_opcodes.qmap')

        # Configure QCC
        QCC.control_store(cs_filepath)
        QCC.qisa_opcode(opc_filepath)

        if self.cfg_codeword_protocol() == 'flux':
            test_fp = os.path.abspath(
                os.path.join(pycqed.__path__[0], '..', 'examples',
                             'QCC_example', 'qisa_test_assembly',
                             'flux_calibration.qisa'))

            sequence_length = 8
            staircase_sequence = np.arange(1, sequence_length)

            # expected sequence should be ([9, 18, 27, 36, 45, 54, 63])
            expected_sequence = [(0, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (1, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (2, list(staircase_sequence + (staircase_sequence << 3))), \
                                 (3, list(staircase_sequence+ (staircase_sequence << 3)))]

        elif self.cfg_codeword_protocol() == 'microwave':
            raise zibase.ziConfigurationError(
                'old_microwave DIO scheme not supported on QCC.')

        elif self.cfg_codeword_protocol() == 'new_microwave':

            test_fp = os.path.abspath(
                os.path.join(pycqed.__path__[0], '..', 'examples',
                             'QCC_example', 'qisa_test_assembly',
                             'withvsm_calibration.qisa'))

            sequence_length = 32
            staircase_sequence = range(1, sequence_length)
            expected_sequence =  [(0, list(staircase_sequence)), \
                                 (1, list(staircase_sequence)), \
                                 (2, list(reversed(staircase_sequence))), \
                                 (3, list(reversed(staircase_sequence)))]

        elif self.cfg_codeword_protocol() == 'new_novsm_microwave':

            test_fp = os.path.abspath(
                os.path.join(pycqed.__path__[0], '..', 'examples',
                             'QCC_example', 'qisa_test_assembly',
                             'novsm_calibration.qisa'))

            sequence_length = 32
            staircase_sequence = range(1, sequence_length)
            expected_sequence = [(0, list(staircase_sequence)), \
                                 (1, list(reversed(staircase_sequence))), \
                                 (2, list(staircase_sequence)), \
                                 (3, list(reversed(staircase_sequence))) ]

        else:
            zibase.ziConfigurationError(
                "Can only calibrate DIO protocol for 'flux' or 'microwave' mode!"
            )

        # Start the QCC with the program configured above
        QCC.eqasm_program(test_fp)
        QCC.start()
        return expected_sequence