Skip to content

Commit

Permalink
Fix density interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyizheng1112 authored and James Gillanders committed Aug 20, 2021
1 parent 0bfcee0 commit c6c9e36
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tardis/visualization/widgets/custom_abundance.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
parse_csv_abundances,
)
from tardis.util.base import atomic_number2element_symbol, quantity_linspace
from tardis.visualization.tools.convergence_plot import transition_colors

import asyncio

Expand Down Expand Up @@ -546,10 +547,8 @@ def on_btn_add_shell(self, obj):
self.density = (
np.interp(
v_scalar,
self.velocity.value,
density.value,
left=density[0].value,
right=density[-1].value,
self.velocity[1:].value,
density[1:].value,
)
* density.unit
)
Expand Down Expand Up @@ -939,13 +938,14 @@ def generate_abundance_density_plot(self):
),
)

self.colorscale = transition_colors(20, "tab20")
for i in range(self.no_of_elements):
self.fig.add_trace(
go.Scatter(
x=self.velocity,
y=np.append(data.iloc[i], data.iloc[i, -1]),
mode="lines+markers",
line={"shape": "hv"},
line=dict(shape="hv", color=self.colorscale[i]),
name=self.elements[i],
),
)
Expand Down

0 comments on commit c6c9e36

Please sign in to comment.