{"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":84969,"databundleVersionId":10033515,"sourceType":"competition"}],"dockerImageVersionId":30918,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"! pip install zarr","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:55:08.167739Z","iopub.execute_input":"2025-03-26T12:55:08.168056Z","iopub.status.idle":"2025-03-26T12:55:17.971460Z","shell.execute_reply.started":"2025-03-26T12:55:08.168019Z","shell.execute_reply":"2025-03-26T12:55:17.970352Z"},"_kg_hide-output":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import json\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport zarr","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:55:17.973329Z","iopub.execute_input":"2025-03-26T12:55:17.973717Z","iopub.status.idle":"2025-03-26T12:55:19.344753Z","shell.execute_reply.started":"2025-03-26T12:55:17.973687Z","shell.execute_reply":"2025-03-26T12:55:19.343844Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Load the first zarr.\nz_ts_6_4 = zarr.open('/kaggle/input/czii-cryo-et-object-identification/test/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/denoised.zarr', mode='r')\nz_ts_6_4_iso = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/isonetcorrected.zarr', mode='r')\nz_ts_6_4_dcon = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/ctfdeconvolved.zarr', mode='r')\nz_ts_6_4_wbp = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/wbp.zarr', mode='r')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:55:19.346156Z","iopub.execute_input":"2025-03-26T12:55:19.346821Z","iopub.status.idle":"2025-03-26T12:55:19.530192Z","shell.execute_reply.started":"2025-03-26T12:55:19.346790Z","shell.execute_reply":"2025-03-26T12:55:19.529178Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(f\"{z_ts_6_4} :: 0:{z_ts_6_4[0].shape} ,1: {z_ts_6_4[1].shape} ,2:{z_ts_6_4[2].shape}\")\nprint(f\"{z_ts_6_4_iso} :: 0:{z_ts_6_4_iso[0].shape} ,1: {z_ts_6_4_iso[1].shape} ,2:{z_ts_6_4_iso[2].shape}\")\nprint(f\"{z_ts_6_4_dcon} :: 0:{z_ts_6_4_dcon[0].shape} ,1: {z_ts_6_4_dcon[1].shape} ,2:{z_ts_6_4_dcon[2].shape}\")\nprint(f\"{z_ts_6_4_wbp} :: 0:{z_ts_6_4_wbp[0].shape} ,1: {z_ts_6_4_wbp[1].shape} ,2:{z_ts_6_4_wbp[2].shape}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:55:19.531052Z","iopub.execute_input":"2025-03-26T12:55:19.531376Z","iopub.status.idle":"2025-03-26T12:55:19.706609Z","shell.execute_reply.started":"2025-03-26T12:55:19.531338Z","shell.execute_reply":"2025-03-26T12:55:19.705633Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **High Resolutiom** ","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(6.3,6.3))\n_=plt.imshow(z_ts_6_4[0][64])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:55:19.707635Z","iopub.execute_input":"2025-03-26T12:55:19.707957Z","iopub.status.idle":"2025-03-26T12:55:25.167756Z","shell.execute_reply.started":"2025-03-26T12:55:19.707932Z","shell.execute_reply":"2025-03-26T12:55:25.166739Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(30,60))\nfor i in range(184):\n    ax = plt.subplot(20,10,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[0][i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:55:25.170357Z","iopub.execute_input":"2025-03-26T12:55:25.170640Z","iopub.status.idle":"2025-03-26T12:57:30.041880Z","shell.execute_reply.started":"2025-03-26T12:55:25.170618Z","shell.execute_reply":"2025-03-26T12:57:30.040669Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Medium Resolution**","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(6.3,6.3))\n_=plt.imshow(z_ts_6_4[1][0])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:57:30.043647Z","iopub.execute_input":"2025-03-26T12:57:30.043968Z","iopub.status.idle":"2025-03-26T12:57:31.054230Z","shell.execute_reply.started":"2025-03-26T12:57:30.043940Z","shell.execute_reply":"2025-03-26T12:57:31.053070Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(30,60))\nfor i in range(92):\n    ax = plt.subplot(20,10,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[1][i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:57:31.055533Z","iopub.execute_input":"2025-03-26T12:57:31.055822Z","iopub.status.idle":"2025-03-26T12:57:53.173333Z","shell.execute_reply.started":"2025-03-26T12:57:31.055800Z","shell.execute_reply":"2025-03-26T12:57:53.172159Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Low Resolution**","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(6.3,6.3))\n_=plt.imshow(z_ts_6_4[2][0])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:57:53.174579Z","iopub.execute_input":"2025-03-26T12:57:53.174894Z","iopub.status.idle":"2025-03-26T12:57:53.537327Z","shell.execute_reply.started":"2025-03-26T12:57:53.174867Z","shell.execute_reply":"2025-03-26T12:57:53.536305Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(30,60))\nfor i in range(46):\n    ax = plt.subplot(20,10,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[2][i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:57:53.538497Z","iopub.execute_input":"2025-03-26T12:57:53.538874Z","iopub.status.idle":"2025-03-26T12:57:58.827902Z","shell.execute_reply.started":"2025-03-26T12:57:53.538837Z","shell.execute_reply":"2025-03-26T12:57:58.826099Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Denoised, IsoNet Corrected, CTF Deconvolved, and Weighted Back Projection**","metadata":{}},{"cell_type":"code","source":"title_list = ['Denoised','IsoNet Corrected','CTF Deconvolved','Weight Back Projection']\nimg_list = [z_ts_6_4,z_ts_6_4_iso,z_ts_6_4_dcon,z_ts_6_4_wbp]\n\nfig = plt.figure(figsize=(10,10))\nfor i,title in enumerate(title_list):\n    ax = plt.subplot(2,2,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.title(title)\n    plt.imshow(img_list[i][0][62])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:57:58.829485Z","iopub.execute_input":"2025-03-26T12:57:58.829813Z","iopub.status.idle":"2025-03-26T12:58:09.910222Z","shell.execute_reply.started":"2025-03-26T12:57:58.829785Z","shell.execute_reply":"2025-03-26T12:58:09.908895Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,10))\nfor i,name in enumerate(title_list):\n    ax = plt.subplot(2,2,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.title(name)\n    plt.imshow(img_list[i][0][62],cmap='gray')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:09.911503Z","iopub.execute_input":"2025-03-26T12:58:09.911887Z","iopub.status.idle":"2025-03-26T12:58:12.577977Z","shell.execute_reply.started":"2025-03-26T12:58:09.911840Z","shell.execute_reply":"2025-03-26T12:58:12.576735Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nx = [1, 2, 3, 4, 5]\ny = [10, 15, 7, 20, 12]\n\nplt.scatter(x, y, color='blue', marker='o')  # Scatter plot with blue circles\nplt.xlabel(\"X-axis Label\")\nplt.ylabel(\"Y-axis Label\")\nplt.title(\"Scatter Plot Example\")\nplt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T13:16:22.540012Z","iopub.execute_input":"2025-03-26T13:16:22.540444Z","iopub.status.idle":"2025-03-26T13:16:22.763577Z","shell.execute_reply.started":"2025-03-26T13:16:22.540416Z","shell.execute_reply":"2025-03-26T13:16:22.762529Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Ribosome Identification**\n\nNow that we can plot the images the next step is to try to identify structures of interest. Lists of those structures for TS_6_4 are in the train/overlay directory. We'll start with ribosomes.\n\nFind all of the ribosomes between 600 and 650 in the z-axis, and plot them on slide 62 to see if we get something reasonable. If we do that suggests the origin is in the upper left in the x and y directions, and in the first image in the z direction.","metadata":{}},{"cell_type":"code","source":"#file = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/ribosome.json')\n#file.read()\n'''\n'{\n\"pickable_object_name\": \"ribosome\", \n\"user_id\": \"curation\", \n\"session_id\": \"0\", \n\"run_name\": \"TS_6_4\", \n\"voxel_spacing\": null, \n\"unit\": \"angstrom\", \n\"points\": [\n    {\"location\": {\"x\": 5274.903, \"y\": 5288.121, \"z\": 619.798}, \n     \"transformation_\": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], \n     \"instance_id\": 0}, \n    {\"location\": {\"x\": 5493.057, \"y\": 5181.127, \"z\": 726.624}, \n     \"transformation_\": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], \n     \"instance_id\": 0}, \n    {\"location\": {\"x\": 5656.951, \"y\": 5168.655, \"z\": 421.572}, \n     \"transformation_\": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], \n     \"instance_id\": 0}, \n    \n'''","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:12.579176Z","iopub.execute_input":"2025-03-26T12:58:12.579597Z","iopub.status.idle":"2025-03-26T12:58:12.586828Z","shell.execute_reply.started":"2025-03-26T12:58:12.579561Z","shell.execute_reply":"2025-03-26T12:58:12.585678Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"ribosome_x = []\nribosome_y = []\n\nfile = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/ribosome.json')\nfor p in json.loads(file.read())['points']:\n    z=float(p[\"location\"][\"z\"])\n    if z >= 600 and z < 650 :\n        ribosome_x.append(float(p[\"location\"][\"x\"])/10)\n        ribosome_y.append(float(p[\"location\"][\"y\"])/10)\n        print(p[\"location\"])\n    ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:12.587945Z","iopub.execute_input":"2025-03-26T12:58:12.588345Z","iopub.status.idle":"2025-03-26T12:58:12.620836Z","shell.execute_reply.started":"2025-03-26T12:58:12.588280Z","shell.execute_reply":"2025-03-26T12:58:12.619877Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,8))\nfor i in range(2):\n    ax = plt.subplot(1,2,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[0][62], cmap='gray', vmin=-0.00005, vmax=0.00005)\n    if i%2==1:\n        plt.scatter(ribosome_x,ribosome_y, edgecolor='red',facecolor='none')\n    ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:12.621922Z","iopub.execute_input":"2025-03-26T12:58:12.622268Z","iopub.status.idle":"2025-03-26T12:58:13.912089Z","shell.execute_reply.started":"2025-03-26T12:58:12.622243Z","shell.execute_reply":"2025-03-26T12:58:13.911017Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Vorus Identification**","metadata":{}},{"cell_type":"code","source":"virus_x = []\nvirus_y = []\n\nfile = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/virus-like-particle.json')\nfor p in json.loads(file.read())['points']:\n    z=float(p[\"location\"][\"z\"])\n    if z >= 670 and z < 700 :\n        virus_x.append(float(p[\"location\"][\"x\"])/10)\n        virus_y.append(float(p[\"location\"][\"y\"])/10)\n        print(p[\"location\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:13.913163Z","iopub.execute_input":"2025-03-26T12:58:13.913572Z","iopub.status.idle":"2025-03-26T12:58:13.927185Z","shell.execute_reply.started":"2025-03-26T12:58:13.913518Z","shell.execute_reply":"2025-03-26T12:58:13.926123Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,8))\nfor i in range(2):\n    ax = plt.subplot(1,2,i+1)\n    #plt.xticks([])\n    #plt.yticks([])\n    plt.imshow(z_ts_6_4[0][68], cmap='gray', vmin=-0.00005, vmax=0.00005)\n    if i%2==1:\n        plt.scatter(virus_x,virus_y, edgecolor='red',facecolor='none')\n    ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:13.928167Z","iopub.execute_input":"2025-03-26T12:58:13.928544Z","iopub.status.idle":"2025-03-26T12:58:15.417745Z","shell.execute_reply.started":"2025-03-26T12:58:13.928507Z","shell.execute_reply":"2025-03-26T12:58:15.416716Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Apo-Ferritin Identification**","metadata":{}},{"cell_type":"code","source":"apo_ferritin_x = []\napo_ferritin_y = []\n\nfile = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/apo-ferritin.json')\nfor p in json.loads(file.read())['points']:\n    z=float(p[\"location\"][\"z\"])\n    if z >= 400 and z < 450 :\n        apo_ferritin_x.append(float(p[\"location\"][\"x\"])/10)\n        apo_ferritin_y.append(float(p[\"location\"][\"y\"])/10)\n        print(p[\"location\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:15.420823Z","iopub.execute_input":"2025-03-26T12:58:15.421104Z","iopub.status.idle":"2025-03-26T12:58:15.435368Z","shell.execute_reply.started":"2025-03-26T12:58:15.421081Z","shell.execute_reply":"2025-03-26T12:58:15.434149Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,8))\nfor i in range(2):\n    ax = plt.subplot(1,2,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[0][43], cmap='gray', vmin=-0.00005, vmax=0.00005)\n    if i%2==1:\n        plt.scatter(apo_ferritin_x, apo_ferritin_y, edgecolor='red',facecolor='none')\n    ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:15.436812Z","iopub.execute_input":"2025-03-26T12:58:15.437204Z","iopub.status.idle":"2025-03-26T12:58:16.686597Z","shell.execute_reply.started":"2025-03-26T12:58:15.437173Z","shell.execute_reply":"2025-03-26T12:58:16.685530Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Beta-Galactosidase Identification** ","metadata":{}},{"cell_type":"code","source":"beta_galactosidase_x = []\nbeta_galactosidase_y = []\n\nfile = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/beta-galactosidase.json')\nfor p in json.loads(file.read())['points']:\n    z=float(p[\"location\"][\"z\"])\n    if z >= 450 and z < 500 :\n        beta_galactosidase_x.append(float(p[\"location\"][\"x\"])/10)\n        beta_galactosidase_y.append(float(p[\"location\"][\"y\"])/10)\n        print(p[\"location\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:16.687663Z","iopub.execute_input":"2025-03-26T12:58:16.687956Z","iopub.status.idle":"2025-03-26T12:58:16.700580Z","shell.execute_reply.started":"2025-03-26T12:58:16.687930Z","shell.execute_reply":"2025-03-26T12:58:16.699413Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,8))\nfor i in range(2):\n    ax = plt.subplot(1,2,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[0][47], cmap='gray', vmin=-0.00005, vmax=0.00005)\n    if i%2==1:\n        plt.scatter(beta_galactosidase_x, beta_galactosidase_y, edgecolor='red',facecolor='none')\n    ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:16.701775Z","iopub.execute_input":"2025-03-26T12:58:16.702156Z","iopub.status.idle":"2025-03-26T12:58:17.962752Z","shell.execute_reply.started":"2025-03-26T12:58:16.702113Z","shell.execute_reply":"2025-03-26T12:58:17.961569Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Thyroglobulin Identification**","metadata":{}},{"cell_type":"code","source":"thyroglobulin_x = []\nthyroglobulin_y = []\n\nfile = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/thyroglobulin.json')\nfor p in json.loads(file.read())['points']:\n    z=float(p[\"location\"][\"z\"])\n    if z >= 450 and z < 500 :\n        thyroglobulin_x.append(float(p[\"location\"][\"x\"])/10)\n        thyroglobulin_y.append(float(p[\"location\"][\"y\"])/10)\n        print(p[\"location\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:17.963899Z","iopub.execute_input":"2025-03-26T12:58:17.964434Z","iopub.status.idle":"2025-03-26T12:58:17.977582Z","shell.execute_reply.started":"2025-03-26T12:58:17.964371Z","shell.execute_reply":"2025-03-26T12:58:17.976603Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,8))\nfor i in range(2):\n    ax = plt.subplot(1,2,i+1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[0][47], cmap='gray', vmin=-0.00005, vmax=0.00005)\n    if i%2==1:\n        plt.scatter(thyroglobulin_x, thyroglobulin_y, edgecolor='red',facecolor='none')\n    ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T12:58:17.978623Z","iopub.execute_input":"2025-03-26T12:58:17.978980Z","iopub.status.idle":"2025-03-26T12:58:19.244474Z","shell.execute_reply.started":"2025-03-26T12:58:17.978954Z","shell.execute_reply":"2025-03-26T12:58:19.243414Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Ribosome Close-Up**\nThe following are zoomed in images of a ribosome from three perspectives, straight on, from the right side (front is to the left) and from the top (front is to the bottom.) Somewhat unexpected is the difference in image quality from the sides and top.","metadata":{}},{"cell_type":"code","source":"# {'x': 5274.903, 'y': 5288.121, 'z': 619.798}\n\nfig = plt.figure(figsize=(10,2.5))\n\nax = plt.subplot(1,4,1)\nplt.xticks([])\nplt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][62],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\nplt.scatter([5274.903/10],[5288.121/10],edgecolor='red',facecolor='none')\n\nax = plt.subplot(1,4,2)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][62,513:543,512:542],cmap=\"gray\")\n\nax = plt.subplot(1,4,3)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Side view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(2,1,0))[527,507:547,42:82],cmap=\"gray\")\n\nax = plt.subplot(1,4,4)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Top view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(1,0,2))[528,42:82,508:548],cmap=\"gray\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T13:36:21.054203Z","iopub.execute_input":"2025-03-26T13:36:21.054620Z","iopub.status.idle":"2025-03-26T13:36:23.716616Z","shell.execute_reply.started":"2025-03-26T13:36:21.054594Z","shell.execute_reply":"2025-03-26T13:36:23.715568Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Virus Close-Up**","metadata":{}},{"cell_type":"code","source":"#{'x': 911.29, 'y': 5638.402, 'z': 671.21}\n#{'x': 5580.108, 'y': 1240.86, 'z': 692.222}\n#{'x': 4765.58, 'y': 3469.964, 'z': 689.813}\n\nfig = plt.figure(figsize=(10,2.5))\n\nax = plt.subplot(1,4,1)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][67],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\nplt.scatter([911.29/10],[5638.402/10],edgecolor='red',facecolor='none')\n\nax = plt.subplot(1,4,2)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][67,543:583,71:111],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,3)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Side view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(2,1,0))[91,533:573,47:87],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,4)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Top view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(1,0,2))[563,37:97,61:121],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T13:43:41.915575Z","iopub.execute_input":"2025-03-26T13:43:41.915960Z","iopub.status.idle":"2025-03-26T13:43:44.637262Z","shell.execute_reply.started":"2025-03-26T13:43:41.915928Z","shell.execute_reply":"2025-03-26T13:43:44.636145Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Apo-Ferritin Close-Up**","metadata":{}},{"cell_type":"code","source":"# {'x': 1019.831, 'y': 1859.831, 'z': 400.424}\n\nfig = plt.figure(figsize=(10,2.5))\n\nax = plt.subplot(1,4,1)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][40],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\nplt.scatter([1019.83/10],[1859.83/10],edgecolor='red',facecolor='none')\n\nax = plt.subplot(1,4,2)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][40,166:206,82:122],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,3)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Side view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(2,1,0))[102,166:206,20:60],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,4)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Top view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(1,0,2))[186,20:60,82:122],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T13:49:28.464651Z","iopub.execute_input":"2025-03-26T13:49:28.465037Z","iopub.status.idle":"2025-03-26T13:49:31.121177Z","shell.execute_reply.started":"2025-03-26T13:49:28.465011Z","shell.execute_reply":"2025-03-26T13:49:31.120068Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Beta-Galactosidase Close-Up**","metadata":{}},{"cell_type":"code","source":"# {'x': 804.615, 'y': 1977.846, 'z': 489.385}\n# 2 1 0\n\nfig = plt.figure(figsize=(10,2.5))\n\nax = plt.subplot(1,4,1)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][49],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\nplt.scatter([804.615/10],[1977.846/10],edgecolor='red',facecolor='none')\n\nax = plt.subplot(1,4,2)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][49,178:218,60:100],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,3)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Side view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(2,1,0))[80,178:218,29:69],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,4)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Top view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(1,0,2))[198,29:69,60:100],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T13:54:10.621525Z","iopub.execute_input":"2025-03-26T13:54:10.621883Z","iopub.status.idle":"2025-03-26T13:54:13.353476Z","shell.execute_reply.started":"2025-03-26T13:54:10.621860Z","shell.execute_reply":"2025-03-26T13:54:13.352313Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Thyroglobulin Close-Up**","metadata":{}},{"cell_type":"code","source":"# {'x': 5251.785, 'y': 2090.452, 'z': 490.516}\n# 2 1 0\n\nfig = plt.figure(figsize=(10,2.5))\n\nax = plt.subplot(1,4,1)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][49],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\nplt.scatter([5251/10],[2090/10],edgecolor='red',facecolor='none')\n\nax = plt.subplot(1,4,2)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][49,189:228,505:545],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,3)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Side view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(2,1,0))[525,189:228,29:69],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n\nax = plt.subplot(1,4,4)\n#plt.xticks([])\n#plt.yticks([])\nplt.title('Top view')\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(1,0,2))[209,29:69,505:545],cmap=\"gray\",vmin=-5e-5,vmax=5e-5)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T13:57:37.519990Z","iopub.execute_input":"2025-03-26T13:57:37.520441Z","iopub.status.idle":"2025-03-26T13:57:40.516578Z","shell.execute_reply.started":"2025-03-26T13:57:37.520406Z","shell.execute_reply":"2025-03-26T13:57:40.515364Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Low Res from the Side**\nHere is the low resolution version plotted from the rigth side moving from the far side to the near side. The point of doing this is to get a look at the overall image quality from the side.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,64))\nfor i in range(158):\n    ax = plt.subplot(18,9,i+1)\n    if i != 0:\n        plt.xticks([])\n        plt.yticks([])\n    plt.imshow(np.transpose(z_ts_6_4[2],axes=(2,1,0))[i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T14:04:52.202093Z","iopub.execute_input":"2025-03-26T14:04:52.202521Z","iopub.status.idle":"2025-03-26T14:05:07.843139Z","shell.execute_reply.started":"2025-03-26T14:04:52.202488Z","shell.execute_reply":"2025-03-26T14:05:07.841373Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Low Res from the Top**\nSame idea from the top. Images proceed from top to bottom of the volume.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,50))\nfor i in range(158):\n    ax = plt.subplot(40,4,i+1)\n    if i != 0:\n        plt.xticks([])\n        plt.yticks([])\n    plt.imshow(np.transpose(z_ts_6_4[2],axes=(1,0,2))[i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T14:36:35.220710Z","iopub.execute_input":"2025-03-26T14:36:35.221070Z","iopub.status.idle":"2025-03-26T14:36:49.867865Z","shell.execute_reply.started":"2025-03-26T14:36:35.221040Z","shell.execute_reply":"2025-03-26T14:36:49.865992Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Deformation along the Z-axis**\nReturning to the ribosome, the same views are displayed with the side and top views elongated along the z-axis. A red circle is displayed to indicate the 150 unit radius around the central point. The images pretty clearly show that the ribosome does not stay within the radius.\n\nStraight On","metadata":{}},{"cell_type":"code","source":"circle = plt.Circle((15,15),radius=10,edgecolor='r',facecolor=\"none\")\nplt.gca().add_patch(circle)\nplt.imshow(z_ts_6_4[0][62,513:543,512:542],cmap=\"gray\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T14:40:35.340703Z","iopub.execute_input":"2025-03-26T14:40:35.341108Z","iopub.status.idle":"2025-03-26T14:40:35.653915Z","shell.execute_reply.started":"2025-03-26T14:40:35.341072Z","shell.execute_reply":"2025-03-26T14:40:35.651656Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Side View","metadata":{}},{"cell_type":"code","source":"circle = plt.Circle((20,20),radius=15,edgecolor='r',facecolor=\"none\")\nplt.gca().add_patch(circle)\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(2,1,0))[527,507:547,42:82],cmap=\"gray\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T14:42:52.318343Z","iopub.execute_input":"2025-03-26T14:42:52.318684Z","iopub.status.idle":"2025-03-26T14:42:53.298931Z","shell.execute_reply.started":"2025-03-26T14:42:52.318660Z","shell.execute_reply":"2025-03-26T14:42:53.298044Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Top View","metadata":{}},{"cell_type":"code","source":"circle = plt.Circle((20,20),radius=15,edgecolor='r',facecolor=\"none\")\nplt.gca().add_patch(circle)\nplt.imshow(np.transpose(z_ts_6_4[0],axes=(1,0,2))[528,42:82,508:548],cmap=\"gray\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-26T14:43:21.371770Z","iopub.execute_input":"2025-03-26T14:43:21.372132Z","iopub.status.idle":"2025-03-26T14:43:22.322743Z","shell.execute_reply.started":"2025-03-26T14:43:21.372099Z","shell.execute_reply":"2025-03-26T14:43:22.321694Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **Conclusion**\nThe mapping between the x, y, and z coordinates so far appears quite straightforward. For the highest resolution images 10 units per pixel in all 3 directions with the origin in the first image in the upper left had corner seems to work. The wikipedia article on cryoET suggests the sample is twisted when generating the images, but so far that hasn't seemed to create any complications here. That said it might be worth identifying structures in \"worst-case\" locations to confirm that we didn't just get lucky. Note: The mapping has been confirmed in the notebook comments.","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}