Skip to content

Commit

Permalink
Fixed the Failing Documentation for Tracking RPacket Feature (tardi…
Browse files Browse the repository at this point in the history
…s-sn#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
  • Loading branch information
DhruvSondhi committed Dec 14, 2021
1 parent 688547c commit 0cbdf74
Showing 1 changed file with 50 additions and 16 deletions.
66 changes: 50 additions & 16 deletions docs/io/output/rpacket_tracking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand All @@ -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",
Expand All @@ -58,7 +71,7 @@
"montecarlo:\n",
"...\n",
"tracking:\n",
" r_packet_tracking: true\n",
" track_rpacket: true\n",
"```"
]
},
Expand All @@ -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)."
]
},
{
Expand Down Expand Up @@ -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,
Expand All @@ -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)"
]
},
{
Expand All @@ -163,15 +186,15 @@
"metadata": {},
"outputs": [],
"source": [
"sim.runner.tracked_rpacket"
"type(sim.runner.rpacket_tracker)"
]
},
{
"cell_type": "markdown",
"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}"
]
},
{
Expand All @@ -194,20 +217,31 @@
"```"
]
},
{
"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."
]
},
{
"cell_type": "markdown",
"id": "a4772b00",
"metadata": {},
"source": [
"- Accessing the `index` property for the packets:"
"- Accessing the `index` property for the packet {`10`}:"
]
},
{
Expand All @@ -217,15 +251,15 @@
"metadata": {},
"outputs": [],
"source": [
"sim.runner.tracked_rpacket.index"
"sim.runner.rpacket_tracker[10].index"
]
},
{
"cell_type": "markdown",
"id": "d81fbbf7",
"metadata": {},
"source": [
"- Accessing the `seed` property for the packets:"
"- Accessing the `seed` property for the packet {`10`}:"
]
},
{
Expand All @@ -235,15 +269,15 @@
"metadata": {},
"outputs": [],
"source": [
"sim.runner.tracked_rpacket.seed"
"sim.runner.rpacket_tracker[10].seed"
]
},
{
"cell_type": "markdown",
"id": "7afe2110",
"metadata": {},
"source": [
"- Accessing the `status` property for the packets:"
"- Accessing the `status` property for the packet {`10`}:"
]
},
{
Expand All @@ -253,7 +287,7 @@
"metadata": {},
"outputs": [],
"source": [
"sim.runner.tracked_rpacket.status"
"sim.runner.rpacket_tracker[10].status"
]
},
{
Expand All @@ -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:"
]
},
{
Expand All @@ -279,7 +313,7 @@
"metadata": {},
"outputs": [],
"source": [
"len(sim.runner.tracked_rpacket.index)"
"len(sim.runner.rpacket_tracker[10].shell_id)"
]
},
{
Expand Down Expand Up @@ -311,7 +345,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down

0 comments on commit 0cbdf74

Please sign in to comment.