From 0cbdf74cc442fdd2a40e2cda4fefd447d220fdbb Mon Sep 17 00:00:00 2001 From: Dhruv Sondhi <66117751+DhruvSondhi@users.noreply.github.com> Date: Mon, 13 Dec 2021 20:53:49 +0530 Subject: [PATCH] Fixed the Failing Documentation for Tracking `RPacket` Feature (#1841) * Fixed shell_id array not being re-adjusted to finalize the size for number of interactions * Changed the documentation for RPacket Tracking to accomodate the recent changes * Removed output from documentation --- docs/io/output/rpacket_tracking.ipynb | 66 ++++++++++++++++++++------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/docs/io/output/rpacket_tracking.ipynb b/docs/io/output/rpacket_tracking.ipynb index 3b2910a150e..28f6ec1c728 100644 --- a/docs/io/output/rpacket_tracking.ipynb +++ b/docs/io/output/rpacket_tracking.ipynb @@ -13,7 +13,7 @@ "id": "c103617c", "metadata": {}, "source": [ - "**TARDIS** has the functionality to track the properties of the *RPackets* that are generated when running the Simulation. The `rpacket_tracker` can track all the interactions a packet undergoes & thus keeps a track of the various properties, a packet may have.<br>Currently, the `rpacket_tracker` tracks the properties of all the packets in the *Last Iteration of the Simulation*. " + "**TARDIS** has the functionality to track the properties of the *RPackets* that are generated when running the Simulation. The `rpacket_tracker` can track all the interactions a packet undergoes & thus keeps a track of the various properties, a packet may have.<br>Currently, the `rpacket_tracker` tracks the properties of all the rpackets in the *Last Iteration of the Simulation*. It generates a `List` that contains the individual instances of `RPacketCollection`{`Numba JITClass`}, for storing all the interaction properties as listed below." ] }, { @@ -38,6 +38,19 @@ "</html>" ] }, + { + "cell_type": "markdown", + "id": "4b0de6ca", + "metadata": {}, + "source": [ + "<div class=\"alert alert-warning\">\n", + "\n", + "Warning\n", + "\n", + "Current implementation stores all the data for the interaction of the packets in a `list`, so it needs to accessed with a `list index` for each property for a particular `rpacket`. Examples for the same are shown as follows. \n", + "</div>" + ] + }, { "cell_type": "markdown", "id": "1686d9f1", @@ -58,7 +71,7 @@ "montecarlo:\n", "...\n", "tracking:\n", - " r_packet_tracking: true\n", + " track_rpacket: true\n", "```" ] }, @@ -67,7 +80,7 @@ "id": "13b6420b", "metadata": {}, "source": [ - "The `montecarlo` section of the **YAML** file now has a `tracking` sub section which holds the configuration properties for the `tracked_rpacket` & the `initial_array_length` (discussed later in the tutorial)." + "The `montecarlo` section of the **YAML** file now has a `tracking` sub section which holds the configuration properties for the `track_rpacket` & the `initial_array_length` (discussed later in the tutorial)." ] }, { @@ -124,6 +137,16 @@ "config[\"montecarlo\"][\"tracking\"][\"track_rpacket\"] = True" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ece2c10", + "metadata": {}, + "outputs": [], + "source": [ + "config[\"montecarlo\"][\"tracking\"]" + ] + }, { "cell_type": "code", "execution_count": null, @@ -145,7 +168,7 @@ "source": [ "# Running the simulation from the config\n", "\n", - "sim = run_tardis(config, show_cplots=False)" + "sim = run_tardis(config, show_convergence_plots=False, show_progress_bars=False)" ] }, { @@ -163,7 +186,7 @@ "metadata": {}, "outputs": [], "source": [ - "sim.runner.tracked_rpacket" + "type(sim.runner.rpacket_tracker)" ] }, { @@ -171,7 +194,7 @@ "id": "4771d92a", "metadata": {}, "source": [ - "It can be seen from the above code, that the `sim.runner.tracked_rpacket` is an instance of the `RPacketCollection` *Numba jitclass*. The `RPacketCollection` class has the following structure for the properties : {More information in the **TARDIS API** for `RPacketCollection` class}" + "It can be seen from the above code, that the `sim.runner.rpacket_tracker` is an instance of the `List` specifically *Numba Typed List*. The `RPacketCollection` class has the following structure for the properties : {More information in the **TARDIS API** for `RPacketCollection` class}" ] }, { @@ -194,12 +217,23 @@ "```" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "a3ea2f54", + "metadata": {}, + "outputs": [], + "source": [ + "len(sim.runner.rpacket_tracker)" + ] + }, { "cell_type": "markdown", "id": "411f2ef9", "metadata": {}, "source": [ - "To access these different properties, we may consider the following examples for the `tracked_rpacket`:" + "To access these different properties, we may consider the following examples for the `rpacket_tracker`:\n", + "<br>In this Example, we are trying to access the properties of the packet at index `10`.<br>In a similar way, we can check for any property for any packet in the range of packets for the last iteration." ] }, { @@ -207,7 +241,7 @@ "id": "a4772b00", "metadata": {}, "source": [ - "- Accessing the `index` property for the packets:" + "- Accessing the `index` property for the packet {`10`}:" ] }, { @@ -217,7 +251,7 @@ "metadata": {}, "outputs": [], "source": [ - "sim.runner.tracked_rpacket.index" + "sim.runner.rpacket_tracker[10].index" ] }, { @@ -225,7 +259,7 @@ "id": "d81fbbf7", "metadata": {}, "source": [ - "- Accessing the `seed` property for the packets:" + "- Accessing the `seed` property for the packet {`10`}:" ] }, { @@ -235,7 +269,7 @@ "metadata": {}, "outputs": [], "source": [ - "sim.runner.tracked_rpacket.seed" + "sim.runner.rpacket_tracker[10].seed" ] }, { @@ -243,7 +277,7 @@ "id": "7afe2110", "metadata": {}, "source": [ - "- Accessing the `status` property for the packets:" + "- Accessing the `status` property for the packet {`10`}:" ] }, { @@ -253,7 +287,7 @@ "metadata": {}, "outputs": [], "source": [ - "sim.runner.tracked_rpacket.status" + "sim.runner.rpacket_tracker[10].status" ] }, { @@ -269,7 +303,7 @@ "id": "c83dd906", "metadata": {}, "source": [ - "We can also see the total number of interactions all the packets had, with the following example:" + "We can also see the total number of interactions of index `10` packet under went, with the following example:" ] }, { @@ -279,7 +313,7 @@ "metadata": {}, "outputs": [], "source": [ - "len(sim.runner.tracked_rpacket.index)" + "len(sim.runner.rpacket_tracker[10].shell_id)" ] }, { @@ -311,7 +345,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" },