{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":91249,"databundleVersionId":11294684,"sourceType":"competition"}],"dockerImageVersionId":30918,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport pandas as pd\nimport numpy as np\nimport cv2","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-25T10:25:53.315386Z","iopub.execute_input":"2025-03-25T10:25:53.315766Z","iopub.status.idle":"2025-03-25T10:25:53.320894Z","shell.execute_reply.started":"2025-03-25T10:25:53.315735Z","shell.execute_reply":"2025-03-25T10:25:53.319436Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/byu-locating-bacterial-flagellar-motors-2025/train_labels.csv\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-25T10:25:53.552964Z","iopub.execute_input":"2025-03-25T10:25:53.553357Z","iopub.status.idle":"2025-03-25T10:25:53.565432Z","shell.execute_reply.started":"2025-03-25T10:25:53.553328Z","shell.execute_reply":"2025-03-25T10:25:53.564160Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"TOMO_ID = \"tomo_02862f\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-25T10:25:54.361378Z","iopub.execute_input":"2025-03-25T10:25:54.361767Z","iopub.status.idle":"2025-03-25T10:25:54.366423Z","shell.execute_reply.started":"2025-03-25T10:25:54.361732Z","shell.execute_reply":"2025-03-25T10:25:54.365105Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def plot_motors(tomo_id):\n    tomo_motors = df[df[\"tomo_id\"] == tomo_id]\n\n\n    n = len(tomo_motors)\n\n    for row in range(n):\n        img = cv2.imread(f\"/kaggle/input/byu-locating-bacterial-flagellar-motors-2025/train/{tomo_id}/slice_{int(tomo_motors['Motor axis 0'].iloc[row]):04d}.jpg\", cv2.IMREAD_GRAYSCALE)\n        img = cv2.circle(img, (int(tomo_motors[\"Motor axis 2\"].iloc[row]),int(tomo_motors[\"Motor axis 1\"].iloc[row])), 12, (255,0,0), thickness=5)\n        plt.subplot(1, n, row + 1)\n        plt.imshow(img)\n    plt.tight_layout()\n    plt.show()\n    ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-25T10:30:01.845104Z","iopub.execute_input":"2025-03-25T10:30:01.845490Z","iopub.status.idle":"2025-03-25T10:30:01.853345Z","shell.execute_reply.started":"2025-03-25T10:30:01.845460Z","shell.execute_reply":"2025-03-25T10:30:01.851665Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### TOMO ID: tomo_02862f\n\nThe location of flagellar motor makes sense here.","metadata":{}},{"cell_type":"code","source":"plot_motors(\"tomo_02862f\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-25T10:30:42.890451Z","iopub.execute_input":"2025-03-25T10:30:42.890890Z","iopub.status.idle":"2025-03-25T10:30:43.240379Z","shell.execute_reply.started":"2025-03-25T10:30:42.890855Z","shell.execute_reply":"2025-03-25T10:30:43.238883Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### TOMO ID: tomo_0de3ee\n\nAre these supposed to be flagellar motors?","metadata":{}},{"cell_type":"code","source":"plot_motors(\"tomo_0de3ee\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-25T10:30:53.155660Z","iopub.execute_input":"2025-03-25T10:30:53.156112Z","iopub.status.idle":"2025-03-25T10:30:53.683185Z","shell.execute_reply.started":"2025-03-25T10:30:53.156080Z","shell.execute_reply":"2025-03-25T10:30:53.681882Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}