diff --git a/docs/src/1_examples/3_3Dplots/plotModel3D.ipynb b/docs/src/1_examples/3_3Dplots/plotModel3D.ipynb index b9316b0..94283ff 100644 --- a/docs/src/1_examples/3_3Dplots/plotModel3D.ipynb +++ b/docs/src/1_examples/3_3Dplots/plotModel3D.ipynb @@ -1,16 +1,31 @@ { "cells": [ + { + "cell_type": "markdown", + "id": "bb5e9049", + "metadata": {}, + "source": [ + "# Make a 3D plot of your model, that you can rotate, where you can zoom in, etc." + ] + }, + { + "cell_type": "markdown", + "id": "68b2f3fe", + "metadata": {}, + "source": [ + "### Importing packages" + ] + }, { "cell_type": "code", "execution_count": 1, - "id": "1aa00683-8e08-4c67-9fc2-e5d3cf73f385", + "id": "7f3f6af5", "metadata": { "tags": [] }, "outputs": [], "source": [ "import numpy as np\n", - "\n", "import plons\n", "import plons.ConversionFactors_cgs as cgs\n", "import plons.PhysicalQuantities as pq\n", @@ -26,79 +41,68 @@ }, { "cell_type": "markdown", - "id": "d8f69b7c-acb3-49f2-9b7a-20102e5598d7", + "id": "84c675d3", "metadata": {}, "source": [ - "EXAMPLE" + "### Retrieve the data of the example model" ] }, { "cell_type": "code", - "execution_count": 2, - "id": "6a3ce4aa-0da4-443e-9fd3-e75c1fc9385a", - "metadata": { - "tags": [] - }, + "execution_count": 9, + "id": "e435d46a", + "metadata": {}, "outputs": [], "source": [ - "'''\n", - "Load in data\n", - "'''\n", - "model = 'v20e00'\n", - "run = '/lhome/jolienm/Documents/TierModels/R_Aql/cooling/binariesInPaper/finalAccrDisks/'+str(model)+'_T3000_res8_racc01/'\n", - "dump = 292\n", - " \n", - "setup = plons.LoadSetup(run, \"wind\")\n", - "dumpData = plons.LoadFullDump(os.path.join(run, f\"wind_%05d\" % dump), setup)\n", - "pos = dumpData['position']/cgs.au" + "prefix = 'wind'\n", + "model = 'v10e00'\n", + "loc = str(model)\n", + "dumpnumber = 584\n", + "dump = os.path.join(loc, f\"{prefix}_{dumpnumber:05d}\")\n" ] }, { "cell_type": "code", - "execution_count": 2, - "id": "4a77e6e9-8e5c-47aa-8b6f-836696ea0c98", - "metadata": { - "tags": [] - }, + "execution_count": 10, + "id": "9b26a061", + "metadata": {}, "outputs": [], "source": [ - "'''\n", - "Load in data\n", - "'''\n", - "model = 'v20e00'\n", - "run = '/lhome/jolienm/Documents/TierModels/finalModelsHIcooling/'+str(model)+'/'\n", - "dump = 600\n", - " \n", - "setup = plons.LoadSetup(run, \"wind\")\n", - "dumpData = plons.LoadFullDump(os.path.join(run, f\"wind_%05d\" % dump), setup)\n", - "pos = dumpData['position']/cgs.au" + "!mkdir -p $loc" ] }, { "cell_type": "code", - "execution_count": 16, - "id": "bddfdd1b-078a-41f1-b46b-5c05c15435fd", - "metadata": { - "tags": [] - }, + "execution_count": 12, + "id": "38f9fd84", + "metadata": {}, "outputs": [], "source": [ - "'''\n", - "Load in data\n", - "'''\n", - "run = '/STER/hydroModels/jolienm/modelsSlurm/planets/P40slowSilke_c/'\n", - "# run = '/lhome/jolienm/Documents/TierModels/R_Aql/cooling/binariesInPaper/bin_v20a06e00_c_MR/'\n", - "dump = 888\n", - " \n", - "setup = plons.LoadSetup(run, \"wind\")\n", - "dumpData = plons.LoadFullDump(os.path.join(run, f\"wind_%05d\" % dump), setup)\n", - "pos = dumpData['position']/cgs.au" + "%%capture\n", + "if not os.path.exists(dump):\n", + " # !wget \"https://github.com/Ensor-code/phantom-models/raw/refs/heads/main/Esseldeurs+2023/BinaryHighLucy/wind_00600?download=\" --output-document $dump\n", + " !wget 'https://raw.githubusercontent.com/Ensor-code/phantom-models/main/Malfait%2B2024a/v10e00/wind_v10e00' --output-document $dump\n", + "\n", + "infile = os.path.join(loc, f\"{prefix}.in\")\n", + "if not os.path.exists(infile):\n", + " !wget 'https://raw.githubusercontent.com/Ensor-code/phantom-models/main/Malfait%2B2024a/v10e00/wind.in' --output-document $infile\n", + "\n", + "setupfile = os.path.join(loc, f\"{prefix}.setup\")\n", + "if not os.path.exists(setupfile):\n", + " !wget 'https://raw.githubusercontent.com/Ensor-code/phantom-models/main/Malfait%2B2024a/v10e00/wind.setup' --output-document $setupfile\n" + ] + }, + { + "cell_type": "markdown", + "id": "f3ef2edb", + "metadata": {}, + "source": [ + "### Load in the data of your model" ] }, { "cell_type": "code", - "execution_count": 22, - "id": "fbc44d90-1823-437e-b0e9-aa120bb4731a", + "execution_count": 15, "metadata": { "tags": [] }, @@ -107,19 +111,26 @@ "'''\n", "Load in data\n", "'''\n", - "run = '/STER/hydroModels/matse/Binary6Lucy/'\n", - "# run = '/lhome/jolienm/Documents/TierModels/R_Aql/cooling/binariesInPaper/bin_v20a06e00_c_MR/'\n", - "dump = 600\n", " \n", - "setup = plons.LoadSetup(run, \"wind\")\n", - "dumpData = plons.LoadFullDump(os.path.join(run, f\"wind_%05d\" % dump), setup)\n", + "setup = plons.LoadSetup(loc, prefix)\n", + "dumpData = plons.LoadFullDump(dump, setup)\n", "pos = dumpData['position']/cgs.au" ] }, + { + "cell_type": "markdown", + "id": "7bf88093", + "metadata": {}, + "source": [ + "### Make the interactive 3D plot of the full data\n", + "(if the widget can't load, do pip install ipympl)\n", + "\n", + "In the interactive plot, you can change the point_size, opacity, colorbar min and max value in '> Points' " + ] + }, { "cell_type": "code", - "execution_count": 3, - "id": "cfe4d2ca-3de1-4505-ac8b-00aa82791804", + "execution_count": 16, "metadata": { "tags": [] }, @@ -127,7 +138,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "a0c966e15b8f46909cddb42b14515172", + "model_id": "db898d1843744a2392822488892faddd", "version_major": 2, "version_minor": 0 }, @@ -141,7 +152,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "b02cc0c63fe54abcb8a2dcc30886c3d0", + "model_id": "6cd2ccfe9b9343d3b14999f9c786a113", "version_major": 2, "version_minor": 0 }, @@ -154,8 +165,6 @@ } ], "source": [ - "## Make 3D plot of full data\n", - "\n", "#choose colorbar limits (can also be changed interactively)\n", "colMin = -20\n", "colMax = -12\n", @@ -164,33 +173,17 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "7b25800a-4392-4ff7-92ac-f730083d18bd", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5afab499-2263-4f65-b77c-0baddd747797", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2dc3d072-e954-47e3-b625-f9df80f8de67", + "cell_type": "markdown", + "id": "46af1461", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "### Make the same plot, but only include that within a certain range of projected velocities\n", + "This is usefull when you want to compare to channel maps, that only include data with a certain projected velocity (absolute value of velocity, so - and + side are plot)" + ] }, { "cell_type": "code", - "execution_count": 16, - "id": "326df486-96aa-4f93-9940-8d965a046810", + "execution_count": 7, "metadata": { "tags": [] }, @@ -198,7 +191,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "f79f3178c1d5411cb539a0f928ef8a5d", + "model_id": "89281a157b65447c8fb82baad0742635", "version_major": 2, "version_minor": 0 }, @@ -212,7 +205,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "7385a20f0e6a406894856b120b5bfb5f", + "model_id": "16427dfb27b74d93ab6eb083f0f31474", "version_major": 2, "version_minor": 0 }, @@ -225,25 +218,17 @@ } ], "source": [ - "# Make 3D plot of data within certain velocity (now absolute value) range to get dat in certain channel map\n", - "vmin = 0\n", + "# Make 3D plot of data within certain velocity (absolute value) range to get dat in certain channel map\n", + "vmin = 4\n", "vmax = 7\n", "#Fill in v_y, v_z, v_x or other v_array depending on inclincation\n", - "p3.makePlot_vDir(dumpData['vz'], dumpData['r'], dumpData['rho'], pos, vmin, vmax,pt_size =1,opty=0.5)" + "p3.makePlot_vDir(dumpData['vz'], dumpData['r'], dumpData['rho'], pos, vmin, vmax,pt_size =2,opty=0.7)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6450e529-3412-487e-b5f5-caaba05499e1", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" },