<jupyter_start><jupyter_text>RB fits<jupyter_code>filename = "/Users/shahnawaz/Dropbox/phd/courses/Advanced measurement lab/QT/Group9/11_RandomizedBenchmarking.hdf5"

with h5py.File(filename, "r") as f:
    # List all groups
    print("Keys: %s" % f.keys())

    # Get the data
    raw_data = {}
    for key in f.keys():
        raw_data[key] = list(f[key])

    print(list(f["Data"]["Channel names"]))
    arr = np.array(f["Data"]["Data"])
    # arr = np.array(f["Traces"]['VNA - S21'])
    # arr2 = np.array(f["Traces"]['VNA - S21_t0dt'])



num_cliff = arr[:, 2, :]
populations = arr[:, 3, :]
def func(m, A, p, B):
    return A*p**m + B


xdata, ydata = np.mean(num_cliff, axis=1), np.mean(populations, axis=1)
popt, pcov = curve_fit(func, xdata, ydata)


std = np.std(populations, axis=1)

plt.plot(xdata, ydata, "o")
plt.plot(xdata, func(xdata, *popt), "--", c="k", label=r"A $p^m$ + B")

plt.gca().fill_between(xdata, ydata - std,
               ydata + std, alpha=0.1,
                 color="blue")

plt.xlabel("Num cliffords (m)")
plt.ylabel("Population Qb2 0")
plt.legend()
plt.savefig("plots/figrb.pdf", bbox_inches="tight")
p = popt[1]
r = (1 - 1/2.)*(1 - p)
r/1.875
popt<jupyter_output><empty_output><jupyter_text>Ramsey<jupyter_code>filename = "/Users/shahnawaz/Dropbox/phd/courses/Advanced measurement lab/QT/Group9/7_ramsey_cal.hdf5"


with h5py.File(filename, "r") as f:
    print("Keys: %s" % f.keys())
    print(list(f["Channels"]))
    print(f["Data"].keys())
    arr = np.array(f["Data"]['Channel names'])<jupyter_output>Keys: <KeysViewHDF5 ['Channels', 'Data', 'Instrument config', 'Instruments', 'Log list', 'Settings', 'Step config', 'Step list', 'Tags', 'Views']>
{'fraction_non_alphanumeric': 0.20497630331753555, 'fraction_numerical': 0.02014218009478673, 'mean_word_length': 4.149390243902439, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '116547', 'license': 'MIT', 'n_tokens_mistral': 725, 'n_tokens_neox': 693, 'n_words': 129, 'path': 'plotting.ipynb', 'repo_name': 'quantshah/qt-lab-report', 'size': '1688'}