From 63cde914729294c4c34f4f321f8b64f8bebed290 Mon Sep 17 00:00:00 2001 From: Sumit Gupta <53135486+Sumit112192@users.noreply.github.com> Date: Wed, 24 Apr 2024 22:19:22 +0530 Subject: [PATCH] Abundance widget bug fix (#2577) * Fixed CustomAbundanceWidget Bug caused by using wrong parameters of simulation_state * Reformatted using black suggestion * Updated Documentation concerning usage of CustomAbundanceWidget.from_simulation --- docs/io/visualization/how_to_abundance_widget.ipynb | 2 +- tardis/visualization/widgets/custom_abundance.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/io/visualization/how_to_abundance_widget.ipynb b/docs/io/visualization/how_to_abundance_widget.ipynb index ce7e4fc3822..ec906eb34ad 100644 --- a/docs/io/visualization/how_to_abundance_widget.ipynb +++ b/docs/io/visualization/how_to_abundance_widget.ipynb @@ -97,7 +97,7 @@ "outputs": [], "source": [ "# sim = run_tardis(\"tardis_example.yml\")\n", - "# widget = CustomAbundanceWidget.from_sim(sim)" + "# widget = CustomAbundanceWidget.from_simulation(sim)" ] }, { diff --git a/tardis/visualization/widgets/custom_abundance.py b/tardis/visualization/widgets/custom_abundance.py index 8d6d3b6c952..82a986cf41f 100644 --- a/tardis/visualization/widgets/custom_abundance.py +++ b/tardis/visualization/widgets/custom_abundance.py @@ -281,8 +281,10 @@ def from_simulation(cls, sim): ------- CustomAbundanceWidgetData """ - abundance = sim.simulation_state.raw_abundance.copy() - isotope_abundance = sim.simulation_state.raw_isotope_abundance.copy() + abundance = sim.simulation_state.abundance.copy() + isotope_abundance = ( + sim.simulation_state.composition.raw_isotope_abundance.copy() + ) # integrate element and isotope to one DataFrame abundance["mass_number"] = ""