Skip to content

Commit

Permalink
Updated documentation and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushiDaksh committed Aug 18, 2023
1 parent f27023b commit 48a571a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 34 deletions.
Binary file added docs/io/images/energy_level_widget_demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/io/images/energy_level_widget_options.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 9 additions & 15 deletions docs/io/visualization/generating_widgets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,23 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Energy Level Widget\n",
"## Energy Level Diagram\n",
"\n",
"This widget lets you explore the visualize the various line interactions in a simulation in the form of an Energy Level Diagram.\n",
"This widget lets you explore and visualise the various level populations and line interactions in a simulation in the form of an Energy Level Diagram.\n",
"\n",
"You can select any ion, filter transitions by wavelength range and the supernova shell, to display an energy level diagram, where:\n",
"You can select any ion present in the simulation and filter the transitions by wavelength or model shell to display an energy level diagram, where:\n",
"\n",
"- The horizontal platforms represent the energy level. The width of these platforms represent the level population\n",
"- The arrows represent the line interactions, where their width represent the number of packets which underwent that transition and the color represents the wavelength of the transition.\n",
"- The horizontal platforms represent the energy level. The thickness of each platform represents its level population.\n",
"- The arrows represent the line interactions, where the thickness shows the number of packets that underwent that transition. The wavelength of the transition is given by the color.\n",
"\n",
"In addition to the above filters, you can also select the scaling of Y-axis (which represents the energy) and the max levels to display.\n"
"In addition to the above filters, you can also select the scaling of Y-axis (which represents the energy) and the maximum number of levels to display.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To generate energy level widget, we will again use the simulation object `sim` and then display the widget:\n"
"To generate the energy level diagram, we will again use the simulation object `sim` and then display the widget:"
]
},
{
Expand All @@ -228,15 +228,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"You can interact with this widget (which again won't be visible if you're viewing this notebook in our docs as an html page) like this:\n"
"You can interact with this widget (which again won't be visible if you're viewing this notebook in our docs as an html page) like this:\n",
"![Energy level Diagram Demo](../images/energy_level_widget_options.gif)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
34 changes: 18 additions & 16 deletions docs/io/visualization/using_widgets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,33 +178,35 @@ There are also several other options in the modebar which we have not explained
you remember to click back on the **Box Select** option for making selections on
spectrum.

Energy Level Widget
Energy Level Diagram
################

This widget lets you visualize the last line interactions

.. image:: ../images/energy_level_widget_demo.gif
:alt: Demo of Energy Level Widget
:alt: Demo of Energy Level Diagram

By selecting an ion on the widget, you can see its energy level diagram based
on the last line interactions in the simulation.
By selecting an ion on the widget, you can see its energy level diagram, which
also shows information about the last line interactions experienced by packets
in the simulation.

The y-axis of the plot represent energies and the horizontal levels represent the
different energy levels. The width of these platform represent the level populations
in those levels.
The y-axis of the plot represents energy while the horizontal lines show
discrete energy levels. The thickness of each line represents the level
population.

The arrows represent the line interaction, with the upward arrows
represent excitation and vice versa. The width of the arrows represents the number
of packets which underwent that interaction, while the color of the arrows represent
the wavelength of the transition.
Arrows represent the line interactions experienced by packets. Upwards arrows
show excitation from lower energy levels to higher levels and downward arrows
show de-excitation from higher energy levels to lower levels. The thickness of
each arrow represents the number of packets that underwent that interaction.
The wavelength of the transition is given by the color.

Setting Other Options
-----------------
You can select the range of the wavelength to filter the transitions on
using the slider. You can also select the supernova shell by which to filter
the last line interactions and the level populations. If no shell is selected,
then all the last line interactions are plotted and the level populations are
averaged across shells. You can also set the max levels to show on the plot.
You can select the range on which to filter the wavelength using the slider.
You can also select the model shell by which to filter the last line interactions
and the level populations. If no shell is selected, then all the last line
interactions are plotted and the level populations are averaged across all shells
in the simulation. You can also set the maximum number of levels to show on the plot.

Lastly, you can also set the scale of the y-axis: Linear or Log.

Expand Down
6 changes: 3 additions & 3 deletions tardis/visualization/widgets/grotrian.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class GrotrianPlot:
Default value is packet_out_nu
y_scale : {"Log", "Linear"}
The scale to plot the energy levels on the y-axis
Default value is Linear
Default value is Log
cmapname : str
The name of the colormap used to denote wavelengths. Default value is "rainbow"
level_width_scale : float
Expand Down Expand Up @@ -912,7 +912,7 @@ def display(self):
# Update fig layout
self.fig.update_layout(
title=(
f"Grotrian Diagram for {self.atomic_name} {int_to_roman(self.ion_number + 1)} "
f"Energy Level Diagram for {self.atomic_name} {int_to_roman(self.ion_number + 1)} "
f"(Shell: {self.shell if self.shell is not None else 'All'})"
),
title_x=0.5,
Expand Down Expand Up @@ -1155,7 +1155,7 @@ def _wavelength_change_handler(self, change):
min_wavelength, max_wavelength = change["new"]
index = self.fig.children.index(self.plot.fig)
setattr(self.plot, "min_wavelength", min_wavelength)
setattr(self.plot, "max_wavelength", max_wavelength)
setattr(self.plot, "max_wavelength", max_wavelength + 1)

# Set the updated plot in the figure
children_list = list(self.fig.children)
Expand Down

0 comments on commit 48a571a

Please sign in to comment.