Newer
Older
HCAL_project / create_reco_images.ipynb
@Davide Lancierini Davide Lancierini on 2 Dec 2018 46 KB First commit
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import os\n",
    "\n",
    "import pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def ones_to_zeros(ET_inner_dict, ET_outer_dict):\n",
    "    \n",
    "    for k in range(0,len(ET_inner_dict)):\n",
    "        for i in range(ET_inner_dict[k].shape[0]):\n",
    "            equal_inner = np.array_equal(ET_inner_dict[k][i],np.ones_like(ET_inner_dict[k][i]))\n",
    "            equal_outer = np.array_equal(ET_outer_dict[k][i],np.ones_like(ET_outer_dict[k][i]))\n",
    "            if equal_inner or equal_outer:\n",
    "                ET_inner_dict[k][i]=np.zeros_like(ET_inner_dict[k][i])\n",
    "                ET_outer_dict[k][i]=np.zeros_like(ET_outer_dict[k][i])\n",
    "                \n",
    "    return ET_inner_dict, ET_outer_dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def double_size(X_in):\n",
    "\n",
    "    X_out = np.zeros(\n",
    "        shape=(2*X_in.shape[0],2*X_in.shape[1],1),\n",
    "        dtype=np.float32\n",
    "    )\n",
    "    \n",
    "    for i in range(X_in.shape[0]):\n",
    "        for j in range(X_in.shape[1]):\n",
    "            \n",
    "            if X_in[i,j]!=0:\n",
    "                value = X_in[i,j]/4\n",
    "                X_out[2*i,2*j]=value\n",
    "                X_out[2*i+1,2*j]=value\n",
    "                X_out[2*i,2*j+1]=value\n",
    "                X_out[2*i+1,2*j+1]=value\n",
    "    return X_out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def insert(X_inner, X_outer):\n",
    "    X=X_outer\n",
    "    \n",
    "    for i in range(12,40):\n",
    "        for j in range(16,48):\n",
    "            X[i,j]=X_inner[i-12,j-16]\n",
    "    \n",
    "    return X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def generate_HCAL_images(ET_inner_dict, ET_outer_dict):\n",
    "    \n",
    "    output_pics = {}\n",
    "    \n",
    "    pic = np.array(np.zeros(shape=(52,64,1), dtype=np.float32))\n",
    "    \n",
    "    for j in range(len(ET_inner_dict)):\n",
    "        \n",
    "        \n",
    "        output_pics[j]=np.array([pic for i in range(len(ET_inner_dict[j]))])    \n",
    "        \n",
    "    \n",
    "    for j in range(len(ET_inner_dict)):\n",
    "        \n",
    "        for k in range(len(ET_inner_dict[j])):\n",
    "            \n",
    "            ET_image = insert(ET_inner_dict[j][k], double_size(ET_outer_dict[j][k]))\n",
    "            ET_image = np.flip(ET_image, axis = 0)\n",
    "            \n",
    "            output_pics[j][k]= ET_image\n",
    "            \n",
    "        print('Done batch {0}'.format(j+1))\n",
    "                \n",
    "    return output_pics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "ET_inner_dict={}\n",
    "ET_outer_dict={}\n",
    "\n",
    "i=0\n",
    "#while os.path.exists('/disk/lhcb_data/davide/HCAL_project_full_event/npy/DplusMuNu_Full/ET_inner/batch_'+str(i)+'.npy'):\n",
    "while i < 2:\n",
    "    ET_inner_dict[i]=np.load('/disk/lhcb_data/davide/HCAL_project_full_event/npy/DplusMuNu_Full/ET_inner/batch_'+str(i)+'.npy')\n",
    "    ET_outer_dict[i]=np.load('/disk/lhcb_data/davide/HCAL_project_full_event/npy/DplusMuNu_Full/ET_outer/batch_'+str(i)+'.npy')\n",
    "\n",
    "    i+=1\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAzIAAAFZCAYAAABDmRqdAAA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/S3emnXw9MOd8pioi9k8uIseSPqUWj9/k/RVfkPSZiPjiZPNCjN9qfVuksXtJRLwg6c8kvUXSK22/dEPjhVs7AQDImGch8w1JV0w+fWdJ0nsl3TPHfKbK9rbJm49le5ukd0h67NS/1Tr3SLpx8v2Nkr40x1ym7qWL/Inr1dLxm7xh/HZJeyPiEyf8V+vHb62+LdDYXWj7lZPvt0h6m1beB/SApN+chLVy7AAAWK+53hBz8pGovy+pK+mOiPgvc0tmymz/glaehZGknqTPtrl/tj8n6RpJF0jaL+kjkv6npM9L+jlJP5D0noho5Rvm1+jfNVp5aVJIekrS+196T0mb2P4nkv6vpEcljSebP6yV95K0evxO0bcbtBhj9ytaeTN/Vyt/ePp8RPynyfpyl6TzJf2FpH8dEcfnlykAALM310IGAAAAAM7EXG+ICQAAAABngkIGAAAAQOtQyAAAAABoHQoZAAAAAK1DIQMAAACgdShkAAAAALQOhQwAAACA1qGQAQAAANA6/x+JzNlx5TgIKwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 1008x432 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mean_inner_ET=np.mean(ET_inner_dict[0], axis=0, keepdims=True).reshape(32,32)\n",
    "plt.subplot(1,2,1)\n",
    "plt.imshow(mean_inner_ET[2:mean_inner_ET.shape[0]-2,0:mean_inner_ET.shape[0]])\n",
    "plt.subplot(1,2,2)\n",
    "mean_outer_ET=np.mean(ET_outer_dict[0], axis=0, keepdims=True).reshape(32,32)\n",
    "plt.imshow(mean_outer_ET[3:mean_outer_ET.shape[0]-3,0:mean_outer_ET.shape[0]])\n",
    "fig = plt.gcf()\n",
    "fig.set_size_inches(14,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "ET_inner_dict, ET_outer_dict = ones_to_zeros(ET_inner_dict, ET_outer_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "#cutting out useless pixels\n",
    "for i in range(len(ET_inner_dict)):\n",
    "    ET_inner_dict[i]=ET_inner_dict[i][:,2:ET_inner_dict[i].shape[1]-2,:]\n",
    "    ET_outer_dict[i]=ET_outer_dict[i][:,3:ET_outer_dict[i].shape[1]-3,:]\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "((25000, 28, 32), (25000, 26, 32))\n"
     ]
    }
   ],
   "source": [
    "#Check cut dict dimensions\n",
    "print(ET_inner_dict[0].shape, ET_outer_dict[0].shape)\n",
    "#is\n",
    "#(?, 28, 32), (?,26, 32)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "def delete_undetected_events(X_inner, X_outer):\n",
    "\n",
    "    pos_rejected={}\n",
    "    \n",
    "    for i in range(len(X_inner)):\n",
    "        pos_rejected[i]=[]\n",
    "        \n",
    "        for j in range(X_inner[i].shape[0]):\n",
    "            \n",
    "            equal_inner = np.array_equal(X_inner[i][j],np.zeros_like(X_inner[i][j]))\n",
    "            equal_outer = np.array_equal(X_outer[i][j],np.zeros_like(X_outer[i][j]))\n",
    "            \n",
    "                \n",
    "    X_inner_filtered={}\n",
    "    X_outer_filtered={}\n",
    "    for i in range(len(X_inner)):\n",
    "    \n",
    "        X_inner_filtered[i]=np.delete(X_inner[i],pos_rejected[i],axis=0)\n",
    "        X_outer_filtered[i]=np.delete(X_outer[i],pos_rejected[i],axis=0)\n",
    "        \n",
    "    return X_inner_filtered, X_outer_filtered"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "ET_inner_filtered, ET_outer_filtered = delete_undetected_events(ET_inner_dict,ET_outer_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7fb56b8f0350>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAACoCAYAAADw6BWzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAE/JJREFUeJzt3X2MHdV5x/HvYxMDbY28bjC2eXNDkWWoEldC4EKoDJSK8g9ENFKo2rgSkoMUpFJFSkwqNRSpktuQhj9aRSUE4UptUvqSgirU1DK2aCU7iaEuceo6xpYhBmOT2FaNZLMYP/3jzka7M2f3njtz5s7L/j7SaneOZ848e/f6eHyefc4xd0dERLpvQdMBiIhIGhrQRUR6QgO6iEhPaEAXEekJDegiIj2hAV1EpCc0oIuI9IQGdBGRnqg0oJvZXWa238xeM7NNqYISEZHRWdlKUTNbCPwIuBM4AnwfuN/d/yddeCIiEuuCCtfeCLzm7ocAzOxbwD3ArAO6mWmdAamVu1vTMYg0pcqAfjnw42nHR4CbRg7ggmII586dq+261PJxNBFDSMzrU+U1rPv1D/Vf5/1E+qDKgB56Eio8gZvZRmBjhfuIiEiEKknRI8CV046vAN7Kn+TuT7r7De5+Q4V7iYyVEv7SRVWSohcwSIreAbzJICn6O+7+wzmu8VT/le7SlEvM9xy6tux1s2nDNEbKn1votU8xh14m4R+bHzIbHl6Fv5PJ+gr1F+rrkksuKbSdPn16aBypY61bzGtR9/1i3tulp1zc/ZyZPQR8B1gIPD3XYC7SISMn/GMtWrRo6Dnvvfdesr7L9hXqL9TXzTffXGjbvn370DhSx1q3mNeizvtNTk5GXVdlDh13fwF4oUofIi2UJOEvMm6VBnSRnlLCXzpJA7pIUXTCH3gSVGMh7VA6KVrqZiXf9CmTg3UnGlP+HncTvycee11b6w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pi4DcY5AG2A7+dnVYufncf2wfwa8B3ph0/AjwyzhhKxr0K2DvteD+wIvt6BbC/6Rgjv4/ngDu7Fj/wc8ArwE0MioouCL2fGo7xbuBHDOZC/6jpeCLi/SaDtd7fZ/A/jAeAX2TwD/yB7PPSpuOcJfaPM5iOeBXYk33c3aH4Pwr8Vxb/XuCPs/aPAN8DXgP+Abhw1L7HvThXKHl005hjSGFG8sXMWpt8mTJX8qit8Wf/o3sZ+GUG/7NLkjiqg7u/QIcW9XL3+2f5ozvGGkgJPvuiatCN+F9l8Hcx336IWdbejzXuOXQljxrQ1eSR15Q4EumrcQ/oSh6NWR+SR544cSTSV+Me0JU8GqMuJ49qTRyJ9NTYF+cys7uBJ4CFwNPu/qdjDWBEZvZNYD2DVf6OAV8C/gV4FrgKeAP4pLvnq+4aZ2YfB/4D+AFwPmv+IoN59FbHb2YfZVAtt5DBg8ez7v6YmX2EQSXmUgaJpd919/eai1SkPRpZbVFERNJTpaiISE9oQBcR6QkN6CIiPaEBXUSkJzSgi4j0hAZ0EZGe0IAuItITGtBFRHri/wGpS3uI0kmmbQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.subplot(1,2,1)\n",
    "plt.imshow(ET_inner_filtered[0][1].reshape(28,32),cmap='gray')\n",
    "plt.subplot(1,2,2)\n",
    "plt.imshow(ET_outer_filtered[0][1].reshape(26,32),cmap='gray')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7fb56b884b90>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAATEAAAD8CAYAAAAfZJO2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgA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     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "i=1\n",
    "plt.imshow(np.flip(insert(ET_inner_filtered[0][i],double_size(ET_outer_filtered[0][i])).reshape(52,64),axis=0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done batch 1\n",
      "Done batch 2\n"
     ]
    }
   ],
   "source": [
    "output_pics = generate_HCAL_images(ET_inner_filtered,ET_outer_filtered)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(25000, 52, 64, 1)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output_pics[0].shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(len(output_pics)):\n",
    "    with open('/disk/lhcb_data/davide/HCAL_project_full_event/reco/sample'+str(i)+'.pickle', 'wb') as handle:\n",
    "        pickle.dump(output_pics[i], handle, protocol=pickle.HIGHEST_PROTOCOL)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "a=np.array([output_pics[0][i].sum() for i in range(len(output_pics[0]))])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAEphJREFUeJzt3X+MpVd93/H3p3ZwAmmyNh6Q2V11jbJK4lhJsEbECVWK2LSxjcX6D6jsorIlK60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B44z5fuiqr4APLOq+Ezf993Ax2rgIWBLkss2p6VnNqwPVfXnVXWyrT7E4FomGPTh3qr6h6r6BrDI4G/YVJvmABh224itE2rLSJLsAF4HPAy8uqqOwyAkgFdNrmXr8kHgt4D/29ZfCTy34od/FvbHa4Fl4A/aVNYdSV7BDO2Lqvom8HvAUwz+8D8PHGH29gWc+fs+q7/rvwT8aVueyT5McwCseduIaZbkB4E/Bn61qv520u05F0muB05U1ZGVxUOqTvv+uBC4Cri9ql4H/D1TPN0zTJsn3w1cDrwGeAWDKZPVpn1fnM3M/WwleS+D6d67TxUNqTbVfYDpDoA1bxsxrZJ8H4M//ndX1Sdb8bdODWvb44lJtW8d3gC8JcmTDKbe3sRgRLClTUPAbOyPJWCpqh5u6/cxCIRZ2he/AHyjqpar6rvAJ4GfY/b2BZz5+z5Tv+tJ9gDXA2+vF8+jn6k+nDLNATCTt41oc+V3Aker6gMrNh0C9rTlPcD9m9229aqqW6pqW1XtYPB9/2xVvR34HPDWVm2q+wBQVX8DHEvyo61oF4Nbj8/MvmAw9XN1kpe3n61TfZipfdGc6ft+CHhHOxvoauD5U1NF0yaDD7R6D/CWqnphxaZDwI1JLkpyOYMD2n8xiTaek6qa2i/gOgZH2v8n8N5Jt2edbf6nDIZ+jwBfaV/XMZhDPww80R4vmXRb19mfNwKfasuvZfBDvQj8EXDRpNu3jvb/NLDQ9sd/Ay6etX0B/Afga8CjwB8CF037vgDuYXDM4rsM/jvee6bvO4Ppk4+03/O/ZHDG07T2YZHBXP+p3+3/sqL+e1sfHgeunXT71/PllcCS1KlpngKSJJ1HBoAkdcoAkKROGQCS1CkDQJI6ZQBIUqcMAEnqlAEgSZ36fy8WAVD4I3MKAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.hist(a/1000,bins=70);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}