69 lines
2.0 KiB
Plaintext
69 lines
2.0 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",
|
||
|
|
"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, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6))\n",
|
||
|
|
"\n",
|
||
|
|
"# Scatter plot: Singles vs Coincidence\n",
|
||
|
|
"geometric_mean_singles = np.sqrt(data['Singles Rate A (Hz)'] * data['Singles Rate B (Hz)'])\n",
|
||
|
|
"ax1.scatter(geometric_mean_singles, data['Coincidence Rate (Hz)'],\n",
|
||
|
|
" alpha=0.6, s=80, c=data['Visibility (%)'], cmap='viridis',\n",
|
||
|
|
" edgecolors='black', linewidth=0.5)\n",
|
||
|
|
"ax1.set_xlabel('Geometric Mean of Singles Rates (Hz)', fontsize=11)\n",
|
||
|
|
"ax1.set_ylabel('Coincidence Rate (Hz)', fontsize=11)\n",
|
||
|
|
"ax1.set_title('Coincidence vs Singles Rates', fontsize=12)\n",
|
||
|
|
"ax1.grid(True, alpha=0.3)\n",
|
||
|
|
"cbar1 = plt.colorbar(ax1.collections[0], ax=ax1)\n",
|
||
|
|
"cbar1.set_label('Visibility (%)', fontsize=10)\n",
|
||
|
|
"\n",
|
||
|
|
"# CAR distribution\n",
|
||
|
|
"ax2.hist(data['CAR'], bins=20, color='coral', alpha=0.7, edgecolor='black')\n",
|
||
|
|
"ax2.set_xlabel('Coincidence-to-Accidental Ratio (CAR)', fontsize=11)\n",
|
||
|
|
"ax2.set_ylabel('Frequency', fontsize=11)\n",
|
||
|
|
"ax2.set_title('Distribution of CAR Values', fontsize=12)\n",
|
||
|
|
"ax2.grid(True, alpha=0.3)\n",
|
||
|
|
"\n",
|
||
|
|
"plt.tight_layout()\n",
|
||
|
|
"plt.savefig(here() / 'output/plots/coincidence_rates.png', dpi=300, bbox_inches='tight')"
|
||
|
|
]
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"metadata": {
|
||
|
|
"kernelspec": {
|
||
|
|
"display_name": "Python 3",
|
||
|
|
"language": "python",
|
||
|
|
"name": "python3"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"nbformat": 4,
|
||
|
|
"nbformat_minor": 5
|
||
|
|
}
|