Skip to content

Commit

Permalink
Grab btype from pulse if not None (#13)
Browse files Browse the repository at this point in the history
Btype wasn't recognized before if U explicitly given
  • Loading branch information
thangleiter committed Mar 5, 2020
1 parent 90201a1 commit 454219f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions filter_functions/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,14 +656,15 @@ def plot_error_transfer_matrix(
if U is not None:
if U.ndim == 2:
U = np.array([U])

n_oper_inds = np.arange(len(U))
if n_oper_identifiers is None:
if pulse is not None and len(pulse.n_oper_identifiers) == len(U):
n_oper_identifiers = pulse.n_oper_identifiers
else:
n_oper_identifiers = ['$B_{}$'.format(i)
for i in range(len(n_oper_inds))]
btype = ''

else:
if pulse is None or S is None or omega is None:
raise ValueError('Require either precomputed error transfer ' +
Expand All @@ -673,7 +674,6 @@ def plot_error_transfer_matrix(
n_oper_identifiers,
'noise')
n_oper_identifiers = pulse.n_oper_identifiers[n_oper_inds]
btype = pulse.basis.btype
# Get the error transfer matrix
U = numeric.error_transfer_matrix(pulse, S, omega, n_oper_identifiers)
if U.ndim == 4:
Expand All @@ -684,6 +684,7 @@ def plot_error_transfer_matrix(
U = U.real

if basis_labels is None:
btype = pulse.basis.btype if pulse is not None else ''
if btype == 'Pauli':
n_qubits = int(np.log(U.shape[-1])/np.log(4))
basis_labels = [''.join(tup) for tup in
Expand Down

0 comments on commit 454219f

Please sign in to comment.