Initial
This commit is contained in:
64
notebooks/plot_bell_violation.ipynb
Normal file
64
notebooks/plot_bell_violation.ipynb
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "imports",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import numpy as np\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, ax = plt.subplots(figsize=(10, 6))\n",
|
||||
"\n",
|
||||
"# Histogram of Bell parameter values\n",
|
||||
"ax.hist(data['Bell Parameter (S)'], bins=20, color='steelblue', alpha=0.7, edgecolor='black')\n",
|
||||
"\n",
|
||||
"# Add classical limit line\n",
|
||||
"ax.axvline(x=2.0, color='red', linestyle='--', linewidth=2, label='Classical limit (S=2)')\n",
|
||||
"\n",
|
||||
"# Add Tsirelson bound\n",
|
||||
"ax.axvline(x=2*np.sqrt(2), color='green', linestyle='--', linewidth=2, label=f'Tsirelson bound (S={2*np.sqrt(2):.2f})')\n",
|
||||
"\n",
|
||||
"ax.set_xlabel('Bell Parameter (S)', fontsize=12)\n",
|
||||
"ax.set_ylabel('Number of Experiments', fontsize=12)\n",
|
||||
"ax.set_title('Distribution of Bell Parameter Values Across All Laboratories', fontsize=14)\n",
|
||||
"ax.legend()\n",
|
||||
"ax.grid(True, alpha=0.3)\n",
|
||||
"\n",
|
||||
"plt.tight_layout()\n",
|
||||
"plt.savefig(here() / 'output/plots/bell_violation.png', dpi=300, bbox_inches='tight')"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user