{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How to Generate Data Exploration Widgets\n", "A demonstration of how to generate TARDIS widgets that allows you to **explore simulation data within Jupyter Notebook with ease**!\n", "\n", "This notebook is a quickstart how-to guide, but more details on each widget (and its features) is given in the [Using TARDIS Widgets](https://tardis-sn.github.io/tardis/io/visualization/using_widgets.html) section of the documentation." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First create and run a simulation that we can use to generate widgets (more details about running simulation in [Quickstart](https://tardis-sn.github.io/tardis/quickstart/quickstart.html) section):\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-02-18T16:10:42.838867Z", "start_time": "2021-02-18T16:09:22.826173Z" }, "scrolled": true }, "outputs": [], "source": [ "from tardis import run_tardis\n", "from tardis.io.atom_data import download_atom_data\n", "from tardis.io.configuration.config_reader import Configuration\n", "\n", "# We download the atomic data needed to run the simulation\n", "download_atom_data('kurucz_cd23_chianti_H_He_latest')\n", "\n", "config = Configuration.from_yaml(\"tardis_example.yml\")\n", "config.montecarlo.tracking.track_rpacket = True\n", "\n", "sim = run_tardis(config, virtual_packet_logging=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, import functions & class to create widgets from `visualization` subpackage:\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-02-18T17:29:30.986893Z", "start_time": "2021-02-18T17:29:30.978764Z" } }, "outputs": [], "source": [ "from tardis.visualization import (\n", " shell_info_from_simulation,\n", " shell_info_from_hdf,\n", " LineInfoWidget,\n", " GrotrianWidget,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Shell Info Widget\n", "\n", "This widget allows you to explore chemical abundances of each shell - all the way from elements to ions to levels - by just clicking on the rows you want to explore!\n", "\n", "There are two ways in which you can generate the widget:\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using a Simulation object\n", "\n", "We will use the simulation object we created in the beginning, `sim` to generate shell info widget. Then simply display it to start using.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "