{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"raw","source":"It is still work in progress !","metadata":{}},{"cell_type":"code","source":"#importing all the necessary libraries\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits import mplot3d\nimport plotly.express as px\nimport numpy as np\nimport pandas as pd\nimport os\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2023-05-18T14:38:44.077208Z","iopub.execute_input":"2023-05-18T14:38:44.078928Z","iopub.status.idle":"2023-05-18T14:38:47.779943Z","shell.execute_reply.started":"2023-05-18T14:38:44.078853Z","shell.execute_reply":"2023-05-18T14:38:47.778524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"There are batches of datasets \nand train_meta.parquet, test_meta ans sensor geometry.\nLet's explore these.\n### exploring the sensor geometry ","metadata":{}},{"cell_type":"code","source":"sensor_geo = pd.read_csv('/kaggle/input/icecube-neutrinos-in-deep-ice/sensor_geometry.csv')","metadata":{"execution":{"iopub.status.busy":"2023-05-18T14:39:03.223764Z","iopub.execute_input":"2023-05-18T14:39:03.224456Z","iopub.status.idle":"2023-05-18T14:39:03.261265Z","shell.execute_reply.started":"2023-05-18T14:39:03.224396Z","shell.execute_reply":"2023-05-18T14:39:03.260149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sensor_geo.describe()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T13:44:47.541923Z","iopub.execute_input":"2023-05-15T13:44:47.542391Z","iopub.status.idle":"2023-05-15T13:44:47.593490Z","shell.execute_reply.started":"2023-05-15T13:44:47.542348Z","shell.execute_reply":"2023-05-15T13:44:47.592024Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"There are \n* 5160 sensors\n* across x = 576 to x = - 570, y = -521 to + 509, z = -512 to +524","metadata":{}},{"cell_type":"code","source":"print(sensor_geo.nunique())","metadata":{"execution":{"iopub.status.busy":"2023-03-24T16:59:13.788353Z","iopub.execute_input":"2023-03-24T16:59:13.788779Z","iopub.status.idle":"2023-03-24T16:59:13.802594Z","shell.execute_reply.started":"2023-03-24T16:59:13.788742Z","shell.execute_reply":"2023-03-24T16:59:13.800996Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* Seems to be spread acorss x and y but along the z axis ","metadata":{}},{"cell_type":"code","source":"sensor_geo.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-24T17:02:35.973553Z","iopub.execute_input":"2023-03-24T17:02:35.974152Z","iopub.status.idle":"2023-03-24T17:02:35.991418Z","shell.execute_reply.started":"2023-03-24T17:02:35.974100Z","shell.execute_reply":"2023-03-24T17:02:35.990098Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.scatter_3d(x = sensor_geo['x'], y = sensor_geo['y'], z = sensor_geo['z'],color = sensor_geo['z'], opacity=0.5)# mode = 'markers',\n\nfig.update_traces(marker_size=2)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-05-14T14:55:30.684081Z","iopub.execute_input":"2023-05-14T14:55:30.684477Z","iopub.status.idle":"2023-05-14T14:55:32.136003Z","shell.execute_reply.started":"2023-05-14T14:55:30.684444Z","shell.execute_reply":"2023-05-14T14:55:32.133783Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Shows where the sensors arew placed ","metadata":{}},{"cell_type":"markdown","source":"Loading the dataset and looking how they look","metadata":{}},{"cell_type":"code","source":"train_meta = pd.read_parquet('/kaggle/input/icecube-neutrinos-in-deep-ice/train_meta.parquet')","metadata":{"execution":{"iopub.status.busy":"2023-05-18T14:39:09.957888Z","iopub.execute_input":"2023-05-18T14:39:09.958402Z","iopub.status.idle":"2023-05-18T14:39:54.555553Z","shell.execute_reply.started":"2023-05-18T14:39:09.958359Z","shell.execute_reply":"2023-05-18T14:39:54.554171Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"each batch has 200000 values","metadata":{}},{"cell_type":"markdown","source":"There are 660 batches","metadata":{}},{"cell_type":"markdown","source":"There is train_meta which has information about the batch_id, event_id, first_pulse, last_pulse, azimuth, zenith angles\nbath_ids 0->660\nThere are 200,000 of each. With each of these batches we see first_pulse_index = last_pulse+1","metadata":{}},{"cell_type":"code","source":"train_meta.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T13:47:38.035662Z","iopub.execute_input":"2023-05-15T13:47:38.036153Z","iopub.status.idle":"2023-05-15T13:47:38.052009Z","shell.execute_reply.started":"2023-05-15T13:47:38.036114Z","shell.execute_reply":"2023-05-15T13:47:38.050462Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1 = pd.read_parquet('/kaggle/input/icecube-neutrinos-in-deep-ice/train/batch_1.parquet')","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:19:23.500872Z","iopub.execute_input":"2023-05-18T15:19:23.501451Z","iopub.status.idle":"2023-05-18T15:19:28.515019Z","shell.execute_reply.started":"2023-05-18T15:19:23.501402Z","shell.execute_reply":"2023-05-18T15:19:28.513652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T17:56:47.949637Z","iopub.execute_input":"2023-05-15T17:56:47.950128Z","iopub.status.idle":"2023-05-15T17:56:47.968737Z","shell.execute_reply.started":"2023-05-15T17:56:47.950083Z","shell.execute_reply":"2023-05-15T17:56:47.966918Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1.tail()","metadata":{"execution":{"iopub.status.busy":"2023-05-14T15:29:16.008868Z","iopub.execute_input":"2023-05-14T15:29:16.009373Z","iopub.status.idle":"2023-05-14T15:29:16.023543Z","shell.execute_reply.started":"2023-05-14T15:29:16.009322Z","shell.execute_reply":"2023-05-14T15:29:16.022129Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Let's compare the batch_! dataset with the meta dataset that has batch id of 1","metadata":{}},{"cell_type":"markdown","source":"All the event ids from meta atleast for batch 1 is unique. ","metadata":{}},{"cell_type":"code","source":"batch_2 = pd.read_parquet('/kaggle/input/icecube-neutrinos-in-deep-ice/train/batch_2.parquet')","metadata":{"execution":{"iopub.status.busy":"2023-05-15T15:16:25.589399Z","iopub.execute_input":"2023-05-15T15:16:25.592317Z","iopub.status.idle":"2023-05-15T15:16:31.906569Z","shell.execute_reply.started":"2023-05-15T15:16:25.592209Z","shell.execute_reply":"2023-05-15T15:16:31.903602Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_2.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T14:26:50.339687Z","iopub.execute_input":"2023-05-15T14:26:50.340168Z","iopub.status.idle":"2023-05-15T14:26:50.356544Z","shell.execute_reply.started":"2023-05-15T14:26:50.340118Z","shell.execute_reply":"2023-05-15T14:26:50.355012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_2.tail()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T14:28:05.493993Z","iopub.execute_input":"2023-05-15T14:28:05.494646Z","iopub.status.idle":"2023-05-15T14:28:05.517795Z","shell.execute_reply.started":"2023-05-15T14:28:05.494600Z","shell.execute_reply":"2023-05-15T14:28:05.516416Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"let's look at the batch number 1 specific information from the train set","metadata":{}},{"cell_type":"code","source":"batch1FromTrain = train_meta[train_meta['batch_id'] == 1]","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:18:54.418350Z","iopub.execute_input":"2023-05-18T15:18:54.418990Z","iopub.status.idle":"2023-05-18T15:18:55.196388Z","shell.execute_reply.started":"2023-05-18T15:18:54.418937Z","shell.execute_reply":"2023-05-18T15:18:55.194879Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch1FromTrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T17:49:04.401463Z","iopub.execute_input":"2023-05-15T17:49:04.402057Z","iopub.status.idle":"2023-05-15T17:49:04.436849Z","shell.execute_reply.started":"2023-05-15T17:49:04.401964Z","shell.execute_reply":"2023-05-15T17:49:04.435299Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Each training dataset has batches and events information and each batch df has sensor id information, ","metadata":{}},{"cell_type":"code","source":"batch_1.loc[24]","metadata":{"execution":{"iopub.status.busy":"2023-05-15T18:27:28.745259Z","iopub.execute_input":"2023-05-15T18:27:28.747993Z","iopub.status.idle":"2023-05-15T18:27:30.398072Z","shell.execute_reply.started":"2023-05-15T18:27:28.747893Z","shell.execute_reply":"2023-05-15T18:27:30.395415Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"we see that the event id 24 gives 61 rows which is same as the lastpulse index - first  plulse index. \nfor every pulse we get the time when it happens, charge deposition, and sensor_id information that is the detector triggered.","metadata":{}},{"cell_type":"markdown","source":"Let's add this information on the training data","metadata":{}},{"cell_type":"code","source":"batch1FromTrain['nTimes']  = batch1FromTrain['last_pulse_index'] - batch1FromTrain['first_pulse_index'] + 1\n","metadata":{"execution":{"iopub.status.busy":"2023-05-15T19:34:47.886818Z","iopub.execute_input":"2023-05-15T19:34:47.887313Z","iopub.status.idle":"2023-05-15T19:34:47.896618Z","shell.execute_reply.started":"2023-05-15T19:34:47.887266Z","shell.execute_reply":"2023-05-15T19:34:47.895141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch1FromTrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T19:34:51.264364Z","iopub.execute_input":"2023-05-15T19:34:51.264785Z","iopub.status.idle":"2023-05-15T19:34:51.279824Z","shell.execute_reply.started":"2023-05-15T19:34:51.264744Z","shell.execute_reply":"2023-05-15T19:34:51.278647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch1FromTrain.nTimes.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-05-15T19:34:57.586344Z","iopub.execute_input":"2023-05-15T19:34:57.586718Z","iopub.status.idle":"2023-05-15T19:34:57.601313Z","shell.execute_reply.started":"2023-05-15T19:34:57.586676Z","shell.execute_reply":"2023-05-15T19:34:57.599957Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"it seems for batch 1 the max nTimes is 47 ","metadata":{}},{"cell_type":"code","source":"batch1FromTrain[batch1FromTrain['nTimes'] == 47]","metadata":{"execution":{"iopub.status.busy":"2023-05-15T19:35:04.948106Z","iopub.execute_input":"2023-05-15T19:35:04.948598Z","iopub.status.idle":"2023-05-15T19:35:04.970221Z","shell.execute_reply.started":"2023-05-15T19:35:04.948557Z","shell.execute_reply":"2023-05-15T19:35:04.969070Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"let's randomly choose the 1st row i.e event id corresponding to 1676 \nlook at infomration from batch 1 ","metadata":{}},{"cell_type":"code","source":"#resetiing index\nbatch_1 = batch_1.reset_index()","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:19:50.574402Z","iopub.execute_input":"2023-05-18T15:19:50.577022Z","iopub.status.idle":"2023-05-18T15:19:51.370425Z","shell.execute_reply.started":"2023-05-18T15:19:50.576937Z","shell.execute_reply":"2023-05-18T15:19:51.368414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#batch_1.loc[1676]\n#there should be 47 rows, givinh information of what sensors are triggered. \n# there positions and angles it makes","metadata":{"execution":{"iopub.status.busy":"2023-05-15T19:45:02.225914Z","iopub.execute_input":"2023-05-15T19:45:02.226379Z","iopub.status.idle":"2023-05-15T19:45:02.232467Z","shell.execute_reply.started":"2023-05-15T19:45:02.226340Z","shell.execute_reply":"2023-05-15T19:45:02.230402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-17T19:25:56.681964Z","iopub.execute_input":"2023-05-17T19:25:56.682413Z","iopub.status.idle":"2023-05-17T19:25:56.700350Z","shell.execute_reply.started":"2023-05-17T19:25:56.682374Z","shell.execute_reply":"2023-05-17T19:25:56.698890Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#merging the dataframes\nbatch_1_sensor_info = batch_1.merge(sensor_geo, on='sensor_id') #here we are losing eleements from the batch_1 ","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:19:57.602323Z","iopub.execute_input":"2023-05-18T15:19:57.602882Z","iopub.status.idle":"2023-05-18T15:20:06.410512Z","shell.execute_reply.started":"2023-05-18T15:19:57.602833Z","shell.execute_reply":"2023-05-18T15:20:06.408408Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1_sensor_info.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-17T19:28:18.893382Z","iopub.execute_input":"2023-05-17T19:28:18.893950Z","iopub.status.idle":"2023-05-17T19:28:18.921423Z","shell.execute_reply.started":"2023-05-17T19:28:18.893890Z","shell.execute_reply":"2023-05-17T19:28:18.919695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1_sensor_info.info()","metadata":{"execution":{"iopub.status.busy":"2023-05-17T19:33:54.314459Z","iopub.execute_input":"2023-05-17T19:33:54.315021Z","iopub.status.idle":"2023-05-17T19:33:54.375413Z","shell.execute_reply.started":"2023-05-17T19:33:54.314971Z","shell.execute_reply":"2023-05-17T19:33:54.373610Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#this is the merged dfs\nbatch_1_sensor_info = pd.merge(batch_1, sensor_geo, on='sensor_id', how='left')","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:20:10.142672Z","iopub.execute_input":"2023-05-18T15:20:10.143220Z","iopub.status.idle":"2023-05-18T15:20:17.587885Z","shell.execute_reply.started":"2023-05-18T15:20:10.143146Z","shell.execute_reply":"2023-05-18T15:20:17.586378Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1_sensor_info.head()","metadata":{"execution":{"iopub.status.busy":"2023-05-17T19:35:33.822256Z","iopub.execute_input":"2023-05-17T19:35:33.822714Z","iopub.status.idle":"2023-05-17T19:35:33.845320Z","shell.execute_reply.started":"2023-05-17T19:35:33.822672Z","shell.execute_reply":"2023-05-17T19:35:33.842964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#let us choose randome event_id and understand\nbatch_1_eventid67 = batch_1_sensor_info[batch_1_sensor_info['event_id'] == 67]","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:20:18.824543Z","iopub.execute_input":"2023-05-18T15:20:18.825591Z","iopub.status.idle":"2023-05-18T15:20:20.516222Z","shell.execute_reply.started":"2023-05-18T15:20:18.825522Z","shell.execute_reply":"2023-05-18T15:20:20.514871Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1_eventid67","metadata":{"execution":{"iopub.status.busy":"2023-05-17T19:38:13.506959Z","iopub.execute_input":"2023-05-17T19:38:13.507627Z","iopub.status.idle":"2023-05-17T19:38:13.539835Z","shell.execute_reply.started":"2023-05-17T19:38:13.507568Z","shell.execute_reply":"2023-05-17T19:38:13.538804Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#let's see how things look like in the training dataset of batch 1 with event id 67\n","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"markdown","source":"should remove the aux with true since that corresposnsd to background or noise","metadata":{}},{"cell_type":"code","source":"batch_1_eventid67 = batch_1_eventid67.drop(['sensor_id'], axis = 1) #since already have x,y,z","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:20:37.255588Z","iopub.execute_input":"2023-05-18T15:20:37.257027Z","iopub.status.idle":"2023-05-18T15:20:37.266395Z","shell.execute_reply.started":"2023-05-18T15:20:37.256962Z","shell.execute_reply":"2023-05-18T15:20:37.264937Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.histplot(batch_1_eventid67['auxiliary'])","metadata":{"execution":{"iopub.status.busy":"2023-05-17T20:06:41.796127Z","iopub.execute_input":"2023-05-17T20:06:41.796601Z","iopub.status.idle":"2023-05-17T20:06:42.187730Z","shell.execute_reply.started":"2023-05-17T20:06:41.796559Z","shell.execute_reply":"2023-05-17T20:06:42.186012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"batch_1_eventid67","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:16:42.677041Z","iopub.execute_input":"2023-05-18T15:16:42.678986Z","iopub.status.idle":"2023-05-18T15:16:42.888741Z","shell.execute_reply.started":"2023-05-18T15:16:42.678923Z","shell.execute_reply":"2023-05-18T15:16:42.886505Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# here above we are looking at the event id = 67 which  riggered 142 sensors including the ","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"we observe that various sensor ids are","metadata":{}},{"cell_type":"markdown","source":"for a particular batch let's look at the event id and what could it possibly mean","metadata":{}},{"cell_type":"markdown","source":"There are batch ids mentioned in the train_meta that are\n* 660 batch ids\n    * these batch id have event ids and, first_pulse_index and last_pulse_index for a specific event\n    * Frequency  of event_id in a fixed batch is same as first_pulse_index - last_pulse_index\n    * These event_id stores  the information of all the sensor numbers that were triggered, at time t and deposits charge e","metadata":{}},{"cell_type":"markdown","source":"We have\n* train_meta -> batches, the angle with it enters for an event\n* batch_n -> contains all the sensor number that gets triggered with increasing time and, charge deposited\n* sensor_geometry -> sensors id and where they are located","metadata":{}},{"cell_type":"code","source":"train_meta['nTimes'] = (train_meta.last_pulse_index - train_meta.first_pulse_index) +1","metadata":{"execution":{"iopub.status.busy":"2023-03-24T21:04:02.955979Z","iopub.execute_input":"2023-03-24T21:04:02.956362Z","iopub.status.idle":"2023-03-24T21:04:04.250565Z","shell.execute_reply.started":"2023-03-24T21:04:02.956326Z","shell.execute_reply":"2023-03-24T21:04:04.249151Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_meta.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-24T21:04:50.135897Z","iopub.execute_input":"2023-03-24T21:04:50.137137Z","iopub.status.idle":"2023-03-24T21:04:50.155862Z","shell.execute_reply.started":"2023-03-24T21:04:50.137086Z","shell.execute_reply":"2023-03-24T21:04:50.154419Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Need to predict in which direction the neutrino came. \nit could be upwards or downwards. hen we know whereve the other neutrinos came from they  moved and riggered so many other sensors. \n1.since we have x,y,z and itis a point particle\nwe could find the slopes for each event id and put them in the training dataset \nand then use that to evaluate \\theta and \\phi\n\n2. but, het what if it is not straight line but, a zig zag path with some mean free path. so we could just take the true signal and use that to estimate things. \n\n\n(It is also interesting to see we are looking at the connection between a random initial angle in which direction it came and all the subsequuent sensors it hit. \nsomething that can be used in the research ) \n","metadata":{}},{"cell_type":"markdown","source":"## mean free path ","metadata":{}},{"cell_type":"markdown","source":"1. choose particular event\n2. remove the noise signals\n3. just estimate the mean free path from the x,y,z corresponding to the true signa. \nuse that distance parameter in the training dataset ","metadata":{}},{"cell_type":"code","source":"batch_1_eventid67 = batch_1_eventid67[batch_1_eventid67['auxiliary'] == False] #getting rid of the noise\n#droppping the event id and aux \nbatch_1_eventid67.drop(['event_id','auxiliary'], axis = 1)","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:27:28.852426Z","iopub.execute_input":"2023-05-18T15:27:28.853079Z","iopub.status.idle":"2023-05-18T15:27:28.897009Z","shell.execute_reply.started":"2023-05-18T15:27:28.853026Z","shell.execute_reply":"2023-05-18T15:27:28.895971Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def meanFreePath(df):\n    dx = df['x'].diff()\n    dy = df['y'].diff()\n    dz = df['z'].diff()\n\n# Calculate the squared distances for each coordinate difference\n    distance_squared = dx**2 + dy**2 + dz**2\n\n# Calculate the average distance traveled\n    avg_distance = np.sqrt(distance_squared.mean())\n\n    return avg_distance","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:46:03.736553Z","iopub.execute_input":"2023-05-18T15:46:03.738072Z","iopub.status.idle":"2023-05-18T15:46:03.746156Z","shell.execute_reply.started":"2023-05-18T15:46:03.738008Z","shell.execute_reply":"2023-05-18T15:46:03.744752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#finding mean free path, avg charge, avg time \nevt67_charge= batch_1_eventid67['charge'].mean()\n#evt67_time  = batch_1_eventid67['time', -1]\nevt67_path  = meanFreePath(batch_1_eventid67)\n","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:46:34.651168Z","iopub.execute_input":"2023-05-18T15:46:34.651676Z","iopub.status.idle":"2023-05-18T15:46:34.663493Z","shell.execute_reply.started":"2023-05-18T15:46:34.651637Z","shell.execute_reply":"2023-05-18T15:46:34.662012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"evt67_charge","metadata":{"execution":{"iopub.status.busy":"2023-05-18T15:46:39.976440Z","iopub.execute_input":"2023-05-18T15:46:39.977057Z","iopub.status.idle":"2023-05-18T15:46:39.986224Z","shell.execute_reply.started":"2023-05-18T15:46:39.976946Z","shell.execute_reply":"2023-05-18T15:46:39.984803Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"looking at how \\theta and \\phi hanges as well throughout the system for an event ","metadata":{}},{"cell_type":"code","source":"def angles(df):\n    df['theta'] = np.arccos(df['z'])\n    df['azimuthal'] = np.df['x']**2 + df['y']**2","metadata":{},"execution_count":null,"outputs":[]}]}