diff --git a/00 - Getting Started.ipynb b/00 - Getting Started.ipynb index b0d644a..313e0a5 100644 --- a/00 - Getting Started.ipynb +++ b/00 - Getting Started.ipynb @@ -19,11 +19,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "9797388.698102012" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "6.6738e-11 * 5.972e24 / 6378.1**2" + "6.6738e-11 * 5.972e24 / 6378.1**2\n" ] }, { @@ -35,11 +46,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "pri" + "print\n" ] }, { @@ -51,11 +73,11 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ - "from math import si" + "from math import sin\n" ] }, { @@ -67,11 +89,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], "source": [ - "print(" + "print()\n" ] }, { @@ -90,15 +120,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[]" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhYAAAGdCAYAAABO2DpVAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjExLjIsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvgI3uAAAAAAlwSFlzAAAPYQAAD2EBqD+naQAANp5JREFUeJzt3Qd01GXa//9PeiMJJIEESOidQEgQFAQFEbEgIr24z+o+u7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ZgAQAAXIZgAQAA5Cr/P1fHhLKlpoJSAAAAAElFTkSuQmCC", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "%matplotlib inline\n", "from matplotlib import pyplot\n", - "import numpy\n", + "import numpy as np\n", "\n", - "pyplot.plot(numpy.arange(10))" + "pyplot.plot(np.arange(10))\n" ] }, { @@ -110,20 +161,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "metadata": {}, "outputs": [], "source": [ - "# preamble to check and install AMUSE components if necessary\n", - "%%bash\n", - "# required packages for this tutorial:\n", - "PACKAGES=\"amuse-framework\"\n", - "# skip in case a full development install is present\n", - "pip show amuse-devel && exit 0\n", - "for package in ${PACKAGES} \n", - "do\n", - " pip show ${package} || pip install ${package}\n", - "done" + "# # preamble to check and install AMUSE components if necessary\n", + "# %%bash\n", + "# # required packages for this tutorial:\n", + "# PACKAGES=\"amuse-framework\"\n", + "# # skip in case a full development install is present\n", + "# pip show amuse-devel && exit 0\n", + "# for package in ${PACKAGES} \n", + "# do\n", + "# pip show ${package} || pip install ${package}\n", + "# done\n" ] }, { @@ -135,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": { "jupyter": { "source_hidden": true @@ -144,16 +195,16 @@ }, "outputs": [], "source": [ - "# preamble to check and install AMUSE components if necessary\n", - "%%bash\n", - "# required packages for this tutorial:\n", - "PACKAGES=\"amuse-framework\"\n", - "# skip in case a full development install is present\n", - "pip show amuse-devel && exit 0\n", - "for package in ${PACKAGES} \n", - "do\n", - " pip show ${package} || pip install ${package}\n", - "done" + "# # preamble to check and install AMUSE components if necessary\n", + "# %%bash\n", + "# # required packages for this tutorial:\n", + "# PACKAGES=\"amuse-framework\"\n", + "# # skip in case a full development install is present\n", + "# pip show amuse-devel && exit 0\n", + "# for package in ${PACKAGES} \n", + "# do\n", + "# pip show ${package} || pip install ${package}\n", + "# done\n" ] }, { @@ -165,7 +216,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "metadata": { "tags": [] }, @@ -174,7 +225,7 @@ "# the following fixes are highly recommended\n", "\n", "#allow oversubscription for openMPI\n", - "import os\n", + "import os \n", "os.environ[\"OMPI_MCA_rmaps_base_oversubscribe\"]=\"true\"\n", "\n", "# use lower cpu resources for idle codes\n", @@ -191,18 +242,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2026.3.0\n" + ] + } + ], "source": [ "import amuse\n", - "print(amuse.version.version)" + "print(amuse.__version__)\n" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Amuse-env", "language": "python", "name": "python3" }, @@ -216,7 +275,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.14.7" } }, "nbformat": 4, diff --git a/01 - Units and Quantities.ipynb b/01 - Units and Quantities.ipynb index e97329c..10222b8 100644 --- a/01 - Units and Quantities.ipynb +++ b/01 - Units and Quantities.ipynb @@ -14,14 +14,14 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "metadata": { "tags": [] }, "outputs": [], "source": [ "# Load in the amuse units module\n", - "from amuse.units import units" + "from amuse.units import units\n" ] }, { @@ -35,11 +35,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "quantity<1.989e+30 kg>" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "1.989e30 | units.kg" + "1.989e30 | units.kg\n" ] }, { @@ -51,14 +62,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "diameter : 12768000 m\n", + "surface area : 512148164653208.25 m**2\n", + "volume : 1.089851294382027e+21 m**3\n" + ] + } + ], "source": [ "earth_radius = 6384000 | units.m\n", "print(\"diameter :\", earth_radius * 2)\n", "print(\"surface area :\", 4.0 * units.pi * earth_radius**2)\n", - "print(\"volume :\", 4.0 / 3.0 * units.pi * earth_radius**3)" + "print(\"volume :\", 4.0 / 3.0 * units.pi * earth_radius**3)\n" ] }, { @@ -70,12 +91,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "earth radius unit : 6384000 * m\n" + ] + } + ], "source": [ "earth_radius_unit=6384000 * units.m\n", - "print(\"earth radius unit :\", earth_radius_unit)" + "print(\"earth radius unit :\", earth_radius_unit)\n" ] }, { @@ -87,14 +116,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 41, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "density : 5479.8209909787565 m**-3 * kg\n", + "density : 5479.8209909787565 m**-3 * kg\n" + ] + } + ], "source": [ "earth_mass = 5.97219e24 | units.kg\n", "earth_volume = 4.0 * units.pi * earth_radius**3 / 3\n", "density = earth_mass / earth_volume\n", - "print(\"density :\", earth_mass / earth_volume)" + "print(\"density :\", earth_mass / earth_volume)\n", + "print(\"density :\", density)\n" ] }, { @@ -106,13 +145,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "numerical value: 5479.8209909787565\n", + "unit: m**-3 * kg\n", + "simplified: 5479.8209909787565 m**-3 * kg\n" + ] + } + ], "source": [ "print(\"numerical value:\", density.number)\n", "print(\"unit:\", density.unit)\n", - "print(\"simplified:\", density.in_base())" + "print(\"simplified:\", density.in_base())\n" ] }, { @@ -124,11 +173,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 43, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "earth mass in gram : 5.972190000000001e+27\n" + ] + } + ], "source": [ - "print(\"earth mass in gram :\", earth_mass.value_in(units.g))" + "print(\"earth mass in gram :\", earth_mass.value_in(units.g))\n" ] }, { @@ -140,11 +197,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 44, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "earth mass in solar masses : 3.0027301248919016e-06\n" + ] + } + ], "source": [ - "print(\"earth mass in solar masses :\", earth_mass.value_in(units.MSun))" + "print(\"earth mass in solar masses :\", earth_mass.value_in(units.MSun))\n" ] }, { @@ -156,12 +221,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 45, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "earth mass : 3.0027301248919016e-06 MSun\n" + ] + } + ], "source": [ "earth_mass2 = earth_mass.in_(units.MSun)\n", - "print(\"earth mass :\", earth_mass2)" + "print(\"earth mass :\", earth_mass2)\n" ] }, { @@ -173,13 +246,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 46, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n" + ] + } + ], "source": [ - "print(earth_mass == earth_mass2)" + "print(earth_mass == earth_mass2)\n" ] }, { @@ -191,11 +272,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The escape speed is 1.15498917744e-05 53476144765.21653 * m * s**-1\n" + ] + } + ], "source": [ "# Declare some variables\n", "star_mass = 1 | units.MSun\n", @@ -206,7 +295,7 @@ "G = 6.67e-11 | units.m**3 * units.kg**-1 * units.s**-2\n", "velocity_escape = (2 * G * star_mass / star_radius).sqrt()\n", "\n", - "print(f\"The escape speed is {velocity_escape}\")" + "print(f\"The escape speed is {velocity_escape}\")\n" ] }, { @@ -221,11 +310,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 48, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The escape speed is: 617.64368455 kms\n" + ] + } + ], "source": [ - "print(f\"The escape speed is: {velocity_escape.in_(units.kms)}\")" + "print(f\"The escape speed is: {velocity_escape.in_(units.kms)}\")\n" ] }, { @@ -239,13 +336,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 49, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The escape speed is: 617.64368455 kms\n" + ] + } + ], "source": [ "from amuse.units import constants\n", "vesc = (2*constants.G*star_mass/star_radius).sqrt()\n", - "print(f\"The escape speed is: {velocity_escape.in_(units.kms)}\")" + "print(f\"The escape speed is: {velocity_escape.in_(units.kms)}\")\n" ] }, { @@ -266,6 +371,30 @@ "Calculate the orbital velocity of the planet Earth in orbit around the Sun." ] }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The orbital velocity is: 29.785890530074838 km / s\n" + ] + } + ], + "source": [ + "import numpy as np\n", + "\n", + "radius = 1 | units.AU\n", + "distance = 2*np.pi*radius\n", + "time = 1 | units.yr\n", + "\n", + "orbital_velocity = distance / time\n", + "print(f\"The orbital velocity is: {orbital_velocity.in_(units.km/units.s)}\")\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -274,6 +403,27 @@ "Calculate the escape speed of the supermassive black hole in the Galactic center from the pericenter of S2 (the star famously used to characterize the central supermassive black hole)." ] }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The escape speed is: 7971.77833724 kms\n" + ] + } + ], + "source": [ + "sagA_mass = 4.297e6 | units.MSun\n", + "sagA_radius = 120 | units.AU\n", + "\n", + "vesc = (2*constants.G*sagA_mass/sagA_radius).sqrt()\n", + "print(f\"The escape speed is: {vesc.in_(units.kms)}\")\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -285,6 +435,15 @@ "Is the acceleration due to the Earth's gravitational well important?" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -309,7 +468,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Amuse-env", "language": "python", "name": "python3" }, @@ -323,7 +482,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.14.7" } }, "nbformat": 4, diff --git a/02 - Particles.ipynb b/02 - Particles.ipynb index 4bf9960..55200c9 100644 --- a/02 - Particles.ipynb +++ b/02 - Particles.ipynb @@ -13,12 +13,12 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 490, "metadata": {}, "outputs": [], "source": [ "from amuse.units import units, constants\n", - "from amuse.lab import Particles, Particle" + "from amuse.lab import Particles, Particle\n" ] }, { @@ -30,11 +30,11 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 491, "metadata": {}, "outputs": [], "source": [ - "sun_and_earth = Particles(2)" + "sun_and_earth = Particles(2)\n" ] }, { @@ -46,23 +46,53 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 492, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sun=Particle(10812175574878836636, set=<123187028390448>\n", + " , mass=1.0 MSun\n", + " , vx=0.0 kms\n", + " , vy=0.0 kms\n", + " , vz=0.0 kms\n", + " , x=0.0 au\n", + " , y=0.0 au\n", + " , z=0.0 au)\n" + ] + } + ], "source": [ "# declare the sun\n", "sun = sun_and_earth[0]\n", "sun.mass = 1 | units.MSun\n", "sun.position = (0, 0, 0) | units.au\n", "sun.velocity = (0, 0, 0) | units.kms\n", - "print(f\"Sun={sun}\")" + "print(f\"Sun={sun}\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 493, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Earth=Particle(295656550295629073, set=<123187028390448>\n", + " , mass=3.00273515275e-06 MSun\n", + " , vx=0.0 kms\n", + " , vy=29.7885123292 kms\n", + " , vz=0.0 kms\n", + " , x=1.0 au\n", + " , y=0.0 au\n", + " , z=0.0 au)\n" + ] + } + ], "source": [ "# now declare the Earth\n", "def relative_orbital_velocity(mass, distance):\n", @@ -77,18 +107,31 @@ " earth.position.length()\n", ")\n", "earth.velocity = (0, 1, 0) * vorb\n", - "print(f\"Earth={earth}\")" + "print(f\"Earth={earth}\")\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 494, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " key mass vx vy vz x y z\n", + " - MSun kms kms kms au au au\n", + "==================== =========== =========== =========== =========== =========== =========== ===========\n", + "10812175574878836636 1.000e+00 0.000e+00 -8.945e-05 0.000e+00 -3.003e-06 0.000e+00 0.000e+00\n", + " 295656550295629073 3.003e-06 0.000e+00 2.979e+01 0.000e+00 1.000e+00 0.000e+00 0.000e+00\n", + "==================== =========== =========== =========== =========== =========== =========== ===========\n" + ] + } + ], "source": [ "# normally it is a good idea to study a system in its center of mass:\n", "sun_and_earth.move_to_center()\n", - "print(sun_and_earth)" + "print(sun_and_earth)\n" ] }, { @@ -100,11 +143,11 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 495, "metadata": {}, "outputs": [], "source": [ - "sun_and_earth.name = [\"sun\", \"earth\"]" + "sun_and_earth.name = [\"sun\", \"earth\"]\n" ] }, { @@ -118,12 +161,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 496, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Earth=Particle(295656550295629073, set=<123187028390448>\n", + " , mass=3.00273515275e-06 MSun\n", + " , name=earth\n", + " , vx=0.0 kms\n", + " , vy=29.7884228825 kms\n", + " , vz=0.0 kms\n", + " , x=0.999996997274 au\n", + " , y=0.0 au\n", + " , z=0.0 au)\n" + ] + } + ], "source": [ "earth = sun_and_earth[sun_and_earth.name==\"earth\"][0] # note the index! do you understand the difference when removing it?\n", - "print(f\"Earth={earth}\")" + "print(f\"Earth={earth}\")\n" ] }, { @@ -135,9 +194,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 497, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "moon=Particle(3835875604347703949, set=<123187028220272>\n", + " , mass=7.34767309e+22 kg\n", + " , name=moon\n", + " , vx=0.0 44597309335878.1 * m * s**-1\n", + " , vy=2.2973349771e-11 44597309335878.1 * m * s**-1\n", + " , vz=0.0 44597309335878.1 * m * s**-1\n", + " , x=384400.0 km\n", + " , y=0.0 km\n", + " , z=0.0 km)\n" + ] + } + ], "source": [ "moon = Particle()\n", "moon.name = \"moon\"\n", @@ -148,7 +223,7 @@ " moon.position.length()\n", ")\n", "moon.velocity = (0, 1, 0) * vorb\n", - "print(f\"moon={moon}\")" + "print(f\"moon={moon}\")\n" ] }, { @@ -162,12 +237,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 498, "metadata": {}, "outputs": [], "source": [ "moon.position += earth.position\n", - "moon.velocity += earth.velocity" + "moon.velocity += earth.velocity\n" ] }, { @@ -179,11 +254,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 499, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 499, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "sun_and_earth.add_particle(moon)" + "sun_and_earth.add_particle(moon)\n" ] }, { @@ -196,11 +282,11 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 500, "metadata": {}, "outputs": [], "source": [ - "solar_system = sun_and_earth" + "solar_system = sun_and_earth\n" ] }, { @@ -212,12 +298,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 501, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solar system:\n", + " key mass name vx vy vz x y z\n", + " - MSun none kms kms kms au au au\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n", + "10812175574878836636 1.000e+00 sun 0.000e+00 -9.059e-05 0.000e+00 -3.040e-06 0.000e+00 0.000e+00\n", + " 295656550295629073 3.003e-06 earth 0.000e+00 2.979e+01 0.000e+00 1.000e+00 0.000e+00 0.000e+00\n", + " 3835875604347703949 3.694e-08 moon 0.000e+00 3.081e+01 0.000e+00 1.003e+00 0.000e+00 0.000e+00\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n" + ] + } + ], "source": [ "solar_system.move_to_center()\n", - "print(f\"Solar system:\\n{solar_system}\")" + "print(f\"Solar system:\\n{solar_system}\")\n" ] }, { @@ -229,11 +330,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 502, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n" + ] + } + ], "source": [ - "print(moon in solar_system)" + "print(moon in solar_system)\n" ] }, { @@ -246,11 +355,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 503, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mass= [333029.704297, 1.0, 0.0123031263019] MEarth\n" + ] + } + ], "source": [ - "print(\"mass=\", solar_system.mass.in_(units.MEarth))" + "print(\"mass=\", solar_system.mass.in_(units.MEarth))\n" ] }, { @@ -264,11 +381,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 504, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mass=[ 3.33029704e+05 1.00000000e+00 1.23031263e-02]\n" + ] + } + ], "source": [ - "print(f\"mass={solar_system.mass/solar_system[1].mass}\")" + "print(f\"mass={solar_system.mass/solar_system[1].mass}\")\n" ] }, { @@ -280,16 +405,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 505, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n", + "[-5.95568230702e-23, 0.0, 0.0] 149597870691.0 * m\n", + "[0.0999996960331, 0.0, 0.0] 149597870691.0 * m\n" + ] + } + ], "source": [ "solar_system2=solar_system.copy()\n", "x=solar_system2.x\n", "print(x is solar_system2.x)\n", "print(solar_system2.center_of_mass())\n", "x[0]+=0.1| units.AU\n", - "print(solar_system2.center_of_mass())" + "print(solar_system2.center_of_mass())\n" ] }, { @@ -309,11 +444,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 506, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ -1.47371911e-11, 0.00000000e+00, 0.00000000e+00],\n", + " [ 4.84812207e-06, 0.00000000e+00, 0.00000000e+00],\n", + " [ 4.86057963e-06, 0.00000000e+00, 0.00000000e+00]])" + ] + }, + "execution_count": 506, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "solar_system.position.value_in(units.parsec)" + "solar_system.position.value_in(units.parsec)\n" ] }, { @@ -334,11 +482,221 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 507, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['GLOBAL_DERIVED_ATTRIBUTES',\n", + " 'LagrangianRadii',\n", + " 'Qparameter',\n", + " '__add__',\n", + " '__annotate_func__',\n", + " '__annotations_cache__',\n", + " '__array__',\n", + " '__array_interface__',\n", + " '__array_struct__',\n", + " '__class__',\n", + " '__contains__',\n", + " '__delattr__',\n", + " '__dict__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__firstlineno__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattr__',\n", + " '__getattribute__',\n", + " '__getitem__',\n", + " '__getstate__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__iter__',\n", + " '__le__',\n", + " '__len__',\n", + " '__lt__',\n", + " '__module__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__or__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__sizeof__',\n", + " '__static_attributes__',\n", + " '__str__',\n", + " '__sub__',\n", + " '__subclasshook__',\n", + " '__weakref__',\n", + " '_add_indices_in_attribute_storage',\n", + " '_as_masked_subset_in',\n", + " '_attributes_for_dir',\n", + " '_convert_from_entities_or_quantities',\n", + " '_convert_to_entities_or_quantities',\n", + " '_convert_to_entities_or_quantities_async',\n", + " '_convert_to_entity_or_quantity',\n", + " '_factory_for_new_collection',\n", + " '_get_derived_attribute_value',\n", + " '_get_particle',\n", + " '_get_particle_unsave',\n", + " '_get_value_of_attribute',\n", + " '_get_values_for_entity',\n", + " '_get_version',\n", + " '_is_superset',\n", + " '_masked_subset',\n", + " '_original_set',\n", + " '_remove_indices_in_attribute_storage',\n", + " '_set_value_of_attribute',\n", + " '_set_values_for_entity',\n", + " '_subset',\n", + " '_values_of_particle',\n", + " 'acceleration',\n", + " 'add_attribute_domain',\n", + " 'add_caching_function_attribute',\n", + " 'add_calculated_attribute',\n", + " 'add_function_attribute',\n", + " 'add_global_caching_function_attribute',\n", + " 'add_global_calculated_attribute',\n", + " 'add_global_function_attribute',\n", + " 'add_global_vector_attribute',\n", + " 'add_particle',\n", + " 'add_particle_function_attribute',\n", + " 'add_particles',\n", + " 'add_particles_to_store',\n", + " 'add_spin',\n", + " 'add_vector_attribute',\n", + " 'all_attributes',\n", + " 'angular_momentum',\n", + " 'are_all_keys_in_set',\n", + " 'as_binary_tree',\n", + " 'as_set',\n", + " 'attribute_for_set',\n", + " 'binaries',\n", + " 'bound_subset',\n", + " 'box_counting_dimension',\n", + " 'caching_function_for_set',\n", + " 'can_extend_attributes',\n", + " 'center_of_mass',\n", + " 'center_of_mass_velocity',\n", + " 'check_attribute',\n", + " 'cluster_core',\n", + " 'collection_attributes',\n", + " 'compressed',\n", + " 'connected_components',\n", + " 'copy',\n", + " 'copy_to_memory',\n", + " 'copy_to_new_particles',\n", + " 'copy_values_of_all_attributes_to',\n", + " 'copy_values_of_attribute_to',\n", + " 'copy_values_of_attributes_to',\n", + " 'correlation_dimension',\n", + " 'densitycentre_coreradius_coredens',\n", + " 'difference',\n", + " 'distances_squared',\n", + " 'divide_attributes',\n", + " 'dynamical_timescale',\n", + " 'empty_copy',\n", + " 'empty_particles_set_string',\n", + " 'ensure_presence_of',\n", + " 'find_closest_particle_to',\n", + " 'function_for_set',\n", + " 'get_all_indices_in_store',\n", + " 'get_all_keys_in_store',\n", + " 'get_all_particles_at',\n", + " 'get_all_values_of_attribute_in_store',\n", + " 'get_all_values_of_attribute_in_store_async',\n", + " 'get_attribute_names_defined_in_store',\n", + " 'get_binaries',\n", + " 'get_containing_set',\n", + " 'get_indices_of_keys',\n", + " 'get_intersecting_subset_in',\n", + " 'get_settable_attribute_names_defined_in_store',\n", + " 'get_state_at_timestamp',\n", + " 'get_subset',\n", + " 'get_subsets',\n", + " 'get_timeline_of_attribute',\n", + " 'get_timeline_of_attribute_as_vector',\n", + " 'get_timeline_of_attributes',\n", + " 'get_timestamp',\n", + " 'get_valid_particles_mask',\n", + " 'get_value_in_store',\n", + " 'get_values_in_store',\n", + " 'get_values_in_store_async',\n", + " 'has_duplicates',\n", + " 'has_key_in_store',\n", + " 'history',\n", + " 'is_empty',\n", + " 'is_quantity',\n", + " 'iter_history',\n", + " 'key',\n", + " 'kinetic_energy',\n", + " 'mass',\n", + " 'mass_segregation_Gini_coefficient',\n", + " 'mass_segregation_from_nearest_neighbour',\n", + " 'mass_segregation_ratio',\n", + " 'minimum_spanning_tree_length',\n", + " 'moment_of_inertia',\n", + " 'move_to_center',\n", + " 'name',\n", + " 'natal_kick_velocity',\n", + " 'nearest_neighbour',\n", + " 'new_binary_tree_wrapper',\n", + " 'new_channel_to',\n", + " 'new_particle',\n", + " 'new_particle_from_cluster_core',\n", + " 'new_working_copy',\n", + " 'oblateness',\n", + " 'position',\n", + " 'potential',\n", + " 'potential_energy',\n", + " 'potential_energy_in_field',\n", + " 'previous_state',\n", + " 'random_sample',\n", + " 'remove_attribute_from_store',\n", + " 'remove_particle',\n", + " 'remove_particles',\n", + " 'remove_particles_from_store',\n", + " 'reversed',\n", + " 'rotate',\n", + " 'savepoint',\n", + " 'scale_to_standard',\n", + " 'select',\n", + " 'select_array',\n", + " 'set_values_in_store',\n", + " 'set_values_in_store_async',\n", + " 'sorted_by_attribute',\n", + " 'sorted_by_attributes',\n", + " 'specific_kinetic_energy',\n", + " 'stored_attributes',\n", + " 'synchronize_to',\n", + " 'thermal_energy',\n", + " 'to_string',\n", + " 'total_angular_momentum',\n", + " 'total_mass',\n", + " 'total_momentum',\n", + " 'total_radius',\n", + " 'velocity',\n", + " 'virial_radius',\n", + " 'vx',\n", + " 'vy',\n", + " 'vz',\n", + " 'x',\n", + " 'y',\n", + " 'z']" + ] + }, + "execution_count": 507, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "dir(solar_system)" + "dir(solar_system)\n" ] }, { @@ -350,11 +708,870 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 508, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Help on Particles in module amuse.datamodel.particles object:\n", + "\n", + "class Particles(AbstractParticleSet)\n", + " | Particles(\n", + " | size=0,\n", + " | storage=None,\n", + " | keys=None,\n", + " | keys_generator=None,\n", + " | particles=None,\n", + " | is_working_copy=True,\n", + " | **attributes\n", + " | )\n", + " |\n", + " | A set of particles. Attributes and values are stored in\n", + " | a private storage model. This storage model can store\n", + " | the values in the python memory space, in the memory space\n", + " | of the code or in a HDF5 file. By default the storage\n", + " | model is in memory.\n", + " |\n", + " | Method resolution order:\n", + " | Particles\n", + " | AbstractParticleSet\n", + " | amuse.datamodel.base.AbstractSet\n", + " | builtins.object\n", + " |\n", + " | Methods defined here:\n", + " |\n", + " | __getitem__(self, index)\n", + " |\n", + " | __init__(\n", + " | self,\n", + " | size=0,\n", + " | storage=None,\n", + " | keys=None,\n", + " | keys_generator=None,\n", + " | particles=None,\n", + " | is_working_copy=True,\n", + " | **attributes\n", + " | )\n", + " | Initialize self. See help(type(self)) for accurate signature.\n", + " |\n", + " | __iter__(self)\n", + " |\n", + " | add_particles_to_store(self, keys, attributes=[], values=[])\n", + " |\n", + " | can_extend_attributes(self)\n", + " |\n", + " | get_all_indices_in_store(self)\n", + " |\n", + " | get_all_keys_in_store(self)\n", + " |\n", + " | get_attribute_names_defined_in_store(self)\n", + " |\n", + " | get_indices_of_keys(self, keys)\n", + " |\n", + " | get_settable_attribute_names_defined_in_store(self)\n", + " |\n", + " | get_state_at_timestamp(self, timestamp)\n", + " |\n", + " | get_timeline_of_attribute(self, particle_key, attribute)\n", + " |\n", + " | get_timeline_of_attribute_as_vector(self, particle_key, attribute)\n", + " |\n", + " | get_timeline_of_attributes(self, particle_key, attributes)\n", + " |\n", + " | get_timestamp(self)\n", + " |\n", + " | get_value_in_store(self, index, attribute)\n", + " |\n", + " | get_values_in_store(self, indices, attributes)\n", + " |\n", + " | get_values_in_store_async(self, indices, attributes)\n", + " |\n", + " | has_key_in_store(self, key)\n", + " |\n", + " | iter_history(self)\n", + " |\n", + " | new_particle(self, key=None, **keyword_arguments)\n", + " |\n", + " | new_working_copy(self)\n", + " |\n", + " | previous_state(self)\n", + " |\n", + " | remove_attribute_from_store(self, name)\n", + " |\n", + " | remove_particles_from_store(self, indices)\n", + " |\n", + " | savepoint(self, timestamp=None, format='memory', **attributes)\n", + " |\n", + " | set_values_in_store(self, indices, attributes, values)\n", + " |\n", + " | set_values_in_store_async(self, indices, attributes, values)\n", + " |\n", + " | ----------------------------------------------------------------------\n", + " | Static methods defined here:\n", + " |\n", + " | is_quantity()\n", + " |\n", + " | ----------------------------------------------------------------------\n", + " | Readonly properties defined here:\n", + " |\n", + " | history\n", + " |\n", + " | ----------------------------------------------------------------------\n", + " | Methods inherited from AbstractParticleSet:\n", + " |\n", + " | __add__(self, particles)\n", + " | Returns a particle subset, composed of the given\n", + " | particle(s) and this particle set. Attribute values are\n", + " | not stored by the subset. The subset provides a view\n", + " | on two or more sets of particles.\n", + " |\n", + " | :parameter particles: (set of) particle(s) to be added to self.\n", + " |\n", + " | >>> particles = Particles(4)\n", + " | >>> particles1 = particles[:2]\n", + " | >>> particles1.x = [1.0, 2.0] | units.m\n", + " | >>> particles2 = particles[2:]\n", + " | >>> particles2.x = [3.0, 4.0] | units.m\n", + " | >>> new_set = particles1 + particles2\n", + " | >>> new_set # doctest:+ELLIPSIS\n", + " | \n", + " | >>> print len(new_set)\n", + " | 4\n", + " | >>> print new_set.x\n", + " | [1.0, 2.0, 3.0, 4.0] m\n", + " |\n", + " | __contains__(self, particle)\n", + " | Check if a particle is part of a set\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.mass = [10.0, 20.0, 30.0] | units.kg\n", + " | >>> p1 = particles[1]\n", + " | >>> print p1 in particles\n", + " | True\n", + " | >>> p4 = Particle()\n", + " | >>> print p4 in particles\n", + " | False\n", + " |\n", + " | __delattr__(self, name)\n", + " | Implement delattr(self, name).\n", + " |\n", + " | __dir__(self)\n", + " | Utility function for introspection of paricle objects\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.mass = [10.0, 20.0, 30.0] | units.kg\n", + " | >>> particles.x = [1.0, 2.0, 3.0] | units.m\n", + " | >>> print 'mass' in dir(particles)\n", + " | True\n", + " | >>> print 'x' in dir(particles)\n", + " | True\n", + " |\n", + " | __or__(self, particles)\n", + " | Returns a particle superset, composed of the given\n", + " | particle(s) and this particle set.\n", + " |\n", + " | :parameter particles: (set of) particle(s) to be added to self.\n", + " |\n", + " | >>> particles1 = Particles(2)\n", + " | >>> particles1.x = [1.0, 2.0] | units.m\n", + " | >>> particles2 = Particles(2)\n", + " | >>> particles2.x = [3.0, 4.0] | units.m\n", + " | >>> new_set = particles1 | particles2\n", + " | >>> new_set # doctest:+ELLIPSIS\n", + " | \n", + " | >>> print len(new_set)\n", + " | 4\n", + " | >>> print new_set.x\n", + " | [1.0, 2.0, 3.0, 4.0] m\n", + " |\n", + " | __setattr__(self, name_of_the_attribute, value)\n", + " | Implement setattr(self, name, value).\n", + " |\n", + " | __str__(self)\n", + " | Display string of a particle set.\n", + " |\n", + " | >>> p0 = Particle(10)\n", + " | >>> p1 = Particle(11)\n", + " | >>> particles = Particles()\n", + " | >>> particles.add_particle(p0) # doctest:+ELLIPSIS\n", + " | \n", + " | >>> particles.add_particle(p1) # doctest:+ELLIPSIS\n", + " | \n", + " | >>> particles.x = [4.0 , 3.0] | units.m\n", + " | >>> particles.y = [5.0 , 2.0] | units.km\n", + " | >>> print particles\n", + " | key x y\n", + " | - m km\n", + " | ==================== =========== ===========\n", + " | 10 4.000e+00 5.000e+00\n", + " | 11 3.000e+00 2.000e+00\n", + " | ==================== =========== ===========\n", + " |\n", + " | __sub__(self, particles)\n", + " | Returns a subset of the set without the given particle(s)\n", + " | Attribute values are not stored by the subset. The subset\n", + " | provides a view on two or more sets of particles.\n", + " |\n", + " | :parameter particles: (set of) particle(s) to be subtracted from self.\n", + " |\n", + " | >>> particles = Particles(4)\n", + " | >>> particles.x = [1.0, 2.0, 3.0, 4.0] | units.m\n", + " | >>> junk = particles[2:]\n", + " | >>> new_set = particles - junk\n", + " | >>> new_set # doctest:+ELLIPSIS\n", + " | \n", + " | >>> print len(new_set)\n", + " | 2\n", + " | >>> print new_set.x\n", + " | [1.0, 2.0] m\n", + " | >>> print particles.x\n", + " | [1.0, 2.0, 3.0, 4.0] m\n", + " |\n", + " | add_attribute_domain(self, namespace)\n", + " |\n", + " | add_particle(self, particle)\n", + " | Add one particle to the set.\n", + " |\n", + " | :parameter particle: particle to add\n", + " |\n", + " | >>> particles = Particles()\n", + " | >>> print len(particles)\n", + " | 0\n", + " | >>> particle = Particle()\n", + " | >>> particle.x = 1.0 | units.m\n", + " | >>> particles.add_particle(particle) # doctest:+ELLIPSIS\n", + " | \n", + " | >>> print len(particles)\n", + " | 1\n", + " | >>> print particles.x\n", + " | [1.0] m\n", + " |\n", + " | add_particles(self, particles)\n", + " | Adds particles from the supplied set to this set. Attributes\n", + " | and values are copied over.\n", + " |\n", + " | .. note::\n", + " | For performance reasons the particles\n", + " | are not checked for duplicates. When the same particle\n", + " | is part of both sets errors may occur.\n", + " |\n", + " | :parameter particles: set of particles to copy values from\n", + " |\n", + " | >>> particles1 = Particles(2)\n", + " | >>> particles1.x = [1.0, 2.0] | units.m\n", + " | >>> particles2 = Particles(2)\n", + " | >>> particles2.x = [3.0, 4.0] | units.m\n", + " | >>> particles1.add_particles(particles2) # doctest:+ELLIPSIS\n", + " | \n", + " | >>> print len(particles1)\n", + " | 4\n", + " | >>> print particles1.x\n", + " | [1.0, 2.0, 3.0, 4.0] m\n", + " |\n", + " | all_attributes(self)\n", + " |\n", + " | as_binary_tree(\n", + " | self,\n", + " | name_of_first_child='child1',\n", + " | name_of_second_child='child2'\n", + " | )\n", + " |\n", + " | as_set(self)\n", + " | Returns a subset view on this set. The subset\n", + " | will contain all particles of this set.\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.x = [1.0, 2.0, 3.0] | units.m\n", + " | >>> subset = particles.as_set()\n", + " | >>> print subset.x\n", + " | [1.0, 2.0, 3.0] m\n", + " | >>> print particles.x\n", + " | [1.0, 2.0, 3.0] m\n", + " |\n", + " | compressed(self)\n", + " |\n", + " | copy(\n", + " | self,\n", + " | memento=None,\n", + " | keep_structure=False,\n", + " | filter_attributes= at 0x7009b94d4ca0>\n", + " | )\n", + " | Creates a new in particle set and copies all attributes and\n", + " | values into this set.\n", + " |\n", + " | The history of the set is not copied over.\n", + " |\n", + " |\n", + " | Keyword arguments:\n", + " | memento -- internal, a dictionary to keep track of already copied sets in\n", + " | case of links between particles (default: None, will be created)\n", + " | keep_structure -- internal, if True, in case of a sub or super set make a copy of\n", + " | the original set and return a new subset (default: False)\n", + " |\n", + " | copy_to_new_particles(\n", + " | self,\n", + " | keys=None,\n", + " | keys_generator=None,\n", + " | memento=None,\n", + " | keep_structure=False,\n", + " | filter_attributes= at 0x7009b94d4e00>\n", + " | )\n", + " |\n", + " | copy_values_of_attribute_to(self, attribute_name, particles)\n", + " | Copy values of one attribute from this set to the\n", + " | other set. Will only copy values for the particles\n", + " | in both sets. See also :meth:`synchronize_to`.\n", + " |\n", + " | If you need to do this a lot, setup a dedicated\n", + " | channel.\n", + " |\n", + " | >>> particles1 = Particles(2)\n", + " | >>> particles1.x = [1.0, 2.0] | units.m\n", + " | >>> particles2 = particles1.copy()\n", + " | >>> print particles2.x\n", + " | [1.0, 2.0] m\n", + " | >>> p3 = particles1.add_particle(Particle())\n", + " | >>> particles1.x = [3.0, 4.0, 5.0] | units.m\n", + " | >>> particles1.copy_values_of_attribute_to(\"x\", particles2)\n", + " | >>> print particles2.x\n", + " | [3.0, 4.0] m\n", + " |\n", + " | copy_values_of_attributes_to(self, attribute_names, particles)\n", + " |\n", + " | difference(self, other)\n", + " | Returns a new subset containing the difference between\n", + " | this set and the provided set.\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.mass = [10.0, 20.0, 30.0] | units.kg\n", + " | >>> particles.x = [1.0, 2.0, 3.0] | units.m\n", + " | >>> subset = particles.select(lambda x : x > 15.0 | units.kg, [\"mass\"])\n", + " | >>> less_than_15kg = particles.difference(subset)\n", + " | >>> len(subset)\n", + " | 2\n", + " | >>> len(less_than_15kg)\n", + " | 1\n", + " |\n", + " | divide_attributes(self, attributes=(), n=3)\n", + " |\n", + " | empty_copy(self)\n", + " | Creates a new in memory set and copies the particles to it.\n", + " | The attributes and values are not copied.The history\n", + " | of the set is not copied over.\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> from amuse.units import units\n", + " | >>> original = Particles(2)\n", + " | >>> original.mass = 0 | units.m\n", + " | >>> print hasattr(original, \"mass\")\n", + " | True\n", + " | >>> print len(original)\n", + " | 2\n", + " | >>> copy = original.empty_copy()\n", + " | >>> print hasattr(copy, \"mass\")\n", + " | False\n", + " | >>> print len(copy)\n", + " | 2\n", + " |\n", + " | empty_particles_set_string(self, attributes=())\n", + " |\n", + " | ensure_presence_of(self, x)\n", + " | Add one particle to the set, but only if not already in set.\n", + " |\n", + " | :parameter particle: particle to add\n", + " |\n", + " | >>> particles = Particles()\n", + " | >>> print len(particles)\n", + " | 0\n", + " | >>> particle = Particle()\n", + " | >>> p1=particles.ensure_presence_of(particle) # doctest:+ELLIPSIS\n", + " | >>> print len(particles)\n", + " | 1\n", + " | >>> p2=particles.ensure_presence_of(particle) # doctest:+ELLIPSIS\n", + " | >>> print len(particles)\n", + " | 1\n", + " | >>> p1==p2\n", + " | True\n", + " | >>> particle2 = Particle()\n", + " | >>> set=particle.as_set()\n", + " | >>> p3=set.add_particle(particle2)\n", + " | >>> set2=particles.ensure_presence_of(set)\n", + " | >>> len(particles)\n", + " | 2\n", + " | >>> len(set2)\n", + " | 2\n", + " |\n", + " | get_all_particles_at(self, *indices)\n", + " |\n", + " | get_all_values_of_attribute_in_store(self, attribute)\n", + " |\n", + " | get_containing_set(self)\n", + " |\n", + " | get_intersecting_subset_in(self, other)\n", + " |\n", + " | get_subset(self, name)\n", + " |\n", + " | get_subsets(self)\n", + " |\n", + " | get_valid_particles_mask(self)\n", + " |\n", + " | has_duplicates(self)\n", + " | Returns True when a set contains a particle with the\n", + " | same key more than once. Particles with the same\n", + " | key are interpreted as the same particles.\n", + " |\n", + " | >>> particles = Particles()\n", + " | >>> p1 = particles.add_particle(Particle(1))\n", + " | >>> p2 = particles.add_particle(Particle(2))\n", + " | >>> particles.has_duplicates()\n", + " | False\n", + " | >>> p3 = particles.add_particle(Particle(1))\n", + " | >>> particles.has_duplicates()\n", + " | True\n", + " | >>> p3 == p1\n", + " | True\n", + " |\n", + " | is_empty(self)\n", + " |\n", + " | new_binary_tree_wrapper(\n", + " | self,\n", + " | name_of_first_child='child1',\n", + " | name_of_second_child='child2'\n", + " | )\n", + " |\n", + " | new_channel_to(self, other, attributes=None, target_names=None)\n", + " |\n", + " | random_sample(self, number_of_particles)\n", + " |\n", + " | remove_particle(self, particle)\n", + " | Removes a particle from this set.\n", + " |\n", + " | Result is undefined if particle is not part of the set\n", + " |\n", + " | :parameter particle: particle to remove from this set\n", + " |\n", + " | >>> particles1 = Particles(2)\n", + " | >>> particles1.x = [1.0, 2.0] | units.m\n", + " | >>> particles1.remove_particle(particles1[0])\n", + " | >>> print len(particles1)\n", + " | 1\n", + " | >>> print particles1.x\n", + " | [2.0] m\n", + " |\n", + " | remove_particles(self, particles)\n", + " | Removes particles from the supplied set from this set.\n", + " |\n", + " | :parameter particles: set of particles to remove from this set\n", + " |\n", + " | >>> particles1 = Particles(2)\n", + " | >>> particles1.x = [1.0, 2.0] | units.m\n", + " | >>> particles2 = Particles()\n", + " | >>> particles2.add_particle(particles1[0]) # doctest:+ELLIPSIS\n", + " | \n", + " | >>> particles1.remove_particles(particles2)\n", + " | >>> print len(particles1)\n", + " | 1\n", + " | >>> print particles1.x\n", + " | [2.0] m\n", + " |\n", + " | reversed(self)\n", + " | Returns a subset with the same particles, but with reversed\n", + " | sequenctial order (the first particle will become last)\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.radius = [1.0, 2.0, 3.0] | units.m\n", + " | >>> r = particles.reversed()\n", + " | >>> print r.radius\n", + " | [3.0, 2.0, 1.0] m\n", + " |\n", + " | select(self, selection_function, attributes)\n", + " | Returns a subset view on this set. The subset\n", + " | will contain all particles for which the selection\n", + " | function returned True. The selection function\n", + " | is called with scalar quantities defined by\n", + " | the attributes parameter\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.mass = [10.0, 20.0, 30.0] | units.kg\n", + " | >>> particles.x = [1.0, 2.0, 3.0] | units.m\n", + " | >>> subset = particles.select(lambda x : x > 15.0 | units.kg, [\"mass\"])\n", + " | >>> print subset.mass\n", + " | [20.0, 30.0] kg\n", + " | >>> print subset.x\n", + " | [2.0, 3.0] m\n", + " |\n", + " | select_array(self, selection_function, attributes=())\n", + " | Returns a subset view on this set. The subset\n", + " | will contain all particles for which the selection\n", + " | function returned True. The selection function\n", + " | is called with a vector quantities containing all\n", + " | the values for the attributes parameter.\n", + " |\n", + " | This function can be faster than the select function\n", + " | as it works on entire arrays. The selection_function\n", + " | is called once.\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.mass = [10.0, 20.0, 30.0] | units.kg\n", + " | >>> particles.x = [1.0, 2.0, 3.0] | units.m\n", + " | >>> subset = particles.select_array(lambda x : x > 15.0 | units.kg, [\"mass\"])\n", + " | >>> print subset.mass\n", + " | [20.0, 30.0] kg\n", + " | >>> print subset.x\n", + " | [2.0, 3.0] m\n", + " |\n", + " |\n", + " | >>> particles = Particles(1000)\n", + " | >>> particles.x = units.m.new_quantity(numpy.arange(1,1001))\n", + " | >>> subset = particles.select_array(lambda x : x > (500 | units.m), (\"x\",) )\n", + " | >>> print len(subset)\n", + " | 500\n", + " |\n", + " | sorted_by_attribute(self, attribute, kind='mergesort')\n", + " | Returns a subset with the same particles, but sorted\n", + " | using the given attribute name\n", + " |\n", + " | :argument: kind, the sort method for supported kinds see\n", + " | the numpy.sort documentation\n", + " |\n", + " |\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.mass = [2.0, 3.0, 1.0] | units.kg\n", + " | >>> particles.radius = [1.0, 2.0, 3.0] | units.m\n", + " | >>> sorted = particles.sorted_by_attribute('mass')\n", + " | >>> print sorted.mass\n", + " | [1.0, 2.0, 3.0] kg\n", + " | >>> print sorted.radius\n", + " | [3.0, 1.0, 2.0] m\n", + " |\n", + " | sorted_by_attributes(self, *attributes)\n", + " | Returns a subset with the same particles, but sorted\n", + " | using the given attribute names. The last attribute name\n", + " | in the call is used for the primary sort order, the\n", + " | second-to-last attribute name for the secondary sort order,\n", + " | and so on. See also numpy.lexsort\n", + " |\n", + " |\n", + " | >>> particles = Particles(4)\n", + " | >>> particles.mass = [2.0, 3.0, 1.0, 4.0] | units.kg\n", + " | >>> particles.radius = [3.0, 2.0, 1.0, 2.0] | units.m\n", + " | >>> sorted = particles.sorted_by_attributes('mass', 'radius')\n", + " | >>> print sorted.radius\n", + " | [1.0, 2.0, 2.0, 3.0] m\n", + " | >>> print sorted.mass\n", + " | [1.0, 3.0, 4.0, 2.0] kg\n", + " |\n", + " | synchronize_to(self, other_particles)\n", + " | Synchronize the particles of this set\n", + " | with the contents of the provided set.\n", + " |\n", + " | After this call the `other_particles` set will have\n", + " | the same particles as this set.\n", + " |\n", + " | This call will check if particles have been removed or\n", + " | added it will not copy values of existing particles\n", + " | over.\n", + " |\n", + " | :parameter other_particles: particle set wich has to be updated\n", + " |\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.x = [1.0, 2.0] | units.m\n", + " | >>> copy = particles.copy()\n", + " | >>> new_particle = Particle()\n", + " | >>> new_particle.x = 3.0 | units.m\n", + " | >>> particles.add_particle(new_particle)# doctest:+ELLIPSIS\n", + " | \n", + " | >>> print particles.x\n", + " | [1.0, 2.0, 3.0] m\n", + " | >>> print copy.x\n", + " | [1.0, 2.0] m\n", + " | >>> particles.synchronize_to(copy)\n", + " | >>> print copy.x\n", + " | [1.0, 2.0, 3.0] m\n", + " |\n", + " | to_string(self, attributes_to_show=None, split_at=20)\n", + " | Display string of a particle set.\n", + " |\n", + " | >>> p0 = Particle(10)\n", + " | >>> p1 = Particle(11)\n", + " | >>> particles = Particles()\n", + " | >>> particles.add_particle(p0) # doctest:+ELLIPSIS\n", + " | \n", + " | >>> particles.add_particle(p1) # doctest:+ELLIPSIS\n", + " | \n", + " | >>> particles.x = [4.0 , 3.0] | units.m\n", + " | >>> particles.y = [5.0 , 2.0] | units.km\n", + " | >>> print particles.to_string()\n", + " | key x y\n", + " | - m km\n", + " | ==================== =========== ===========\n", + " | 10 4.000e+00 5.000e+00\n", + " | 11 3.000e+00 2.000e+00\n", + " | ==================== =========== ===========\n", + " |\n", + " | ----------------------------------------------------------------------\n", + " | Data and other attributes inherited from AbstractParticleSet:\n", + " |\n", + " | GLOBAL_DERIVED_ATTRIBUTES = {'LagrangianRadii': >> from amuse.datamodel import Particles\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.x = [1.0, 2.0] | units.m\n", + " | >>> def sumx(p):\n", + " | ... return p.x.sum()\n", + " | ...\n", + " | >>> particles.add_caching_function_attribute(\"sum_of_x\", sumx)\n", + " | >>> particles.sum_of_x()\n", + " | quantity<3.0 m>\n", + " |\n", + " | >>> particles.x = [3.0, 4.0] | units.m\n", + " | >>> particles.sum_of_x()\n", + " | quantity<3.0 m>\n", + " |\n", + " | add_calculated_attribute(\n", + " | self,\n", + " | name_of_the_attribute,\n", + " | function,\n", + " | attributes_names=None\n", + " | )\n", + " | Define a read-only calculated attribute, values for the attribute are\n", + " | calculated using the given function. The functions argument\n", + " | names are interperted as attribute names. For example, if\n", + " | the given function is::\n", + " |\n", + " | def norm(x, y):\n", + " | return (x*x + y*y).sqrt()\n", + " |\n", + " | The attributes \"x\" and \"y\" will be retrieved from the particles\n", + " | and send to the \"norm\" function.\n", + " |\n", + " | The calculated values are not stored on the particles. Values\n", + " | are recalculated every time this attribute is accessed.\n", + " |\n", + " | :argument name_of_the_attribute: Name to reference the attribute by.\n", + " | :argument function: Function to call, when attribute is accessed\n", + " |\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.x = [1.0 , 2.0] | units.m\n", + " | >>> particles.y = [3.0 , 4.0] | units.m\n", + " | >>> particles.add_calculated_attribute(\"xy\", lambda x, y : x * y)\n", + " | >>> print particles.xy\n", + " | [3.0, 8.0] m**2\n", + " | >>> particles[0].x = 4.0 | units.m\n", + " | >>> print particles.xy\n", + " | [12.0, 8.0] m**2\n", + " | >>> print particles[1].xy\n", + " | 8.0 m**2\n", + " |\n", + " | add_function_attribute(\n", + " | self,\n", + " | name_of_the_attribute,\n", + " | function,\n", + " | function_for_particle=None\n", + " | )\n", + " | Define a function attribute, adding a function to the particles\n", + " |\n", + " | :argument name_of_the_attribute: Name to reference the vector attribute by.\n", + " | :argument function: A function, first argument will be the particles.\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.x = [1.0 , 2.0] | units.m\n", + " | >>> def sumx(p):\n", + " | ... return p.x.sum()\n", + " | ...\n", + " | >>> particles.add_function_attribute(\"sum_of_x\", sumx)\n", + " | >>> particles.sum_of_x()\n", + " | quantity<3.0 m>\n", + " |\n", + " | add_particle_function_attribute(self, name_of_the_attribute, function)\n", + " | Define a function working on one particle\n", + " |\n", + " | :argument name_of_the_attribute: Name to reference the attribute by.\n", + " | :argument function: A function, first argument will be the particle.\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> def xsquared(set, p):\n", + " | ... return p.x * p.x\n", + " | ...\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.add_particle_function_attribute(\"xsquared\", xsquared)\n", + " | >>> particles.x = [4.0 , 2.0] | units.m\n", + " | >>> particles[0].xsquared()\n", + " | quantity<16.0 m**2>\n", + " |\n", + " | add_vector_attribute(self, name_of_the_attribute, name_of_the_components)\n", + " |\n", + " | are_all_keys_in_set(self, keys)\n", + " |\n", + " | check_attribute(self, value)\n", + " |\n", + " | copy_to_memory(self)\n", + " |\n", + " | copy_values_of_all_attributes_to(self, particles)\n", + " |\n", + " | get_all_values_of_attribute_in_store_async(self, attribute)\n", + " |\n", + " | stored_attributes(self)\n", + " | Returns a list of the names of the attributes defined on\n", + " | the objects in this set (or grid).\n", + " |\n", + " | This list will not contain the set specific methods, or derived\n", + " | attributes (such as function attributes or vector attributes)\n", + " | for a list with all these attributes please use ``dir``.\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> particles = Particles(3)\n", + " | >>> particles.mass = [10.0, 20.0, 30.0] | units.kg\n", + " | >>> particles.x = [1.0, 2.0, 3.0] | units.m\n", + " | >>> print particles.stored_attributes()\n", + " | ['key', 'mass', 'x']\n", + " |\n", + " | ----------------------------------------------------------------------\n", + " | Class methods inherited from amuse.datamodel.base.AbstractSet:\n", + " |\n", + " | add_global_caching_function_attribute(\n", + " | name_of_the_attribute,\n", + " | function,\n", + " | function_for_particle=None\n", + " | )\n", + " | Define a function attribute, adding a function to the particles\n", + " |\n", + " | :argument name_of_the_attribute: Name to reference the attribute by.\n", + " | :argument function: A function, first argument will be the particles.\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> def sumx(p):\n", + " | ... return p.x.sum()\n", + " | ...\n", + " | >>> Particles.add_global_caching_function_attribute(\"sum_of_x\", sumx)\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.x = [4.0 , 2.0] | units.m\n", + " | >>> particles.sum_of_x()\n", + " | quantity<6.0 m>\n", + " | >>> particles.x = [5.0 , 6.0] | units.m\n", + " | >>> particles.sum_of_x()\n", + " | quantity<6.0 m>\n", + " | >>> del Particles.GLOBAL_DERIVED_ATTRIBUTES['sum_of_x']\n", + " |\n", + " | add_global_calculated_attribute(\n", + " | name_of_the_attribute,\n", + " | function,\n", + " | attributes_names=None\n", + " | )\n", + " | Define a *global* vector attribute, coupling two or more scalar attributes into\n", + " | one vector attribute. The vector will be defined for all particle sets\n", + " | created after calling this function.\n", + " |\n", + " | :argument name_of_the_attribute: Name to reference the vector attribute by.\n", + " | :argument function: Name of the function to call.\n", + " | :argument attributes_names: List of strings, each string a name of a scalar attribute, if None uses argument names.\n", + " |\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> Particles.add_global_calculated_attribute(\"xy\", lambda x, y : x * y)\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.x = [1.0 , 2.0] | units.m\n", + " | >>> particles.y = [3.0 , 4.0] | units.m\n", + " | >>> print particles.xy\n", + " | [3.0, 8.0] m**2\n", + " | >>> del Particles.GLOBAL_DERIVED_ATTRIBUTES['xy']\n", + " |\n", + " | add_global_function_attribute(\n", + " | name_of_the_attribute,\n", + " | function,\n", + " | function_for_particle=None\n", + " | )\n", + " | Define a function attribute, adding a function to the particles\n", + " |\n", + " | :argument name_of_the_attribute: Name to reference the attribute by.\n", + " | :argument function: A function, first argument will be the particles.\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> def sumx(p):\n", + " | ... return p.x.sum()\n", + " | ...\n", + " | >>> Particles.add_global_function_attribute(\"sum_of_x\", sumx)\n", + " | >>> particles = Particles(2)\n", + " | >>> particles.x = [4.0 , 2.0] | units.m\n", + " | >>> particles.sum_of_x()\n", + " | quantity<6.0 m>\n", + " | >>> del Particles.GLOBAL_DERIVED_ATTRIBUTES['sum_of_x']\n", + " |\n", + " | add_global_vector_attribute(name_of_the_attribute, name_of_the_components)\n", + " | Define a *global* vector attribute, coupling two or more scalar attributes into\n", + " | one vector attribute. The vector will be defined for all particle sets\n", + " | created after calling this function.\n", + " |\n", + " | :argument name_of_the_attribute: Name to reference the vector attribute by.\n", + " | :argument name_of_the_components: List of strings, each string a name of a scalar attribute.\n", + " |\n", + " | >>> from amuse.datamodel import Particles\n", + " | >>> particles = Particles(2)\n", + " | >>> Particles.add_global_vector_attribute('vel', ['vx','vy'])\n", + " | >>> particles.vx = [1.0 , 2.0] | units.m / units.s\n", + " | >>> particles.vy = [3.0 , 4.0] | units.m / units.s\n", + " | >>> particles.vel\n", + " | quantity<[[1.0, 3.0], [2.0, 4.0]] m / s>\n", + " |\n", + " | attribute_for_set(function)\n", + " |\n", + " | caching_function_for_set(function)\n", + " |\n", + " | function_for_set(function)\n", + " |\n", + " | ----------------------------------------------------------------------\n", + " | Readonly properties inherited from amuse.datamodel.base.AbstractSet:\n", + " |\n", + " | collection_attributes\n", + " |\n", + " | key\n", + " |\n", + " | ----------------------------------------------------------------------\n", + " | Data descriptors inherited from amuse.datamodel.base.AbstractSet:\n", + " |\n", + " | __dict__\n", + " | dictionary for instance variables\n", + " |\n", + " | __weakref__\n", + " | list of weak references to the object\n", + "\n" + ] + } + ], "source": [ - "help(solar_system)" + "help(solar_system)\n" ] }, { @@ -372,6 +1589,41 @@ "Add the planet Jupiter (see [Wikipedia](https://en.wikipedia.org/wiki/Jupiter)) to your small planetary system." ] }, + { + "cell_type": "code", + "execution_count": 509, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solar system:\n", + " key mass name vx vy vz x y z\n", + " - MSun none kms kms kms au au au\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n", + "10812175574878836636 1.000e+00 sun 0.000e+00 -9.059e-05 0.000e+00 -3.040e-06 0.000e+00 0.000e+00\n", + " 295656550295629073 3.003e-06 earth 0.000e+00 2.979e+01 0.000e+00 1.000e+00 0.000e+00 0.000e+00\n", + " 3835875604347703949 3.694e-08 moon 0.000e+00 3.081e+01 0.000e+00 1.003e+00 0.000e+00 0.000e+00\n", + " 6136697243382038455 9.543e-04 jupiter 0.000e+00 1.306e+01 0.000e+00 5.204e+00 0.000e+00 0.000e+00\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n" + ] + } + ], + "source": [ + "jupiter = Particle()\n", + "jupiter.name = \"jupiter\"\n", + "jupiter.mass = 1.898e27 | units.kg\n", + "jupiter.position = (778.5e6, 0, 0) | units.km\n", + "vorb = relative_orbital_velocity(\n", + " sun.mass + jupiter.mass, \n", + " jupiter.position.length()\n", + ")\n", + "jupiter.velocity = (0, 1, 0) * vorb\n", + "solar_system.add_particle(jupiter)\n", + "print(f\"Solar system:\\n{solar_system}\")\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -386,12 +1638,41 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 510, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sun: key mass name vx vy vz x y z\n", + " - 1.98892e+30 * kg none 3646245880.3572216 * m * s**-1 3646245880.3572216 * m * s**-1 3646245880.3572216 * m * s**-1 149597870691.0 * m 149597870691.0 * m 149597870691.0 * m\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n", + "13829696263793681610 1.000e+00 sun 2.507e-12 1.386e-11 2.009e-11 2.987e-06 -1.743e-07 -2.526e-07\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n", + "Earth: key mass name vx vy vz x y z\n", + " - MSun none 3646245880.357221 * m * s**-1 3646245880.357221 * m * s**-1 3646245880.357221 * m * s**-1 149597870691.0 * m 149597870691.0 * m 149597870691.0 * m\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n", + " 6699030694405959489 3.003e-06 earth -8.350e-07 -4.615e-06 -6.689e-06 -9.948e-01 5.805e-02 8.413e-02\n", + "==================== =========== =========== =========== =========== =========== =========== =========== ===========\n", + "Number of Earths in the binary system: 1\n" + ] + } + ], "source": [ - "from amuse.ext.orbital_elements import new_binary_from_orbital_elements\n", - "binary=new_binary_from_orbital_elements(1| units.MSun, 1| units.MEarth, 1| units.AU, eccentricity=0.)" + "from amuse.ext.orbital_elements import generate_binaries\n", + "import numpy as np\n", + "\n", + "binary=generate_binaries(1| units.MSun, 1| units.MEarth, 1| units.AU, eccentricity=0., true_anomaly=np.random.uniform(-np.pi, np.pi), inclination = 7.25)\n", + "sun = binary[0]\n", + "earth = binary[1]\n", + "\n", + "binary[0].name =\"sun\"\n", + "binary[1].name =\"earth\"\n", + "print(f\"Sun: {sun}\")\n", + "print(f\"Earth: {earth}\")\n", + "\n", + "print(f\"Number of Earths in the binary system: {binary.count(earth)}\")\n" ] }, { @@ -407,6 +1688,44 @@ "Did the binding energy of the Solar system change by this translation?" ] }, + { + "cell_type": "code", + "execution_count": 511, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Binding energy of the system: 1.64345492105e+35 J\n", + "Binding energy of the system: -9.95395588289e+39 J\n" + ] + } + ], + "source": [ + "def get_binding_energy(system):\n", + " E_kin = system.kinetic_energy()\n", + " E_pot = system.potential_energy()\n", + " Binding_energy = -E_kin - E_pot\n", + " return Binding_energy\n", + "print(f\"Binding energy of the system: {get_binding_energy(solar_system).in_(units.J)}\")\n", + "\n", + "solar_system.z += 100 | units.pc \n", + "solar_system.vz += 100 | units.kms\n", + "\n", + "print(f\"Binding energy of the system: {get_binding_energy(solar_system).in_(units.J)}\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": 512, + "metadata": {}, + "outputs": [], + "source": [ + "solar_system.z -= 100 | units.pc \n", + "solar_system.vz -= 100 | units.kms\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -416,6 +1735,40 @@ "If you use this function to check the binaries in your system you will find that (without Jupiter) you have 3 binaries. Explain why the Sun is in a binary with the Moon. You may want to take a look at the [source code](https://github.com/amusecode/amuse/blob/main/src/amuse/datamodel/particle_attributes.py)." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "
\n", + "The Code finds 3 binaries because the In the Heliocentric model, the moon orbits the sun and it's elliptical orbit is perturbed by the earth.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 516, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Binaries in the solar system: key hardness mass name vx vy vz x y z\n", + " - none MSun none kms kms kms au au au\n", + "==================== =========== =========== =========== =========== =========== =========== =========== =========== ===========\n", + "10812175574878836636 5.364e+03 1.000e+00 sun 0.000e+00 -9.059e-05 0.000e+00 -3.040e-06 0.000e+00 0.000e+00\n", + " 295656550295629073 5.364e+03 3.003e-06 earth 0.000e+00 2.979e+01 0.000e+00 1.000e+00 0.000e+00 0.000e+00\n", + "==================== =========== =========== =========== =========== =========== =========== =========== =========== ===========\n", + "Number of binaries in the solar system: 3\n" + ] + } + ], + "source": [ + "\n", + "binaries = solar_system.get_binaries()\n", + "print(f\"Binaries in the solar system: {binaries[0]}\")\n", + "print(f\"Number of binaries in the solar system: {len(binaries)}\")\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -446,12 +1799,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 514, "metadata": {}, "outputs": [], "source": [ "from amuse.ic.plummer import new_plummer_model\n", - "p=new_plummer_model(100)" + "p=new_plummer_model(100)\n" ] }, { @@ -508,13 +1861,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 515, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.01383880206 length\n", + "(quantity<[0.0546917868188, 0.155127837831, 0.240106115454, 0.340608549518, 0.458752675927, 0.750211716567, 1.37384095213, 1.69161606571, 7.94826374219] length>, [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 0.75, 0.9, 1])\n" + ] + } + ], "source": [ "print(p.virial_radius())\n", "cm=p.center_of_mass()\n", - "print(p.LagrangianRadii(cm=cm))" + "print(p.LagrangianRadii(cm=cm))\n" ] }, { @@ -527,7 +1889,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Amuse-env", "language": "python", "name": "python3" }, @@ -541,7 +1903,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.14.7" } }, "nbformat": 4,