Files
qu-en/notebooks/plot_fidelity_dist.ipynb
Jalmari Tuominen 60e6abc831 Initial
2025-11-27 08:59:35 +02:00

63 lines
1.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "imports",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from pyprojroot import here"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "load",
"metadata": {},
"outputs": [],
"source": [
"data = pd.read_csv(here() / 'data/base/data.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "plot",
"metadata": {},
"outputs": [],
"source": [
"fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 5))\n",
"\n",
"# Histogram of fidelity\n",
"ax1.hist(data['Entanglement Fidelity'], bins=15, color='coral', alpha=0.7, edgecolor='black')\n",
"ax1.set_xlabel('Entanglement Fidelity', fontsize=12)\n",
"ax1.set_ylabel('Frequency', fontsize=12)\n",
"ax1.set_title('Distribution of Entanglement Fidelity', fontsize=13)\n",
"ax1.grid(True, alpha=0.3)\n",
"\n",
"# Category pie chart\n",
"category_counts = data['Fidelity Category'].value_counts()\n",
"colors = ['#2ecc71', '#3498db', '#f39c12', '#e74c3c']\n",
"ax2.pie(category_counts.values, labels=category_counts.index, autopct='%1.1f%%',\n",
" colors=colors, startangle=90)\n",
"ax2.set_title('Fidelity Categories', fontsize=13)\n",
"\n",
"plt.tight_layout()\n",
"plt.savefig(here() / 'output/plots/fidelity_dist.png', dpi=300, bbox_inches='tight')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}