{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import os\n", "import pickle\n", "import sys" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "with open('/disk/lhcb_data/davide/HCAL_project_full_event/csv/MCtracker_info.pickle', 'rb') as f:\n", " tracks=pickle.load(f)\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "width_X=8404.0\n", "width_Y=6828.0\n", "#number of events\n", "batch_size=20000\n", "n_batches=11\n", "\n", "X_pixels=64\n", "Y_pixels=52" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "11" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(tracks['xProjections'])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "for j in range(n_batches):\n", " for i in range(batch_size):\n", " tracks[\"xProjections\"][j][i][0]/=(width_X/2)\n", " tracks[\"yProjections\"][j][i][0]/=(width_Y/2)\n", " \n", " tracks[\"xProjections\"][j][i][0]*=32\n", " tracks[\"yProjections\"][j][i][0]*=26\n", " \n", " tracks[\"xProjections\"][j][i][0]+=32\n", " tracks[\"yProjections\"][j][i][0]+=26\n", " " ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "scrolled": true }, "outputs": [], "source": [ "pics_dict_flip = {}\n", "pics_dict = {}\n", "for n in range(n_batches):\n", " \n", " pic = np.zeros(shape=(Y_pixels,X_pixels,1),dtype=np.float32)\n", " batch_size = tracks['regions'][0].shape[0]\n", " \n", " pics_dict[n]=np.array([pic for i in range(0,batch_size)])\n", " pics_dict_flip[n]=np.array([pic for i in range(0,batch_size)])\n", " \n", " \n", " for event in range(batch_size):\n", " \n", " for ntrack in range(tracks['yProjections'][n][event][0].shape[0]):\n", " \n", " y=int(np.floor(tracks['yProjections'][n][event][0][ntrack]))\n", " x=int(np.floor(tracks['xProjections'][n][event][0][ntrack]))\n", " \n", " if 0<x<X_pixels:\n", " if 0<y<Y_pixels:\n", " \n", " pics_dict_flip[n][event][y,x]=tracks['realETs'][n][event][0][ntrack]\n", " \n", " pics_dict[n][event]=np.flip(pics_dict_flip[n][event], axis=0)\n", "\n", " " ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "<matplotlib.image.AxesImage at 0x7f7d97368b90>" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAATEAAAD8CAYAAAAfZJO2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAADbZJREFUeJzt3X+s3XV9x/Hny/70xxhUhXQtW3FpGCwZxdxBGcviqLDqjLAEF5xb+keT/sMSzMwUtszMbX9Alqj7YzFphNlkTEDUQYgTSYUsy1jhIlUpFYvIoCuzTkGcy7oW3vvjfIv3tudyz7333HPPhz4fyc05n8/9Hr6vcO599fv9nG+/TVUhSa163VIHkKSFsMQkNc0Sk9Q0S0xS0ywxSU2zxCQ1zRKT1DRLTFLTFlRiSbYmeSLJk0muH1YoSRpU5nvFfpJlwLeBy4GDwMPA+6vq8ZleszKrajVvnNf+JJ06/pef8H91JINsu3wB+7kIeLKqngJIchtwJTBjia3mjVycLQvYpaRTwZ7aPfC2CzmdXAc8O2V8sJubJsmOJJNJJo9yZAG7k6STLaTE+h3qnXRuWlU7q2qiqiZWsGoBu5Okky2kxA4CZ08ZrwcOLSyOJM3NQkrsYWBjknOSrASuAe4eTixJGsy8F/ar6liSPwTuBZYBt1TVvqElk6QBLOTTSarqS8CXhpRFkubMK/YlNc0Sk9Q0S0xS0ywxSU2zxCQ1zRKT1DRLTFLTLDF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jdV73mU6PcmdSb7V/YxeMoqcIyuxJMuAvwXeBZwPvD/J+aPa/wA+A2w9YW7cbvx4DPhQVZ0HbAau7f4fjlvOI8BlVXUBsAnYmmQzcBPwiS7n88D2Jcx43HXA/injccwIbdyU9G+AL1fVL9H7Wz77GUXOqhrJF3AJcO+U8Q3ADaPa/4AZNwCPTRk/Aaztnq8FnljqjCfkvQu4fJxzAm8AvgZcTO+ix+X9fh6WKNv67hfrMuAeIOOWscvxNPCWE+bG6j0HTgO+S7fOPsqcozydXAc8O2V8sJsbZ2N748ckG4ALgT2MYc7uNG0vvVs03Qd8B3ihqo51m4zD+/9J4MPAy934zYxfRmjjpqRvA74P/F13ev7p7q43i55zlCWWPnN+NDoPSd4EfB74YFW9uNR5+qmql6pqE72jnYuA8/ptNtpUP5XkPcDhqnpk6nSfTcfhZ/TSqno7vaWYa5P8xlIH6mM58HbgU1V1IfATRnSKO8oSOwicPWW8Hjg0wv3Px0A3fhylJCvoFditVfWFbnrsch5XVS8AD9Bbwzs9yfE7pyz1+38p8N7uX/K6jd4p5ScZr4zAwm5KOkIHgYNVtacb30mv1BY95yhL7GFgY/fpz0rgGno3VhxnY3Xjx/Ru6nYzsL+qPj7lW+OW861JTu+evx54J71F3vuBq7vNljRnVd1QVeuragO9n8WvVtUHGKOM0M5NSavqP4Fnk5zbTW0BHmcUOUe8+Pdu4Nv01kf+dCkXIvtk+yzwHHCU3p8q2+mtkewGDnSPa5Y446/TO735BrC3+3r3GOb8FeDRLudjwEe7+bcBDwFPAp8DVi31+97legdwzzhm7PJ8vfvad/z3Ztze8y7TJmCye9//EThjFDm9Yl9S07xiX1LTLDFJTbPEJDXNEpPUNEtMUtMsMUlNs8QkNc0Sk9S0/wfHiXmRhcu0+wAAAABJRU5ErkJggg==\n", "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "plt.imshow(pics_dict[0][11].reshape(52,64))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "for i in range(n_batches):\n", " with open('/disk/lhcb_data/davide/HCAL_project_full_event/true/sample'+str(i)+'.pickle', 'wb') as handle:\n", " pickle.dump(pics_dict[i], handle, protocol=pickle.HIGHEST_PROTOCOL)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAFKhJREFUeJzt3X2QXfV93/H3p8Lg2E4sQItLJFGJRElDMm6ibjGtW49jEp7sseiMmULToHGZ0TTBrlM3jUU9U9JkPIPT1tRMXTKKUQ0dF0yJUzQTpUTFuExnyoNweBIEs8UULVKsdQUkGU9MsL/94/5kLqu7D9q72ru75/2a2bnnfM/v3vv76Uj70XlOVSFJ6p6/MuoOSJJGwwCQpI4yACSpowwASeooA0CSOsoAkKSOMgAkqaMMAEnqKANAkjrqlFF3YDbr1q2rTZs2jbobkrSiPPLII9+qqrG52i3rANi0aRP79+8fdTckaUVJ8n/n085dQJLUUQaAJHWUASBJHWUASFJHGQCS1FEGgCR1lAEgSR1lAEhSRxkAktRRy/pK4NVs087ff8P88ze8f0Q9kdRVbgFIUkcZAJLUUQaAJHWUASBJHWUASFJHzRkASXYnOZLkyWn1jyZ5JsmBJL/VV78uyURbdnFf/ZJWm0iyc3GHIUk6UfM5DfQLwH8AbjtWSPKzwDbgnVX1nSRntfp5wJXATwI/DPyPJD/W3vY54OeBSeDhJHuq6qnFGogk6cTMGQBVdX+STdPKvwTcUFXfaW2OtPo24I5W/0aSCeD8tmyiqp4DSHJHa2sASNKILPQYwI8Bfy/Jg0n+Z5K/1errgYN97SZbbab6cZLsSLI/yf6pqakFdk+SNJ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vt+krgS8tRj9W4xbA9283UVWvAsduN7HSbQNubdO3ApePsC8zqqr7gaPTyjP1fRtwW/U8AKxNcvbS9HR2M4xjJtuAO6rqO1X1DWCC3t/DZaGqDlfV19r0nwFP07sqfyWul5nGMpNluW7an+2ft9k3tZ8C3gfc1erT18mxdXUXcGGSQRfWnpDVGACDbjcx21+Q5aiAP0zySLsyGuAdVXUYev8IgLNG1rsTN1PfV+K6+kjbLbK7bzfcihlH23XwM/T+x7mi18u0scAKWzdJ1iR5FDgC7KO3dfJyVb3WmvT39fvjaMtfAc4ctg+rMQDmvN3ECvDuqtpK766p1yZ5z6g7dJKstHV1M/AjwE8Dh4F/1+orYhxJ3gb8LvArVfWnszUdUFtW4xkwlhW3bqrqu1X10/TuiHA+8BODmrXXkzKO1RgAc95uYrmrqkPt9Qjwe/T+cnzz2GZ4ez0yuh6esJn6vqLWVVV9s/2j/R7wO7y+K2HZjyPJm+j9wvxiVX25lVfkehk0lpW8bqrqZeCr9I4BrE1y7Pqs/r5+fxxt+duZ/y7KGa3GAFjRt5tI8tYkP3hsGrgIeJLeGLa3ZtuBu0fTwwWZqe97gKvbWScXAK8c2yWxHE3bD/736a0X6I3jynamxmZgC/DQUvdvJm1f8S3A01X1mb5FK269zDSWlbZukowlWdumfwD4OXrHM+4DPtSaTV8nx9bVh4CvVDsiPJRRHw0/GT/0zmL4Or19ap8cdX9OsO/n0jtr4THgwLH+09vfdy/wbHs9Y9R9naH/t9PbBP9Lev9ruWamvtPbrP1cW09PAOOj7v8c4/jPrZ+Pt3+QZ/e1/2QbxzPApaPu/7Sx/F16uwseBx5tP5et0PUy01hW1LoB3gn8Uevvk8C/avVz6QXUBPBfgdNa/c1tfqItP3cx+uGVwJLUUatxF5AkaR4MAEnqKANAkjrKAJCkjjIAJKmjDABJ6igDQJI6ygCQpI76/1nXQUHTW1l7AAAAAElFTkSuQmCC\n", "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "plt.hist(pics_dict[0].sum(axis=(1,2))/1000, range=(0,300),bins=70);" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "#def make_pics_dict(X_grid, Y_grid, tracks, n_batches=n_batches):\n", "# X_pixels=64\n", "# Y_pixels=np.int(np.ceil((X_pixels*width_Y)/width_X))\n", "# pic = np.zeros(shape=(Y_pixels,X_pixels,1),dtype=np.float32)\n", "# pics_dict = {}\n", "# \n", "# for n in range(1):\n", "# \n", "# batch_size = tracks['regions'][0].shape[0]\n", "# pics_dict[n]=np.array([pic for i in range(0,batch_size)])\n", "# \n", "# for k in range(batch_size):\n", "# event=k\n", "# if tracks['regions'][n][event][0]>=0: #and particle_1[n][\"region\"][event]>=0 and particle_2[n][\"region\"][event]>=0:\n", "# #event = n*batch_size+k\n", "# \n", "# #print(event)\n", "# for i in range(X_grid.shape[0]-1):\n", "# for j in range(Y_grid.shape[1]-1):\n", "# for ntrack in range(tracks['xProjections'][n][event][0].shape[0]):\n", "# \n", "# xtrack = tracks['xProjections'][n][event][0][ntrack]*X_pixels/2\n", "# ytrack = tracks['yProjections'][n][event][0][ntrack]*Y_pixels/2 \n", "# \n", "# if X_grid[i,j] < xtrack < X_grid[i,j+1]:\n", "# if Y_grid[i,j] < ytrack < Y_grid[i+1,j]:\n", "#\n", "# \n", "# x_primed=int(Y_pixels/2-Y_grid[i,j])\n", "# y_primed=int(X_pixels/2+X_grid[i,j])\n", "#\n", "# #pics_dict[n][k][x_primed,y_primed,0]=1\n", "# \n", "# pics_dict[n][k][x_primed-1,y_primed-1,0]=tracks[\"realETs\"][n][event][0][ntrack]\n", "# #total_pic[x_primed-1,y_primed-1,0]=1\n", "# #total_pic[x_primed-1,y_primed-1,0]=true_events['true_ET'][event]\n", "# \n", "# \n", "# print('Converted '+str(n+1)+'/'+str(n_batches)+' batches of ' +str(batch_size)+' images')\n", "# \n", "# # \n", "# # if N % batch_size != 0:\n", "# # \n", "# # print('Converting last batch of '+str(N%batch_size)+' images') \n", "# # \n", "# # for k in range(batch_size*n_batches,N):\n", "# # #if true_events['region'][k]>=0:\n", "# # \n", "# # for i in range(X_grid.shape[0]):\n", "# # for j in range(Y_grid.shape[1]):\n", "# # if X_grid[i,j-1] < X_norm[n_batches][k]*X_pixels/2 < X_grid[i,j]:\n", "# # if Y_grid[i-1,j] < Y_norm[n_batches][k]*Y_pixels/2 < Y_grid[i,j]:\n", "# # \n", "# # x_primed=int(Y_pixels/2-Y_grid[i,j])\n", "# # y_primed=int(X_pixels/2+X_grid[i,j])\n", "# # \n", "# # pics_dict[n_batches][k-(N-1)][x_primed,y_primed,0]=true_events['true_ET'][event]\n", "# # #total_pic[x_primed,y_primed,0]=true_events['true_ET'][event]\n", "# return pics_dict\n", "#\n", "#\n", "#\n", "#" ] }, { "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 }