{"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":"markdown","source":"Upon conducting an analysis of the coordinates, it has been determined that one of the strings located at approximately 443.43, -194.3 coordinates deviates from the ideal of a perfectly vertical line.","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport matplotlib.pyplot as plt","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sensors_df = pd.read_csv('./data/sensor_geometry.csv')","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# lets group x and y coordinates and check how many detectors are attached in each of them.\n# almost all of the strings are in a perfect vertical line except one.\ntop_view_coordinates = sensors_df.groupby(['x', 'y']).size()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# lets find the one that is not in a perfect verticla line\nplt.figure(figsize=(6, 6))\nplt.scatter([x for x, y in top_view_coordinates.index if top_view_coordinates[x, y] == 1], [y for x, y in top_view_coordinates.index if top_view_coordinates[x, y] == 1], color='red')\nplt.scatter([x for x, y in top_view_coordinates.index if top_view_coordinates[x, y] == 60], [y for x, y in top_view_coordinates.index if top_view_coordinates[x, y] == 60], color='green')\nplt.show()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# top view\nplt.figure(figsize=(6, 6))\nplt.scatter([x for x, y in top_view_coordinates.index if top_view_coordinates[x, y] == 1], [y for x, y in top_view_coordinates.index if top_view_coordinates[x, y] == 1], color='red')\nplt.show()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"bad_string = [(x,y) for x, y in top_view_coordinates.index if top_view_coordinates[x, y] == 1]","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"bad_coordinates = sensors_df[sensors_df[['x', 'y']].apply(tuple, 1).isin(bad_string)]","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure(figsize=(6, 6))\nax = fig.add_subplot(111, projection='3d')\nax.scatter(bad_coordinates['x'], bad_coordinates['y'], bad_coordinates['z'], color='red')\nm = plt.cm.ScalarMappable(cmap=plt.cm.jet)\nplt.show()","metadata":{},"execution_count":null,"outputs":[]}]}