示例#1
0
    def __init__(self):
        super().__init__()

        # list containing available ensemble names
        self.available_block_ensembles = None

        # The actual model data container.
        self._pulse_sequence = PulseSequence('EDITOR CONTAINER')
        # The default ensemble name for sequence steps
        self.__default_ensemble = ''
        # The headers for each column
        self.__horizontal_headers = [
            'BlockEnsemble', 'Repetitions', 'Go To', 'Event Jump To',
            'Event Trigger', 'Wait For', 'Flag Trigger', 'Flag High'
        ]
        return
示例#2
0
    def get_sequence(self):
        """
        Returns a (deep)copy of the PulseSequence instance serving as model for this editor.

        @return: object, an instance of PulseSequence
        """
        data_container = self.model().data(QtCore.QModelIndex(),
                                           self.model().sequenceRole)
        sequence_copy = PulseSequence(
            '', ensemble_list=data_container.ensemble_list)
        return sequence_copy
示例#3
0
 def setData(self, index, data, role=QtCore.Qt.DisplayRole):
     """
     """
     if role == self.ensembleNameRole and isinstance(data, str):
         self._pulse_sequence[index.row()].ensemble = data
     elif role == self.repetitionsRole and isinstance(data, int):
         self._pulse_sequence[index.row()].repetitions = data
     elif role == self.goToRole and isinstance(data, int):
         self._pulse_sequence[index.row()].go_to = data
     elif role == self.eventJumpToRole and isinstance(data, int):
         self._pulse_sequence[index.row()].event_jump_to = data
     elif role == self.eventTriggerRole and isinstance(data, str):
         self._pulse_sequence[index.row()].event_trigger = data
     elif role == self.waitForRole and isinstance(data, str):
         self._pulse_sequence[index.row()].wait_for = data
     elif role == self.flagTriggerRole and isinstance(data, str):
         self._pulse_sequence[index.row()].flag_trigger = data
     elif role == self.flagHighRole and isinstance(data, str):
         self._pulse_sequence[index.row()].flag_high = data
     elif role == self.sequenceRole and isinstance(data, PulseSequence):
         self._pulse_sequence = PulseSequence('EDITOR CONTAINER')
         self._pulse_sequence.extend(data.ensemble_list)
     return
示例#4
0
class SequenceEditorTableModel(QtCore.QAbstractTableModel):
    """

    """
    # User defined roles for model data access
    repetitionsRole = QtCore.Qt.UserRole + 1
    ensembleNameRole = QtCore.Qt.UserRole + 2
    goToRole = QtCore.Qt.UserRole + 4
    eventJumpToRole = QtCore.Qt.UserRole + 5
    eventTriggerRole = QtCore.Qt.UserRole + 6
    waitForRole = QtCore.Qt.UserRole + 7
    flagTriggerRole = QtCore.Qt.UserRole + 8
    flagHighRole = QtCore.Qt.UserRole + 9
    sequenceRole = QtCore.Qt.UserRole + 10

    def __init__(self):
        super().__init__()

        # list containing available ensemble names
        self.available_block_ensembles = None

        # The actual model data container.
        self._pulse_sequence = PulseSequence('EDITOR CONTAINER')
        # The default ensemble name for sequence steps
        self.__default_ensemble = ''
        # The headers for each column
        self.__horizontal_headers = ['BlockEnsemble',
                                     'Repetitions',
                                     'Go To',
                                     'Event Jump To',
                                     'Event Trigger',
                                     'Wait For',
                                     'Flag Trigger',
                                     'Flag High']
        return

    def set_available_block_ensembles(self, ensembles):
        """

        @param ensembles: list|set, list/set containing all available PulseBlockEnsemble names
        @return: int, error code (>=0: OK, <0: ERR)
        """
        # Convert to set
        if isinstance(ensembles, (list, dict)):
            ensembles = set(ensembles)
        elif not isinstance(ensembles, set):
            return -1

        # Do nothing if available ensembles have not changed
        if self.available_block_ensembles == ensembles:
            return 0

        self.available_block_ensembles = ensembles

        # Set default ensemble name
        if len(self.available_block_ensembles) > 0:
            self.__default_ensemble = sorted(self.available_block_ensembles)[0]
        else:
            self.__default_ensemble = ''

        # Remove ensembles from list that are not there anymore
        rows_to_remove = list()
        for row, (ensemble_name, params) in enumerate(self._pulse_sequence):
            if ensemble_name not in ensembles:
                rows_to_remove.append(row)
        for row in reversed(rows_to_remove):
            self.removeRows(row, 1)

        # Check if the PulseSequence model instance is empty and set a single ensemble if True.
        if len(self._pulse_sequence) == 0:
            self.insertRows(0, 1)

        return 0

    def set_rotating_frame(self, rotating_frame=True):
        """

        @param rotating_frame:
        @return:
        """
        if isinstance(rotating_frame, bool):
            self._pulse_sequence.rotating_frame = rotating_frame
        return

    def rowCount(self, parent=QtCore.QModelIndex()):
        return len(self._pulse_sequence)

    def columnCount(self, parent=QtCore.QModelIndex()):
        return len(self.__horizontal_headers)

    def data(self, index, role=QtCore.Qt.DisplayRole):
        if role == QtCore.Qt.DisplayRole:
            return None

        if role == self.sequenceRole:
            return self._pulse_sequence

        if not index.isValid():
            return None

        if role == self.repetitionsRole:
            return self._pulse_sequence[index.row()][1].get('repetitions')
        elif role == self.ensembleNameRole:
            return self._pulse_sequence[index.row()][0]
        elif role == self.goToRole:
            return self._pulse_sequence[index.row()][1].get('go_to')
        elif role == self.eventJumpToRole:
            return self._pulse_sequence[index.row()][1].get('event_jump_to')
        elif role == self.eventTriggerRole:
            return self._pulse_sequence[index.row()][1].get('event_trigger')
        elif role == self.waitForRole:
            return self._pulse_sequence[index.row()][1].get('wait_for')
        elif role == self.flagTriggerRole:
            return self._pulse_sequence[index.row()][1].get('flag_trigger')
        elif role == self.flagHighRole:
            return self._pulse_sequence[index.row()][1].get('flag_high')
        else:
            return None

    def setData(self, index, data, role=QtCore.Qt.DisplayRole):
        """
        """
        if role == self.ensembleNameRole and isinstance(data, str):
            params = self._pulse_sequence[index.row()][1]
            self._pulse_sequence[index.row()] = (data, params)
        elif role == self.repetitionsRole and isinstance(data, int):
            self._pulse_sequence[index.row()][1]['repetitions'] = data
        elif role == self.goToRole and isinstance(data, int):
            self._pulse_sequence[index.row()][1]['go_to'] = data
        elif role == self.eventJumpToRole and isinstance(data, int):
            self._pulse_sequence[index.row()][1]['event_jump_to'] = data
        elif role == self.eventTriggerRole and isinstance(data, str):
            self._pulse_sequence[index.row()][1]['event_trigger'] = data
        elif role == self.waitForRole and isinstance(data, str):
            self._pulse_sequence[index.row()][1]['wait_for'] = data
        elif role == self.flagTriggerRole and isinstance(data, str):
            self._pulse_sequence[index.row()][1]['flag_trigger'] = data
        elif role == self.flagHighRole and isinstance(data, str):
            self._pulse_sequence[index.row()][1]['flag_high'] = data
        elif role == self.sequenceRole and isinstance(data, PulseSequence):
            self._pulse_sequence = copy.deepcopy(data)
            self._pulse_sequence.name = 'EDITOR CONTAINER'
        return

    def headerData(self, section, orientation, role):
        # Horizontal header
        if orientation == QtCore.Qt.Horizontal:
            if role == QtCore.Qt.DisplayRole and (0 < section < len(self.__horizontal_headers)):
                return self.__horizontal_headers[section]
        return super().headerData(section, orientation, role)

    def flags(self, index):
        return QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled

    def insertRows(self, row, count, parent=None):
        """

        @param row:
        @param count:
        @param parent:
        @return:
        """
        # Do nothing if no ensembles are available
        if len(self.available_block_ensembles) == 0:
            return False

        # Sanity/range checking
        if row < 0 or row > self.rowCount() or not self.available_block_ensembles:
            return False

        if parent is None:
            parent = QtCore.QModelIndex()

        self.beginInsertRows(parent, row, row + count - 1)

        for i in range(count):
            self._pulse_sequence.insert(position=row, element=self.__default_ensemble)

        self.endInsertRows()
        return True

    def removeRows(self, row, count, parent=None):
        """

        @param row:
        @param count:
        @param parent:
        @return:
        """
        # Sanity/range checking
        if row < 0 or row >= self.rowCount() or (row + count) > self.rowCount():
            return False

        if parent is None:
            parent = QtCore.QModelIndex()

        self.beginRemoveRows(parent, row, row + count - 1)

        del self._pulse_sequence[row:row + count]

        self.endRemoveRows()
        return True

    def set_pulse_sequence(self, pulse_sequence):
        """

        @param pulse_sequence:
        @return:
        """
        if not isinstance(pulse_sequence, PulseSequence):
            return False
        self.beginResetModel()
        self.setData(QtCore.QModelIndex(), pulse_sequence, self.sequenceRole)
        self.endResetModel()
        return True
示例#5
0
    def generate_Hartmann_Hahn_tau_sequence(self, name='HHtauseq', spinlock_amp=0.2, tau_start=30*1e-6, tau_step=2*1e-6,
                                            num_of_points=5, alternating = True):

        """
        This pulse sequence correspond to standard Hartmann-Hahn spin-locking protocol, T1pho measurement
        """

        created_blocks = list()
        created_ensembles = list()
        created_sequences = list()

        # get tau array for measurement ticks
        tau_array = tau_start + np.arange(num_of_points) * tau_step

        # create the static waveform elements
        waiting_element = self._get_idle_element(length=self.wait_time, increment=0)
        laser_element = self._get_laser_element(length=self.laser_length, increment=0)
        delay_element = self._get_delay_element()

        pihalf_x_element = self._get_mw_rf_element(length=self.rabi_period / 4,
                                                 increment=0,
                                                 amp1=self.microwave_amplitude,
                                                 freq1=self.microwave_frequency,
                                                 phase1=0,
                                                 amp2=0.0,
                                                 freq2=self.microwave_frequency,
                                                 phase2=0)

        last_pihalf_element = self._get_mw_rf_gate_element(length=self.rabi_period / 4,
                                                           increment=0,
                                                           amp1=self.microwave_amplitude,
                                                           freq1=self.microwave_frequency,
                                                           phase1=0,
                                                           amp2=0.0,
                                                           freq2=self.microwave_frequency,
                                                           phase2=0)

        pi3half_element = self._get_mw_rf_gate_element(length=self.rabi_period / 4,
                                                       increment=0,
                                                       amp1=self.microwave_amplitude,
                                                       freq1=self.microwave_frequency,
                                                       phase1=180.0,
                                                       amp2=0.0,
                                                       freq2=self.microwave_frequency,
                                                       phase2=0)

        sequence_list = []
        i = 0

        for t in tau_array:

            # get spinlock element
            sl_element = self._get_mw_rf_element(length= t,
                                                       increment=0,
                                                       amp1=spinlock_amp,
                                                       freq1=self.microwave_frequency,
                                                       phase1=90.0,
                                                       amp2=0.0,
                                                       freq2=self.microwave_frequency,
                                                       phase2=0)

            # make sequence waveform
            name1 = 'LOCK_%02i' % i
            blocks, lock = self._generate_waveform([pihalf_x_element, sl_element, last_pihalf_element, laser_element,
                                                    delay_element, waiting_element], name1, tau_array, 1)
            created_blocks.extend(blocks)
            created_ensembles.append(lock)

            sequence_list.append((lock, {'repetitions': 1, 'trigger_wait': 0, 'go_to': 0, 'event_jump_to': 0}))

            if alternating:
                name2 = 'LOCK2_%02i' % i
                blocks, lock2 = self._generate_waveform([pihalf_x_element, sl_element, pi3half_element, laser_element,
                                                        delay_element, waiting_element], name2, tau_array, 1)
                created_blocks.extend(blocks)
                created_ensembles.append(lock2)

                sequence_list.append((lock2, {'repetitions': 1, 'trigger_wait': 0, 'go_to': 0, 'event_jump_to': 0}))

            i = i + 1

        created_sequence = PulseSequence(name=name, ensemble_list=sequence_list, rotating_frame=True)

        created_sequence.measurement_information['alternating'] = True
        created_sequence.measurement_information['laser_ignore_list'] = list()
        created_sequence.measurement_information['controlled_variable'] = tau_array
        created_sequence.measurement_information['units'] = ('s', '')
        created_sequence.measurement_information['number_of_lasers'] = num_of_points
        # created_sequence.measurement_information['counting_length'] = self._get_ensemble_count_length(
        #     ensemble=block_ensemble, created_blocks=created_blocks)
        # created_sequence.sampling_information = dict()

        created_sequences.append(created_sequence)

        return created_blocks, created_ensembles, created_sequences
示例#6
0
    def generate_Hartmann_Hahn_waiting(self, name='HHwait', spinlock_amp=0.2, lock_time = 100.0*1e-6,
                                       idle_time = 2.0*1e-6, alternating = True):

        """
        This pulse sequence correspond to standard Hartmann-Hahn spin-locking protocol, T1pho measurement
        """

        created_blocks = list()
        created_ensembles = list()
        created_sequences = list()

        # create the static waveform elements
        waiting_element = self._get_idle_element(length=self.wait_time, increment=0)
        laser_element = self._get_laser_element(length=self.laser_length, increment=0)
        delay_element = self._get_delay_element()

        idle_element = self._get_idle_element(length=idle_time, increment=0)
        init_element = self._get_laser_init_element(length=self.laser_length, increment=0)

        pihalf_x_element = self._get_mw_rf_element(length=self.rabi_period / 4,
                                                 increment=0,
                                                 amp1=self.microwave_amplitude,
                                                 freq1=self.microwave_frequency,
                                                 phase1=0,
                                                 amp2=0.0,
                                                 freq2=self.microwave_frequency,
                                                 phase2=0)

        last_pihalf_element = self._get_mw_rf_gate_element(length=self.rabi_period / 4,
                                                           increment=0,
                                                           amp1=self.microwave_amplitude,
                                                           freq1=self.microwave_frequency,
                                                           phase1=0,
                                                           amp2=0.0,
                                                           freq2=self.microwave_frequency,
                                                           phase2=0)

        pi3half_element = self._get_mw_rf_gate_element(length=self.rabi_period / 4,
                                                       increment=0,
                                                       amp1=self.microwave_amplitude,
                                                       freq1=self.microwave_frequency,
                                                       phase1=180.0,
                                                       amp2=0.0,
                                                       freq2=self.microwave_frequency,
                                                       phase2=0)

        sequence_list = []
        i = 0

        # get spinlock element
        sl_element = self._get_mw_rf_element(length= lock_time,
                                                   increment=0,
                                                   amp1=spinlock_amp,
                                                   freq1=self.microwave_frequency,
                                                   phase1=90.0,
                                                   amp2=0.0,
                                                   freq2=self.microwave_frequency,
                                                   phase2=0)

        # make sequence waveform

        blocks, lock = self._generate_waveform([init_element, delay_element, waiting_element, pihalf_x_element,
                                                sl_element, last_pihalf_element, laser_element,
                                                delay_element, waiting_element, idle_element],
                                                'Lock', [idle_time], 1)
        created_blocks.extend(blocks)
        created_ensembles.append(lock)

        sequence_list.append((lock, {'repetitions': 1, 'trigger_wait': 0, 'go_to': 0, 'event_jump_to': 0}))

        blocks, lock2 = self._generate_waveform([init_element, delay_element, waiting_element,
                                                 pihalf_x_element, sl_element, pi3half_element, laser_element,
                                                delay_element, waiting_element, idle_element],
                                                'Lock2', [idle_time], 1)
        created_blocks.extend(blocks)
        created_ensembles.append(lock2)

        sequence_list.append((lock2, {'repetitions': 1, 'trigger_wait': 0, 'go_to': 0, 'event_jump_to': 0}))

        created_sequence = PulseSequence(name=name, ensemble_list=sequence_list, rotating_frame=True)

        created_sequence.measurement_information['alternating'] = True
        created_sequence.measurement_information['laser_ignore_list'] = list()
        created_sequence.measurement_information['controlled_variable'] = [idle_time]
        created_sequence.measurement_information['units'] = ('s', '')
        created_sequence.measurement_information['number_of_lasers'] = 1
        # created_sequence.measurement_information['counting_length'] = self._get_ensemble_count_length(
        #     ensemble=block_ensemble, created_blocks=created_blocks)
        # created_sequence.sampling_information = dict()

        created_sequences.append(created_sequence)

        return created_blocks, created_ensembles, created_sequences
示例#7
0
    def generate_FSLG(self,
                      name='FSLG',
                      nucl_rabi_period=5 * 1e-6,
                      nucl_larmor_freq=1.8 * 1e+6,
                      num_of_points=40,
                      xy16_order=2,
                      rf_amp=0.25,
                      alternating=True):
        """
        Generate Frequency Switched Lee Goldburg decoupling. RF amplitude must be as for the nuclear Rabi
        """
        created_blocks = list()
        created_ensembles = list()
        created_sequences = list()

        nucl_rabi_freq = 1.0 / nucl_rabi_period

        theta = np.arccos(1 / np.sqrt(3))  # magic angle
        radiofreq_1 = nucl_larmor_freq - nucl_rabi_freq / np.tan(theta)
        radiofreq_2 = nucl_larmor_freq + nucl_rabi_freq / np.tan(theta)

        dip_position = 1 / (2 * radiofreq_1)
        dip_position2 = 1 / (2 * radiofreq_2)

        tau_step = 1e-9
        tau_start = dip_position - tau_step * num_of_points / 2
        tau_start2 = dip_position2 - tau_step * num_of_points / 2

        # get tau array for measurement ticks
        tau_array = tau_start + np.arange(num_of_points) * tau_step
        tau_array2 = tau_start2 + np.arange(num_of_points) * tau_step

        # create the static waveform elements
        waiting_element = self._get_idle_element(length=self.wait_time,
                                                 increment=0)
        laser_element = self._get_laser_element(length=self.laser_length,
                                                increment=0)
        delay_element = self._get_delay_element()

        pihalf_element_rf1 = self._get_mw_rf_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=rf_amp,
            freq2=radiofreq_1,
            phase2=0)

        last_pihalf_element_rf1 = self._get_mw_rf_gate_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=rf_amp,
            freq2=radiofreq_1,
            phase2=0)

        pi_x_element_rf1 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=rf_amp,
            freq2=radiofreq_1,
            phase2=0)

        pi_y_element_rf1 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=90.0,
            amp2=rf_amp,
            freq2=radiofreq_1,
            phase2=0)

        pi_minus_x_element_rf1 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=180.0,
            amp2=rf_amp,
            freq2=radiofreq_1,
            phase2=0)

        pi_minus_y_element_rf1 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=270.0,
            amp2=rf_amp,
            freq2=radiofreq_1,
            phase2=0)

        pi3half_element_rf1 = self._get_mw_rf_gate_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=180.0,
            amp2=rf_amp,
            freq2=radiofreq_1,
            phase2=0)

        # pulses for second RF frequency--------------------------------------------------------------------------------

        pihalf_element_rf2 = self._get_mw_rf_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=rf_amp,
            freq2=radiofreq_2,
            phase2=180)

        last_pihalf_element_rf2 = self._get_mw_rf_gate_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=rf_amp,
            freq2=radiofreq_2,
            phase2=180)

        pi_x_element_rf2 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=rf_amp,
            freq2=radiofreq_2,
            phase2=180)

        pi_y_element_rf2 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=90.0,
            amp2=rf_amp,
            freq2=radiofreq_2,
            phase2=180)

        pi_minus_x_element_rf2 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=180.0,
            amp2=rf_amp,
            freq2=radiofreq_2,
            phase2=180)

        pi_minus_y_element_rf2 = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=270.0,
            amp2=rf_amp,
            freq2=radiofreq_2,
            phase2=180)

        pi3half_element_rf2 = self._get_mw_rf_gate_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=180.0,
            amp2=rf_amp,
            freq2=radiofreq_2,
            phase2=180)

        sequence_list = []
        i = 0

        for index in range(len(tau_array)):

            t = tau_array[index]
            t2 = tau_array2[index]

            tauhalf_element_rf1 = self._get_mw_rf_element(
                length=t / 2 - self.rabi_period / 4,
                increment=0,
                amp1=0.0,
                freq1=self.microwave_frequency,
                phase1=0,
                amp2=rf_amp,
                freq2=radiofreq_1,
                phase2=0)

            tau_element_rf1 = self._get_mw_rf_element(
                length=t - self.rabi_period / 2,
                increment=0,
                amp1=0.0,
                freq1=self.microwave_frequency,
                phase1=0,
                amp2=rf_amp,
                freq2=radiofreq_1,
                phase2=0)

            tauhalf_element_rf2 = self._get_mw_rf_element(
                length=t2 / 2 - self.rabi_period / 4,
                increment=0,
                amp1=0.0,
                freq1=self.microwave_frequency,
                phase1=0,
                amp2=rf_amp,
                freq2=radiofreq_2,
                phase2=180)

            tau_element_rf2 = self._get_mw_rf_element(
                length=t2 - self.rabi_period / 2,
                increment=0,
                amp1=0.0,
                freq1=self.microwave_frequency,
                phase1=0,
                amp2=rf_amp,
                freq2=radiofreq_2,
                phase2=180)

            wfm_list = []
            wfm_list.extend([pihalf_element_rf1, tauhalf_element_rf1])

            for j in range(xy16_order - 1):
                wfm_list.extend([
                    pi_x_element_rf1, tau_element_rf1, pi_y_element_rf1,
                    tau_element_rf1, pi_x_element_rf1, tau_element_rf1,
                    pi_y_element_rf1, tauhalf_element_rf1, tauhalf_element_rf2,
                    pi_y_element_rf2, tau_element_rf2, pi_x_element_rf2,
                    tau_element_rf2, pi_y_element_rf2, tau_element_rf2,
                    pi_x_element_rf2, tau_element_rf2, pi_minus_x_element_rf2,
                    tau_element_rf2, pi_minus_y_element_rf2, tau_element_rf2,
                    pi_minus_x_element_rf2, tau_element_rf2,
                    pi_minus_y_element_rf2, tauhalf_element_rf2,
                    tauhalf_element_rf1, pi_minus_y_element_rf1,
                    tau_element_rf1, pi_minus_x_element_rf1, tau_element_rf1,
                    pi_minus_y_element_rf1, tau_element_rf1,
                    pi_minus_x_element_rf1, tau_element_rf1
                ])

            wfm_list.extend([
                pi_x_element_rf1, tau_element_rf1, pi_y_element_rf1,
                tau_element_rf1, pi_x_element_rf1, tau_element_rf1,
                pi_y_element_rf1, tauhalf_element_rf1, tauhalf_element_rf2,
                pi_y_element_rf2, tau_element_rf2, pi_x_element_rf2,
                tau_element_rf2, pi_y_element_rf2, tau_element_rf2,
                pi_x_element_rf2, tau_element_rf2, pi_minus_x_element_rf2,
                tau_element_rf2, pi_minus_y_element_rf2, tau_element_rf2,
                pi_minus_x_element_rf2, tau_element_rf2,
                pi_minus_y_element_rf2, tauhalf_element_rf2,
                tauhalf_element_rf1, pi_minus_y_element_rf1, tau_element_rf1,
                pi_minus_x_element_rf1, tau_element_rf1,
                pi_minus_y_element_rf1, tau_element_rf1,
                pi_minus_x_element_rf1, tauhalf_element_rf1,
                last_pihalf_element_rf1
            ])

            wfm_list.extend([laser_element, delay_element, waiting_element])

            name1 = 'LGu_%02i' % i
            blocks, decoupling = self._generate_waveform(
                wfm_list, name1,
                np.arange(num_of_points) * tau_step, 1)
            created_blocks.extend(blocks)
            created_ensembles.append(decoupling)

            sequence_list.append((decoupling, {
                'repetitions': 1,
                'trigger_wait': 0,
                'go_to': 0,
                'event_jump_to': 0
            }))

            if alternating:
                wfm_list2 = []
                wfm_list2.extend([pihalf_element_rf1, tauhalf_element_rf1])

                for j in range(xy16_order - 1):
                    wfm_list2.extend([
                        pi_x_element_rf1, tau_element_rf1, pi_y_element_rf1,
                        tau_element_rf1, pi_x_element_rf1, tau_element_rf1,
                        pi_y_element_rf1, tauhalf_element_rf1,
                        tauhalf_element_rf2, pi_y_element_rf2, tau_element_rf2,
                        pi_x_element_rf2, tau_element_rf2, pi_y_element_rf2,
                        tau_element_rf2, pi_x_element_rf2, tau_element_rf2,
                        pi_minus_x_element_rf2, tau_element_rf2,
                        pi_minus_y_element_rf2, tau_element_rf2,
                        pi_minus_x_element_rf2, tau_element_rf2,
                        pi_minus_y_element_rf2, tauhalf_element_rf2,
                        tauhalf_element_rf1, pi_minus_y_element_rf1,
                        tau_element_rf1, pi_minus_x_element_rf1,
                        tau_element_rf1, pi_minus_y_element_rf1,
                        tau_element_rf1, pi_minus_x_element_rf1,
                        tau_element_rf1
                    ])

                wfm_list2.extend([
                    pi_x_element_rf1, tau_element_rf1, pi_y_element_rf1,
                    tau_element_rf1, pi_x_element_rf1, tau_element_rf1,
                    pi_y_element_rf1, tauhalf_element_rf1, tauhalf_element_rf2,
                    pi_y_element_rf2, tau_element_rf2, pi_x_element_rf2,
                    tau_element_rf2, pi_y_element_rf2, tau_element_rf2,
                    pi_x_element_rf2, tau_element_rf2, pi_minus_x_element_rf2,
                    tau_element_rf2, pi_minus_y_element_rf2, tau_element_rf2,
                    pi_minus_x_element_rf2, tau_element_rf2,
                    pi_minus_y_element_rf2, tauhalf_element_rf2,
                    tauhalf_element_rf1, pi_minus_y_element_rf1,
                    tau_element_rf1, pi_minus_x_element_rf1, tau_element_rf1,
                    pi_minus_y_element_rf1, tau_element_rf1,
                    pi_minus_x_element_rf1, tauhalf_element_rf1,
                    pi3half_element_rf1
                ])

                wfm_list2.extend(
                    [laser_element, delay_element, waiting_element])

                name2 = 'XY16d_%02i' % i
                blocks, decoupling2 = self._generate_waveform(
                    wfm_list2, name2,
                    np.arange(num_of_points) * tau_step, 1)
                created_blocks.extend(blocks)
                created_ensembles.append(decoupling2)
                sequence_list.append((decoupling2, {
                    'repetitions': 1,
                    'trigger_wait': 0,
                    'go_to': 0,
                    'event_jump_to': 0
                }))

            i = i + 1

        # ---------------------------------------------------------------------------------------------------------------
        created_sequence = PulseSequence(name=name,
                                         ensemble_list=sequence_list,
                                         rotating_frame=True)

        created_sequence.measurement_information['alternating'] = True
        created_sequence.measurement_information['laser_ignore_list'] = list()
        created_sequence.measurement_information[
            'controlled_variable'] = tau_array
        created_sequence.measurement_information['units'] = ('s', '')
        created_sequence.measurement_information[
            'number_of_lasers'] = num_of_points
        # created_sequence.measurement_information['counting_length'] = self._get_ensemble_count_length(
        #     ensemble=block_ensemble, created_blocks=created_blocks)
        # created_sequence.sampling_information = dict()

        created_sequences.append(created_sequence)

        return created_blocks, created_ensembles, created_sequences
示例#8
0
    def generate_XY16_seq(self,
                          name='XY16_seq',
                          tau_start=250e-9,
                          tau_step=1.0e-9,
                          num_of_points=5,
                          xy16_order=2,
                          alternating=True):
        """
        Generate XY16 decoupling sequence
        """
        created_blocks = list()
        created_ensembles = list()
        created_sequences = list()

        # get tau array for measurement ticks
        tau_array = tau_start + np.arange(num_of_points) * tau_step

        # create the static waveform elements
        waiting_element = self._get_idle_element(length=self.wait_time,
                                                 increment=0)
        laser_element = self._get_laser_element(length=self.laser_length,
                                                increment=0)
        delay_element = self._get_delay_element()
        print(self.rabi_period)

        pihalf_element = self._get_mw_rf_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=0.0,
            freq2=self.microwave_frequency,
            phase2=0)

        last_pihalf_element = self._get_mw_rf_gate_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=0,
            amp2=0.0,
            freq2=self.microwave_frequency,
            phase2=0)

        pi_x_element = self._get_mw_rf_element(length=self.rabi_period / 2,
                                               increment=0,
                                               amp1=self.microwave_amplitude,
                                               freq1=self.microwave_frequency,
                                               phase1=0,
                                               amp2=0.0,
                                               freq2=self.microwave_frequency,
                                               phase2=0)

        pi_y_element = self._get_mw_rf_element(length=self.rabi_period / 2,
                                               increment=0,
                                               amp1=self.microwave_amplitude,
                                               freq1=self.microwave_frequency,
                                               phase1=90.0,
                                               amp2=0.0,
                                               freq2=self.microwave_frequency,
                                               phase2=0)

        pi_minus_x_element = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=180.0,
            amp2=0.0,
            freq2=self.microwave_frequency,
            phase2=0)

        pi_minus_y_element = self._get_mw_rf_element(
            length=self.rabi_period / 2,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=270.0,
            amp2=0.0,
            freq2=self.microwave_frequency,
            phase2=0)

        pi3half_element = self._get_mw_rf_gate_element(
            length=self.rabi_period / 4,
            increment=0,
            amp1=self.microwave_amplitude,
            freq1=self.microwave_frequency,
            phase1=180.0,
            amp2=0.0,
            freq2=self.microwave_frequency,
            phase2=0)

        sequence_list = []
        i = 0

        for t in tau_array:

            tauhalf_element = self._get_idle_element(length=t / 2 -
                                                     self.rabi_period / 4,
                                                     increment=0)
            tau_element = self._get_idle_element(length=t -
                                                 self.rabi_period / 2,
                                                 increment=0.0)
            wfm_list = []
            wfm_list.extend([pihalf_element, tauhalf_element])

            for j in range(xy16_order - 1):
                wfm_list.extend([
                    pi_x_element, tau_element, pi_y_element, tau_element,
                    pi_x_element, tau_element, pi_y_element, tau_element,
                    pi_y_element, tau_element, pi_x_element, tau_element,
                    pi_y_element, tau_element, pi_x_element, tau_element,
                    pi_minus_x_element, tau_element, pi_minus_y_element,
                    tau_element, pi_minus_x_element, tau_element,
                    pi_minus_y_element, tau_element, pi_minus_y_element,
                    tau_element, pi_minus_x_element, tau_element,
                    pi_minus_y_element, tau_element, pi_minus_x_element,
                    tau_element
                ])

            wfm_list.extend([
                pi_x_element, tau_element, pi_y_element, tau_element,
                pi_x_element, tau_element, pi_y_element, tau_element,
                pi_y_element, tau_element, pi_x_element, tau_element,
                pi_y_element, tau_element, pi_x_element, tau_element,
                pi_minus_x_element, tau_element, pi_minus_y_element,
                tau_element, pi_minus_x_element, tau_element,
                pi_minus_y_element, tau_element, pi_minus_y_element,
                tau_element, pi_minus_x_element, tau_element,
                pi_minus_y_element, tau_element, pi_minus_x_element,
                tauhalf_element, last_pihalf_element
            ])

            wfm_list.extend([laser_element, delay_element, waiting_element])

            name1 = 'XY16u_%02i' % i
            blocks, decoupling = self._generate_waveform(
                wfm_list, name1, tau_array, 1)
            created_blocks.extend(blocks)
            created_ensembles.append(decoupling)

            sequence_list.append((decoupling, {
                'repetitions': 1,
                'trigger_wait': 0,
                'go_to': 0,
                'event_jump_to': 0
            }))

            if alternating:
                wfm_list2 = []
                wfm_list2.extend([pihalf_element, tauhalf_element])

                for j in range(xy16_order - 1):
                    wfm_list2.extend([
                        pi_x_element, tau_element, pi_y_element, tau_element,
                        pi_x_element, tau_element, pi_y_element, tau_element,
                        pi_y_element, tau_element, pi_x_element, tau_element,
                        pi_y_element, tau_element, pi_x_element, tau_element,
                        pi_minus_x_element, tau_element, pi_minus_y_element,
                        tau_element, pi_minus_x_element, tau_element,
                        pi_minus_y_element, tau_element, pi_minus_y_element,
                        tau_element, pi_minus_x_element, tau_element,
                        pi_minus_y_element, tau_element, pi_minus_x_element,
                        tau_element
                    ])

                wfm_list2.extend([
                    pi_x_element, tau_element, pi_y_element, tau_element,
                    pi_x_element, tau_element, pi_y_element, tau_element,
                    pi_y_element, tau_element, pi_x_element, tau_element,
                    pi_y_element, tau_element, pi_x_element, tau_element,
                    pi_minus_x_element, tau_element, pi_minus_y_element,
                    tau_element, pi_minus_x_element, tau_element,
                    pi_minus_y_element, tau_element, pi_minus_y_element,
                    tau_element, pi_minus_x_element, tau_element,
                    pi_minus_y_element, tau_element, pi_minus_x_element,
                    tauhalf_element, pi3half_element
                ])

                wfm_list2.extend(
                    [laser_element, delay_element, waiting_element])

                name2 = 'XY16d_%02i' % i
                blocks, decoupling2 = self._generate_waveform(
                    wfm_list2, name2, tau_array, 1)
                created_blocks.extend(blocks)
                created_ensembles.append(decoupling2)
                sequence_list.append((decoupling2, {
                    'repetitions': 1,
                    'trigger_wait': 0,
                    'go_to': 0,
                    'event_jump_to': 0
                }))

            i = i + 1

        #---------------------------------------------------------------------------------------------------------------
        created_sequence = PulseSequence(name=name,
                                         ensemble_list=sequence_list,
                                         rotating_frame=True)

        created_sequence.measurement_information['alternating'] = True
        created_sequence.measurement_information['laser_ignore_list'] = list()
        created_sequence.measurement_information[
            'controlled_variable'] = tau_array
        created_sequence.measurement_information['units'] = ('s', '')
        created_sequence.measurement_information[
            'number_of_lasers'] = num_of_points
        # created_sequence.measurement_information['counting_length'] = self._get_ensemble_count_length(
        #     ensemble=block_ensemble, created_blocks=created_blocks)
        # created_sequence.sampling_information = dict()

        created_sequences.append(created_sequence)

        return created_blocks, created_ensembles, created_sequences