tracking-parametrisation-tuner/parameterisations/notebooks/x_curvature.ipynb

367 lines
109 KiB
Plaintext
Raw Permalink Normal View History

2023-12-19 13:00:59 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import uproot\n",
"import awkward as ak\n",
"input_tree_md = uproot.open({\"/work/guenther/reco_tuner/data/param_data_MD_selected_8520.root\": \"Selected\"})\n",
"input_tree_mu = uproot.open({\"/work/guenther/reco_tuner/data/param_data_MU_selected_8520.root\": \"Selected\"})\n",
"# this is an event list of dictionaries containing awkward arrays\n",
"array_md = input_tree_md.arrays()\n",
"array_mu = input_tree_mu.arrays()\n",
"array = ak.concatenate([array_md, array_mu])\n",
"array[\"dSlope_fringe\"] = array[\"tx_ref\"] - array[\"tx\"]\n",
"array[\"z_mag_x_fringe\"] = (array[\"x\"] - array[\"x_ref\"] - array[\"tx\"] * array[\"z\"] + array[\"tx_ref\"] * array[\"z_ref\"] ) / array[\"dSlope_fringe\"]\n",
"def format_array(name, coef):\n",
" coef = [str(c)+\"f\" for c in coef if c != 0.0]\n",
" code = f\"constexpr std::array {name}\"\n",
" code += \"{\" + \", \".join(list(coef)) +\"};\"\n",
" return code"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi8AAAGsCAYAAAAVGEevAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAxM0lEQVR4nO3de3RU5b3/8c+eSUi8JGNjJCGCSWgFDKHWJkKioLaFAFYUaxGWErGn8cg5dXnh2BZqVRRbjv6qh9PjJUuh3qDW5QVWPd4SloogiRKFo4SAVBJAJQmIJEGbEG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gAAIAvWltbNWrUKM/f8cHEXHhxLxWlpqYSXgAAsBhfSj4o2AUAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAD5r73TqYFuH2judERtDzN0eAAAABN+WhsNauXGPKnc0yWVKNkOalpeh66aMVmFOWljHwpUXAAAwqKer9+rK8iq9XtsVXCTJZUrr65o1p7xKq6v3hnU8hBcAADCgLQ2Hdce67TL7+ZnTZcqUdPu67appOBy2MRFeAADAgFZu3CObbfA7PdtshlZuqg/TiAgvAABgAO2dTlXuaJLT1d91l285XaYqahvDVsRLeAEAAP1qaz8uL7nFw2V2nR8OhBcAANCvlOQEeVkx8rAZXeeHA+EFAAD0KznRrml5GbJ7STB2m6GS8ZlKTrSHZVyEFwAAMKCyKaPl8rJ25HKZKpucG6YREV4AAMAgzs1J07LZ+TKkPldg7DZDhqRls/PD2qiODrsAAGBQ84uyNS4zRSs31auitrFHh92yyblh77BLeAEAAF4V5qSpMCdN7Z1OtbUfV0pyQthqXHojvAAAAJ8lJ9ojFlrcqHkBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWEtLw8vbbb2vWrFnKysqSYRhat26d19ds2LBBBQUFSk5O1ujRo1VeXh7KIQIAAIsJaXj56quvdPbZZ+vBBx/06fz6+npdfPHFmjJlirZu3arf/e53uvHGG/XCCy+EcpgAAMBCEkL55jNnztTMmTN9Pr+8vFxnnHGGVqxYIUk666yzVFNToz/96U+64oorQjRKAABgJVFV81JVVaWSkpIex6ZPn66amhp1dnb2+5qOjg61trb2eAAAgNgVVeGlsbFRGRkZPY5lZGTo+PHjOnToUL+vWb58uRwOh+cxatSocAwVAABESFSFF0kyDKPHc9M0+z3utmTJErW0tHge+/fvD/kYAQBA5IS05sVfmZmZam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KkYfN6Dof4Ud4AQDgG8mJdk3Ly5DdS4Kx2wyVjM/kLtARQngBAKCbsimj5fKyduRymSqbnBumEaE3wgsAAN2cm5OmZbPzZUh9rsDYbYYMSctm59OoLoJYrAMAxJz2Tqfa2o8rJTkhoKWd+UXZGpeZopWb6lVR29ijw27Z5FyCS4QRXgAAMSOYLf0Lc9JUmJM25CCE4CO8AABiwtPVe3XHuu2y2Yw+Lf0rapu0bHa+5hdl+/2+yYl2QkuUoeYFAGB5tPSPL4QXAIDl0dI/vhBeAACWRkv/+EN4AQBYGi394w/hBQBgabT0jz+EFwCApdHSP/4QXgAAlkdL//hCeAEARJ32TqcOtnX4XFxLS//4wsIfACBqDKVDLi3944dhmqaPNdrW0NraKofDoZaWFqWmpkZ6OAAAH3XvkNt927PdZsj
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import seaborn as sns\n",
"import numpy as np\n",
"bins = 50#np.linspace( -1.5, 1.5, 50 )\n",
"sns.regplot(x=ak.to_numpy(array[\"dSlope_fringe\"]), y=ak.to_numpy(array[\"CX_ex\"]), x_bins=bins, fit_reg=None, x_estimator=np.mean)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiIAAAGsCAYAAADg5swfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAtfUlEQVR4nO3dfXDU1aH/8c93l5AIJKkhkoAgCT7FEKuYKCAgesvTtLalMxeuV1BxChfuUAt17q+V+6sKP1qhtzqdO95qFDqosRavT/TBqQJjpShBEoFWErQgBCkPCTGSBDQh7J7fH2nWLNnsbmB3zz68XzM79+a7Z3fPyaHuJ+fp6xhjjAAAACxw2a4AAABIXQQRAABgDUEEAABYQxABAADWEEQAAIA1BBEAAGANQQQAAFhDEAEAANYQRAAAgDUEEQAAYE3CBJE///nP+uY3v6lhw4bJcRxt2LAh6p955MgRzZ07V4MHD9aAAQN0/fXX6/3334/65wIAkCoSJoicPn1a1113nf7nf/4nJp/32WefacKECUpLS9Mf//hH1dbW6rHHHtNXvvKVmHw+AACpwEnEm945jqPXXntNM2fO9F07c+aMfvzjH+vXv/61Tp48qZKSEv3sZz/Trbfeel6f8cADD+jdd9/V1q1bI1NpAADQQ8KMiIRy77336t1339X69ev117/+VbNmzdKMGTO0b9++83q/3/3udyorK9OsWbM0ZMgQjRkzRmvWrIlwrQEASG1JMSLy8ccf68orr9Tf//53DRs2zFduypQpuummm/TII4/0+TMyMjIkSffff79mzZqlHTt2aOnSpXrqqad09913R6QdAACkun62KxAJO3fulDFGV111ld/19vZ2DR48WJJUV1enwsLCoO+zePFi3xoUr9ersrIyX4gZM2aMampq9OSTTxJEAACIkKQIIl6vV263W++//77cbrffc4MGDZIkXXrppdq7d2/Q97n44ot9///QoUNVXFzs9/w111yjV155JUK1BgAASRFExowZI4/Ho4aGBk2aNClgmbS0NBUVFYX9nhMmTNBHH33kd+1vf/ubRo4ceUF1BQAAX0qYIHLq1Cnt37/f9/PBgwe1e/du5eTk6KqrrtKcOXN0991367HHHtOYMWPU2Niot956S9dee62+/vWv9/nzfvCDH+jmm2/WI488otmzZ2vHjh16+umn9fTTT0eyWQAApLSEWaz69ttv67bbbutx/Z577tEzzzyjjo4O/eQnP9Fzzz2nI0eOaPDgwRo/frxWrFiha6+99rw+8w9/+IOWLVumffv2qbCwUPfff78WLFhwoU0BAAD/kDBBBAAAJJ+kOUcEAAAkHoIIAACwJq4Xq3q9Xh09elSZmZlyHMd2dQAAQBiMMWptbdWwYcPkcgUf84jrIHL06FGNGDHCdjUAAMB5OHz4sIYPHx60TFwHkczMTEmdDcnKyrJ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lubpYk5eQEPt2zvb1d7e3tvp9bWlpiUi8AAGBHzBarGmN0//33a+LEiSopKQlYZtWqVcrOzvY9RowYEavqAQAAC2I2NbN48WK9/vrreueddzR8+PCAZQKNiIwYMYKpGQAAEkjcTc3cd999+t3vfqc///nPvYYQSUpPT1d6enosqgQAAOJAVIOIMUb33XefXnvtNb399tsqLCyM5scBAIAEE9UgsnjxYr3wwgv67W9/q8zMTB0/flySlJ2drYsuuiiaHw0AABJAVNeIOI4T8Pq6des0b968kK9n+27iWlhRrbrGzyVJBbkDuBswAKSQuFkjEsMjShBn6ho/10f1rZIkL/8OAAC94F4ziLiquiYdOfmF7+d9Dae0sKJa1XVNFmsFAIhHBBFEVMX2Q5pdXqlT7Wf9rm/e26BZ5ZV
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = 50#np.linspace( -1., 1., 50 )\n",
"sns.regplot(x=ak.to_numpy(array[\"tx\"]), y=ak.to_numpy(array[\"CX_ex\"]), x_bins=bins, fit_reg=None, x_estimator=np.mean)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiIAAAGsCAYAAADg5swfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAtT0lEQVR4nO3df3TU1Z3/8dfMEDP8SCIhkhDBJGgthqgoUUCgajWgVVu6XfxxxIKn4Qt70Jbq2V1pVVRssVtr9xxdDD96aMW2+LWt1G61C2xFQUEToF8hUAtCEMEkxEgSwIQwc79/pDNlYDIzgZm5M/k8H+fMOc1nbmZurmnmxf28770uY4wRAACABW7bHQAAAM5FEAEA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EHHtCECRNUVlYWts3ChQuVk5MTfAwbNixZ3QMAABYk7dbMnDlz9Mc//lEbNmzQ0KFDw7YJNyMybNgwbs0AAJBGUu7WzP33369XX31Vb731VrchRJIyMzOVmZmZjC4BAIAUkNAgYozR/fffr1deeUXr1q1TSUlJIt8OAACkmYQGkTlz5uhXv/qVfv/73ysrK0v19fWSpJycHPXt2zeRbw0AANJAQmtEXC5X2OvLly/XjBkzon4/y3fT26wVNaprOiZJKs7rp8X3lFvuEQAgGVKmRiSJW5QgBdU1HdMHDW2SJD+/CwCAMDhrBglRXdesA4c/D369q/GIZq2oUU1ds8VeAQBSDUEEcbd
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = 50#np.linspace( -1., 1., 50 )\n",
"sns.regplot(x=ak.to_numpy(array[\"x\"]), y=ak.to_numpy(array[\"CX\"]), x_bins=bins, fit_reg=None, x_estimator=np.mean)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiIAAAGsCAYAAADg5swfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAtqklEQVR4nO3dfXSU5Z3/8c89k5CxOMk2IqFAmgQFY4hVSxBQWHULka3W4q6iR8CH3Vj5Hdn1YdcWfj5hcZfatbvuutVUY3HFx9Wjad3dasKPioBBCeqpIUEFEkRpEhBJItvEMHP9/oiTJuRpZnLfc8/D+3XOnCPDPTNX7qbOx+v6Xt/LMsYYAQAAuMDj9gAAAEDqIogAAADXEEQAAIBrCCIAAMA1BBEAAOAagggAAHANQQQAALiGIAIAAFxDEAEAAK4hiAAAANckTBB544039L3vfU8TJ06UZVmqrKx09PM6Ojp0yy23KC8vTyeccILOPfdcbd++3dHPBAAg1SRMEDl69KjOPPNM/fu//3tMPq+srEzV1dVav3693n//fZWWlmr+/Pn69NNPY/L5AACkAisRD72zLEsvv/yyFi1a1Pvcl19+qTvvvFNPP/20jhw5ouLiYt1///264IILIn7/P/zhD/L7/frVr36liy++uPf5s846S5dcconuu+8+G34KAACQ5vYA7HL99derqalJzz33nCZOnKiXX35ZCxcu1Pvvv6+pU6dG9F7Hjh1TIBCQz+fr9/wJJ5ygLVu22DlsAABSWlLMiOzZs0dTp07VJ598ookTJ/ZeN3/+fJ1zzjn6x3/8x4g/49xzz9WYMWP0zDPPKCcnR88++6yuueYaTZ06VR988IFdPwoAACktYWpEhvPOO+/IGKNp06bpxBNP7H1s2rRJe/bskSQ1NTXJsqxhHytWrOh9z/Xr18sYo0mTJikjI0P/9m//pquvvlper9etHxMAgKSTFEszwWBQXq9XO3bsGBAUTjzxREnSpEmT1NDQMOz7fP3rX+/951NOOUWbNm3S0aNH1d7erm984xu68sorVVBQYP8PAABAikqKIHL22WcrEAiotbVV8+bNG/Sa9PR0FRYWRvzeY8eO1dixY/X555/rtdde009/+tPRDhcAAHwlYYLIF198od27d/f+ubGxUe+9956ys7M1bdo0LVmyRNdcc41+9rOf6eyzz9ahQ4e0ceNGnXHGGfrud78b8ee99tprMsbotNNO0+7du3X77bfrtNNO0/XXX2/njwUAQEpLmGLV119/XRdeeOGA56+99lo98cQT6u7u1n333acnn3xSn376qU466STNmTNH9957r84444yIP+8///M/tWrVKn3yySfKzs7WX/7lX+of/uEflJWVZcePAwAAlEBBBAAAJJ+k2DUDAAASE0EEAAC4Jq6LVYPBoA4cOCC/3y/LstweDgAACIMxRh0dHZo4caI8nuHnPOI6iBw4cEC5ubluDwMAAERh//79mjx58rDXxHUQ8fv9knp+kMzMTJdHAwAAwtHe3q7c3Nze7/HhxHUQCS3HZGZmEkQAAEgw4ZRVUKwKAABcQxABAACuI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IMPnPxIxBgH6AEARsPRILJp0ybddNNN2rZtm6qrq3Xs2DGVlpbq6NGjTn4sYogD9AAAo+Fojcirr77a78/r1q3T+PHjtWPHDv3pn/6pkx+NGAgdoDfS2TV9D9CjgBUA0FdMi1Xb2tokSdnZgxcvdnV1qaurq/fP7e3tMRkXohPNAXoEEQBAXzErVjXG6LbbbtPcuXNVXFw86DVr165VVlZW7yM3NzdWw0MUOEAPADBaMQsiK1as0O9+9zs9++yzQ16zatUqtbW19T72798fq+EhChygBwAYrZj8J+rf/M3f6Ne
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = 50#np.linspace( -1., 1., 50 )\n",
"sns.regplot(x=ak.to_numpy(array[\"dSlope_fringe\"]), y=ak.to_numpy(array[\"DX\"]), x_bins=bins, fit_reg=None, x_estimator=np.mean)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi8AAAGsCAYAAAAVGEevAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA1i0lEQVR4nO3de3hU1b3/8c/MEBLAZDBEctGYhBaIEGqRqAGhoEIAlZYeH5GjIPoUCu3xVOTHaaWtClpFe2qPx+MFK9YLeKEW4bQ/rRJ+CmgJmghpuUSKmhDEhMgtFzAhZNbvD8yUIZO5hMxlT96v55nnYfasPfNd2cB8svdaa9uMMUYAAAAWYY90AQAAAMEgvAAAAEshvAAAAEshvAAAAEshvAAAAEshvAAAAEshvAAAAEshvAAAAEshvAAAAEshvAAAAEuJ6fCyadMmTZkyRRkZGbLZbFq7dm1IP6+hoUHz589XVlaWev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vAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUggvAADAUkIaXjZt2qQpU6YoIyNDNptNa9eu9bvPxo0bNWLECCUkJGjAgAFatmxZKEsEAAAWE9LwcuzYMV188cV6/PHHA2pfUVGha665RmPGjNG2bdv085//XD/5yU+0evXqUJYJAAAspEco33zy5MmaPHlywO2XLVumCy+8UI8++qgk6aKLLlJpaal+85vf6Prrrw9RlQAAwEqiasxLcXGxCgsLPbZNnDhRpaWlamlp8bpPc3Oz6uvrPR4AACB2RVV4qampUWpqqse21NRUnTx5UgcPHvS6z9KlS+V0Ot2PzMzMcJQKAAAiJKrCiyTZbDaP58YYr9vbLFq0SHV1de7Hvn37Ql4jAACInJCOeQlWWlqaampqPLbV1taqR48e6tevn9d94uPjFR8fH47yAABAFIiqMy8jR45UUVGRx7Z169YpPz9fcXFxEaoKAABEk5CGl8bGRpWVlamsrEzSqanQZWVlqqqqknTqks8tt9zibj9v3jzt3btXCxYsUHl5uX7/+9/r2Wef1cKFC0NZJgAAsJCQXjYqLS3VlVde6X6+YMECSdKsWbP0/PPPq7q62h1kJCknJ0dvvvmm7rzzTj3xxBPKyMjQY489xjRpAADgZjNtI2JjRH19vZxOp+rq6pSUlBTpcgAAQACC+f6OqjEvAAAA/hBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApRBeAACApfSIdAEAAFjZ3BWlqjx4XJKUndJbT8/Mj3BFsY/wAgDAWag8eFy7DzRIklzGRLia7oHLRgAAdFJJ5WHtP/qV+/me2kbNXVGq0srDEawq9hFeAADohBVb9mrasmI1Np/02L6+vFY3LCvWyi17I1RZ7CO8AAAQpJLKw7pn7Q55u0jU6jIyku5eu4MzMCFCeAEAIEjL3/tMdrvNZxu73abl71eEqaLuhfACAEAQmlpaVbTrgFp
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = 50#np.linspace( -1., 1., 50 )\n",
"sns.regplot(x=ak.to_numpy(array[\"tx\"]), y=ak.to_numpy(array[\"DX\"]), x_bins=bins, fit_reg=None, x_estimator=np.mean)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot: >"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi8AAAGsCAYAAAAVGEevAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA0VklEQVR4nO3de3RUVZ7+/6cSQoVLUhoCqURjErq5CKERiUpQvCERRLrp9ofYjgiugQF7GAfRmZH2hqhN66jDctCOto5K8Da9EMZZohJHLtoEO8HQDUgjCCGIhBiQVBLItfbvD76ppkilUgWpy0ner7VqLevUPlWfbCL1sM/e+9iMMUYAAAAWERPpAgAAAIJBeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJZCeAEAAJbSpcPLpk2bNGXKFKWlpclms2nNmjUh/byamhotWLBAGRkZ6tWrl8aOHavi4uKQfiYAAN1Nlw4vdXV1GjlypJYvXx6Wz5s9e7YKCwtVUFCg7du3Ky8vTzfccIMOHToUls8HAKA7sHWXGzPabDatXr1aU6dO9RxrbGzUQw89pDfffFPHjx9Xdna2nnrqKV177bVBv//JkyeVkJCg//mf/9HkyZM9xy+55BLdfPPNeuKJJzrhpwAAAD0iXUAk3XXXXSorK9M777yjtLQ0rV69WhMnTtT27ds1aNCgoN6rublZLS0tio+P9zreq1cvff75551ZNgAA3Vq3HXn55ptvNGjQIH377bdKS0vztLvhhht0+eWX6ze/+U3QnzF27Fj17NlTb731llJSUvT222/rzjvv1KBBg7R79+7O+lEAAOjWuvScF3++/PJLGWM0ePBg9e3b1/PYuHGjvvnmG0lSWVmZbDab38f8+fM971lQUCBjjC644ALZ7XY9//zzuv322xUbGxupHxMAgC6n2142crvdio2N1datW9uEi759+0qSLrjgAu3atcvv+5x//vme//7Rj36kjRs3qq6uTi6XS6mpqZo+fbqysrI6/wcAAKCb6rbhZdSoUWppaVFlZaXGjRvns01cXJyGDh0a9Hv36dNHffr00Q8//KCPP/5YTz/99LmWCwAA/p8uHV5qa2u1d+9ez/P9+/dr27ZtSkpK0uDBg/V3f/d3uvPOO/Xss89q1KhRqqqq0qeffqoRI0bopptuCvrzPv74YxljNGTIEO3du1f/8i//oiFDhuiuu+7qzB8LAIBurUtP2N2wYYOuu+66Nsdnzpyp119/XU1NTXriiSe0YsUKHTp0SP369VNubq4ee+wxjRgxIujP++///m8tWrRI3377rZKSknTLLbfoySeflMPh6IwfBwAAqIuHFwAA0PV029VGAADAmggvAADAUrrchF23263vvvtOCQkJstlskS4HAAAEwBijmpoapaWlKSbG/9hKlwsv3333ndLT0yNdBgAAOAsHDx7UhRde6LdNlwsvCQkJkk798ImJiRGuBgAABMLlcik9Pd3zPe5PlwsvrZeKEhMTCS8AAFhMIFM+mLALAAAshfACAAAshfACAAAshfACAAAshfACAAAshfACAAAshfACAAAshfACAAAshfACAAAshfACAAAsJaThZdOmTZoyZYrS0tJks9m0Zs0av+03bNggm83W5vHXv/41lGUCAAALCem9jerq6jRy5EjddddduuWWWwI+b/fu3V73Jerfv38oygMAAEGYW1CisqoTkqTM5N56aUZOROoIaXiZNG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AAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLIbwAAABLCWl42bRpk6ZMmaK0tDTZbDatWbOmw3M2btyo0aNHKz4+XgMHDlR+fn4oSwQAABYT0vBSV1enkSNHavny5QG1379/v2666SaNGzdOpaWl+vWvf6177rlHq1atCmWZAADAQnqE8s0nTZqkSZMmBdw+Pz9fF110kZYtWyZJuvjii1VSUqJnnnlGt9xyS4iqBAAAVhJVc16KioqUl5fndezGG29USUmJmpqafJ7T0NAgl8vl9QAAAF1XVIWXiooKpaSkeB1LSUlRc3OzqqqqfJ6zdOlSORwOzyM9PT0cpQIAgAiJqvAiSTabzeu5Mcbn8VaLFi1SdXW153Hw4MGQ1wgAACInpHNeguV0OlVRUeF1rLKyUj169FC/fv18nmO322W328NRHgAAiAJRNfKSm5urwsJCr2Pr1q1TTk6O4uLiIlQVAACIJiENL7W1tdq2bZu2bdsm6dRS6G3btqm8vFzSqUs+d955p6f9vHnzdODAAS1cuFC7du3Sf/3Xf+nVV1/V/fffH8oyAQCAhYT0slFJSYmuu+46z/OFCxdKkmbOnKnXX39dhw8f9gQZScrKytLatWt177336oUXXlBaWpqef/55lkkDAAAPm2mdEdtFuFwuORwOVVdXKzExMdLlAACAAATz/R1Vc14AAAA6QngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACWQngBAACW0iPSBQAAYGVzC0pUVnVCkpSZ3FsvzciJcEVdH+EFAIBzUFZ1QruP1ES6jG6Fy0YAAHQStzGRLqFbILwAAHCWisuO6dDxk57neyprNbegRCVlxyJYVddHeAEA4CwUbDmgW/OLVNvQ7HX8k12VmpZfpJVbDkSosq6P8AIAQJCKy47pkTU75OsiUYvbyEh6eM0ORmBChPACAECQXvlsn2JibH7bxMTY9Mrn+8NUUfdCeAEAIAj1TS0q/OqIWtz+J+e2uI3W7axQfVNLmCr
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = 50#np.linspace( -1., 1., 50 )\n",
"sns.regplot(x=ak.to_numpy(array[\"x\"]), y=ak.to_numpy(array[\"DX\"]), x_bins=bins, fit_reg=None, x_estimator=np.mean)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['dSlope_fringe' 'tx dSlope_fringe' 'ty dSlope_fringe'\n",
" 'tx^2 dSlope_fringe' 'tx ty dSlope_fringe' 'ty^2 dSlope_fringe']\n",
"intercept= 0.0\n",
"coef= {'dSlope_fringe': 2.3340814100448438e-05, 'tx dSlope_fringe': 8.310801914170572e-09, 'ty dSlope_fringe': -1.025087641029144e-06, 'tx^2 dSlope_fringe': 8.228862899700043e-06, 'tx ty dSlope_fringe': -1.5662848683486495e-06, 'ty^2 dSlope_fringe': -0.0003728935994887431}\n",
"r2 score= 0.9860788549938552\n",
"RMSE = 6.07178841864582e-07\n",
"constexpr std::array cx_params{2.3340814100448438e-05f, 8.310801914170572e-09f, -1.025087641029144e-06f, 8.228862899700043e-06f, -1.5662848683486495e-06f, -0.0003728935994887431f};\n"
]
}
],
"source": [
"from sklearn.preprocessing import PolynomialFeatures\n",
"from sklearn.linear_model import LinearRegression, Lasso, Ridge\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.pipeline import Pipeline\n",
"from sklearn.metrics import mean_squared_error\n",
"\n",
"features = [\n",
" \"tx\", \n",
" \"ty\",\n",
" \"dSlope_fringe\",\n",
"]\n",
"target_feat = \"CX_ex\"\n",
"\n",
"data = np.column_stack([ak.to_numpy(array[feat]) for feat in features])\n",
"target = ak.to_numpy(array[target_feat])\n",
"X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2, random_state=42)\n",
"\n",
"poly = PolynomialFeatures(degree=3, include_bias=False)\n",
"X_train_model = poly.fit_transform( X_train ) \n",
"X_test_model = poly.fit_transform( X_test ) \n",
"\n",
"poly_features = poly.get_feature_names_out(input_features=features)\n",
"remove = [i for i, f in enumerate(poly_features) if (\"dSlope_fringe\" not in f ) or (\"dSlope_fringe^\" in f)]\n",
"X_train_model = np.delete( X_train_model, remove, axis=1)\n",
"X_test_model = np.delete( X_test_model, remove, axis=1)\n",
"poly_features = np.delete(poly_features, remove )\n",
"print(poly_features)\n",
"\n",
"lin_reg = LinearRegression(fit_intercept=False)\n",
"lin_reg.fit( X_train_model, y_train)\n",
"y_pred_test = lin_reg.predict( X_test_model )\n",
"print(\"intercept=\", lin_reg.intercept_)\n",
"print(\"coef=\", dict(zip(poly_features, lin_reg.coef_)))\n",
"print(\"r2 score=\", lin_reg.score(X_test_model, y_test))\n",
"print(\"RMSE =\", mean_squared_error(y_test, y_pred_test, squared=False))\n",
"print(format_array(\"cx_params\", lin_reg.coef_))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['dSlope_fringe' 'tx dSlope_fringe' 'ty dSlope_fringe'\n",
" 'tx^2 dSlope_fringe' 'tx ty dSlope_fringe' 'ty^2 dSlope_fringe']\n",
"intercept= 0.0\n",
"coef= {'dSlope_fringe': -7.054315710920644e-09, 'tx dSlope_fringe': 2.22196526392023e-11, 'ty dSlope_fringe': 6.104698063377923e-10, 'tx^2 dSlope_fringe': 2.85681046841909e-09, 'tx ty dSlope_fringe': 3.789175266592706e-10, 'ty^2 dSlope_fringe': 9.907774160587578e-08}\n",
"r2 score= 0.97610245571401\n",
"RMSE = 2.4251033068807623e-10\n",
"constexpr std::array dx_params{-7.054315710920644e-09f, 2.22196526392023e-11f, 6.104698063377923e-10f, 2.85681046841909e-09f, 3.789175266592706e-10f, 9.907774160587578e-08f};\n"
]
}
],
"source": [
"features = [\n",
" \"tx\", \n",
" \"ty\",\n",
" \"dSlope_fringe\",\n",
"]\n",
"target_feat = \"DX_ex\"\n",
"\n",
"data = np.column_stack([ak.to_numpy(array[feat]) for feat in features])\n",
"target = ak.to_numpy(array[target_feat])\n",
"X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2, random_state=42)\n",
"\n",
"poly = PolynomialFeatures(degree=3, include_bias=False)\n",
"X_train_model = poly.fit_transform( X_train ) \n",
"X_test_model = poly.fit_transform( X_test ) \n",
"\n",
"poly_features = poly.get_feature_names_out(input_features=features)\n",
"remove = [i for i, f in enumerate(poly_features) if (\"dSlope_fringe\" not in f ) or (\"dSlope_fringe^\" in f)]\n",
"X_train_model = np.delete( X_train_model, remove, axis=1)\n",
"X_test_model = np.delete( X_test_model, remove, axis=1)\n",
"poly_features = np.delete(poly_features, remove )\n",
"print(poly_features)\n",
"\n",
"lin_reg = LinearRegression(fit_intercept=False)\n",
"lin_reg.fit( X_train_model, y_train)\n",
"y_pred_test = lin_reg.predict( X_test_model )\n",
"print(\"intercept=\", lin_reg.intercept_)\n",
"print(\"coef=\", dict(zip(poly_features,lin_reg.coef_)))\n",
"print(\"r2 score=\", lin_reg.score(X_test_model, y_test))\n",
"print(\"RMSE =\", mean_squared_error(y_test, y_pred_test, squared=False))\n",
"print(format_array(\"dx_params\", lin_reg.coef_))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 (conda)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "a2eff8b4da8b8eebf5ee2e5f811f31a557e0a202b4d2f04f849b065340a6eda6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}