Ejemplo n.º 1
0
    def generate_sequence(self, config):
        """Generate sequence by adding gates/pulses to waveforms."""
        # get parameters
        n_pulse = int(config['# of pi pulses'])
        pi_to_q = config['Add pi pulses to Q']
        duration = config['Sequence duration']
        edge_to_edge = config['Edge-to-edge pulses']

        # select type of refocusing pi pulse
        gate_pi = Gate.Yp if pi_to_q else Gate.Xp

        if edge_to_edge:
            if n_pulse < 0:
                self.add_gate_to_all(gate_pi)
                self.add_gate_to_all(IdentityGate(width=0), dt=duration)
            else:
                self.add_gate_to_all(Gate.X2p)
                dt = duration / (n_pulse + 1)
                for i in range(n_pulse):
                    self.add_gate_to_all(gate_pi, dt=dt)
                self.add_gate_to_all(Gate.X2p, dt=dt)
        else:
            if n_pulse < 0:
                self.add_gate_to_all(gate_pi, t0=0)
                self.add_gate_to_all(IdentityGate(width=0), t0=duration)
            else:
                self.add_gate_to_all(Gate.X2p, t0=0)
                for i in range(n_pulse):
                    self.add_gate_to_all(gate_pi,
                                         t0=duration / (n_pulse + 1) * (i + 1))
                self.add_gate_to_all(Gate.X2p, t0=duration)
Ejemplo n.º 2
0
    def get_sequence(self, config):
        """Compile sequence and return it.

        Parameters
        ----------
        config : dict
            Labber instrument configuration.

        Returns
        -------
        list of :obj:`Step`
            The compiled qubit sequence.

        """
        self.sequences = []

        if self.perform_process_tomography:
            self._process_tomography.add_pulses(self)

        self.generate_sequence(config)

        if self.perform_state_tomography:
            self._state_tomography.add_pulses(self)

        if self.readout_delay > 0:
            delay = IdentityGate(width=self.readout_delay)
            self.add_gate_to_all(delay, dt=0)
        self.add_gate_to_all(ReadoutGate(), dt=0, align='left')

        return self.sequences
Ejemplo n.º 3
0
    def _seperate_gates(self):
        if not self.simultaneous_pulses:
            new_sequences = []
            for step in self.sequences:
                if any(
                        isinstance(gate, (ReadoutGate, IdentityGate))
                        for gate in step.gates):
                    # Don't seperate I gates or readouts since we do
                    # multiplexed readout
                    new_sequences.append(step)
                    continue
                for i, gate in enumerate(step.gates):
                    if gate is not None:
                        new_step = Step(n_qubit=step.n_qubit,
                                        t0=step.t0,
                                        dt=step.dt,
                                        align=step.align)
                        new_step.add_gate(i, gate)
                        new_sequences.append(new_step)
            self.sequences = new_sequences

        # Replace any missing gates with I
        for step in self.sequences:
            for i, gate in enumerate(step.gates):
                if gate is None:
                    step.gates[i] = IdentityGate(width=0)
Ejemplo n.º 4
0
    def generate_sequence(self, config):
        """Generate sequence by adding gates/pulses to waveforms."""
        # get parameters
        n_pulse = int(config['# of pi pulses'])
        pi_to_q = config['Add pi pulses to Q']
        duration = config['Sequence duration']
        edge_to_edge = config['Edge-to-edge pulses']

        # select type of refocusing pi pulse
        gate_pi = Gate.Yp if pi_to_q else Gate.Xp

        # always do T1 same way, regardless if edge-to-edge or center-center
        if n_pulse < 0:
            self.add_gate_to_all(gate_pi)
            self.add_gate_to_all(IdentityGate(width=duration))

        elif edge_to_edge:
            # edge-to-edge pulsing, set pulse separations
            self.add_gate_to_all(Gate.X2p)
            # for ramsey, just add final pulse
            if n_pulse == 0:
                self.add_gate_to_all(Gate.X2p, dt=duration)
            else:
                dt = duration / n_pulse
                # add first pi pulse after half duration
                self.add_gate_to_all(gate_pi, dt=dt / 2)
                # add rest of pi pulses
                for i in range(n_pulse - 1):
                    self.add_gate_to_all(gate_pi, dt=dt)
                # add final pi/2 pulse
                self.add_gate_to_all(Gate.X2p, dt=dt / 2)

        else:
            # center-to-center spacing, set absolute pulse positions
            self.add_gate_to_all(Gate.X2p, t0=0)
            # add pi pulses at right position
            for i in range(n_pulse):
                self.add_gate_to_all(gate_pi,
                                     t0=(i + 0.5) * (duration / n_pulse))
            # add final pi/2 pulse
            self.add_gate_to_all(Gate.X2p, t0=duration)