Skip to content

Commit

Permalink
Add sequence helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
gribeill committed Apr 13, 2020
1 parent ae7f22b commit c0bd505
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions QGL/BasicSequences/RB.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ..Compiler import compile_to_hardware
from ..PulseSequencePlotter import plot_pulse_files
from ..Cliffords import clifford_seq, clifford_mat, inverse_clifford
from ..Euler import XYXClifford
from .helpers import create_cal_seqs, cal_descriptor

import os
Expand Down Expand Up @@ -481,6 +482,67 @@ def SingleQubitRB_DiAC(qubit,
plot_pulse_files(metafile)
return metafile

def SingleQubitRB_XYX(qubit, seqs, purity=False, showPlot=False, add_cals=True):
"""
Single qubit randomized benchmarking using XYX Euler pulses.
Parameters
----------
qubit : Channels.LogicalChannel
Logical channel to implement sequence
seqs : int iterable
list of lists of Clifford group integers produced by create_RB_seqs
purity : boolean, optional
If True, this create sequences for purity RB
showPlot : boolean, optional
Whether to plot
add_cals : boolean, optional
Whether to append calibration pulses to the end of the sequence
Returns
-------
metafile : string
Path to a json metafile with details about the sequences and paths
to compiled machine files
Examples
--------
>>> seqs = create_RB_seqs(1, [2,4,8], repeats=2, interleaveGate=1);
>>> mf = SingleQubitRB(q1, seqs);
Compiled 10 sequences.
>>> mf
'/path/to/exp/exp-meta.json'
"""

seqsBis = []
op = [Id(qubit, length=0), Y90m(qubit), X90(qubit)]
for ct in range(3 if purity else 1):
for seq in seqs:
seqsBis.append([XYXClifford(qubit, c) for c in seq])
#append tomography pulse to measure purity
seqsBis[-1].append(op[ct])
#append measurement
seqsBis[-1].append(MEAS(qubit))

axis_descriptor = [{
'name': 'length',
'unit': None,
'points': list(map(len, seqs)),
'partition': 1
}]

#Tack on the calibration sequences
if add_cals:
seqsBis += create_cal_seqs((qubit, ), 2)
axis_descriptor.append(cal_descriptor((qubit,), 2))

metafile = compile_to_hardware(seqsBis, 'RB_XYX/RB_XYX', axis_descriptor = axis_descriptor, extra_meta = {'sequences':seqs})

if showPlot:
plot_pulse_files(metafile)
return metafile


def SingleQubitIRB_AC(qubit, seqFile, showPlot=False):
"""
Single qubit interleaved randomized benchmarking using atomic Clifford
Expand Down

0 comments on commit c0bd505

Please sign in to comment.