qilimanjaro-tech/qililab

[BUG] Running 2 circuits and changing qubits outputs wrong result dimension

Closed this issue · 0 comments

Expected behavior

Running attached code should return a 2*2 array

Observed behavior

Instead we get a 22 array for the first circuit and a 32 for the second, where we have changed only one of the qubits (but we still have 2 qubits)

Output of the code below:

results0 [[[-1.15046409e+00  6.60869565e+00 -6.10161212e-01 -4.82852956e+00
    5.04250122e+00  4.10698583e+00 -3.95212506e+00 -2.79531021e+00
    4.36052760e+00 -8.89301417e+00]
  [ 5.73717636e+00 -4.85100147e-01 -4.10405471e+00  4.12457255e+00
    5.96384954e+00 -2.51636541e+00 -2.14167074e+00  5.33952125e+00
    9.15974597e-01  3.20034196e+01]]

 [[-3.00928188e-01  2.02247191e-01 -2.49145090e-02  4.00586224e-02
    2.20810943e-01 -6.83927699e-03  2.06643869e-01  5.17830972e-02
   -4.88519785e-02  2.49633610e-01]
  [ 5.76453346e-02 -6.79042501e-02  1.16756229e-01 -4.77283830e-01
   -2.02247191e-01 -1.79286761e-01 -3.91304348e-01 -2.98485589e-01
   -4.91939424e-01 -5.01319003e+00]]]

results [[[-1.85784074e+00  3.33756717e+00  9.43331705e-01 -3.42843185e+00
   -3.06790425e-01  5.06546165e+00  4.05471422e-01 -5.03126527e+00
   -7.10307767e-01  4.35075721e+00]
  [ 3.69076698e+00  2.01758671e-01 -4.17293600e+00 -3.45383488e-01
    5.30239375e+00  9.46262824e-01 -3.39521251e+00 -1.56326331e-01
    6.72252076e+00  3.54186615e+01]]

 [[ 5.16853933e-01  7.94821690e-01 -3.54176844e-01 -8.21690278e-01
   -6.23839766e-01 -4.02540303e-01 -3.41475330e-01 -2.41328774e-01
   -6.18954568e-01 -1.11328774e+01]
  [-2.23742062e-01 -7.52320469e-02 -1.65608207e-01 -5.22716170e-02
    1.27503664e+00  5.28089888e-01 -1.68539326e-01  1.18172936e+00
   -1.35319980e-01  8.08353688e+00]]

 [[-1.82706400e-01  1.39472399e-01 -4.71421593e-02  6.10649731e-03
    2.13483146e-01 -1.32144602e-01  2.67220322e-01  8.18270640e-02
   -9.28187592e-03  1.22032242e+00]
  [-4.29897411e-02 -4.00586224e-02  1.36052760e-01 -4.10845139e-01
   -1.10893991e-01 -2.39130435e-01 -3.74938935e-01 -2.12750366e-01
   -5.10503175e-01 -4.59941378e+00]]]

There's probably residual data from previous acquisitions.

Source code

import os
import numpy as np
import qililab as ql
from qililab.typings import Parameter
from qililab.utils import Loop
from qibo.models import Circuit
from qibo.gates import X,Y,CZ,M
import matplotlib.pyplot as plt
from qililab.utils.qibo_gates import Wait
from qililab import Drag

ql.logger.setLevel(40)

platform_name = "/home/vsanchez/LabScripts/QuantumPainHackathon/runcards/soprano_master_galadriel_main.yml"


platform = ql.build_platform(runcard=platform_name)

platform.connect()
platform.turn_on_instruments()
platform.initial_setup()


circuit0 = Circuit(5)

circuit1 = Circuit(5)
circuit1.add(Drag(2,np.pi,0))
circuit1.add(CZ(2,4))
circuit1.add(M(2,4))

results0 = []
total = 0
niters = 1
num_bins = 10
for n in range(0, niters):
    result = platform.execute(program=circuit1, num_avg=1, repetition_duration=20, num_bins=num_bins)

results0.append(result)
circuit0 = Circuit(5)

circuit1 = Circuit(5)
circuit1.add(Drag(2,np.pi,0))
circuit1.add(CZ(2,3))
circuit1.add(M(2,3))

results = []
total = 0
niters = 1
num_bins = 10
for n in range(0, niters):
    result = platform.execute(program=circuit1, num_avg=1, repetition_duration=20, num_bins=num_bins)

results.append(result)
platform.disconnect()

print("results0", results0[0].array)
print("\nresults", results[0].array)

Tracebacks

No response

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.