Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert quantities to arrays when plotting in SDEC plot #1832

Merged
merged 2 commits into from
Dec 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions tardis/visualization/tools/sdec_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,8 @@ def generate_plot_mpl(
# Plot modeled spectrum
if show_modeled_spectrum:
self.ax.plot(
self.plot_wavelength,
self.modeled_spectrum_luminosity,
self.plot_wavelength.value,
self.modeled_spectrum_luminosity.value,
"--b",
label=f"{packets_mode.capitalize()} Spectrum",
linewidth=1,
Expand All @@ -1202,17 +1202,17 @@ def generate_plot_mpl(
observed_spectrum_flux = observed_spectrum[1].to("erg/(s cm**2 AA)")

self.ax.plot(
observed_spectrum_wavelength,
observed_spectrum_flux,
observed_spectrum_wavelength.value,
observed_spectrum_flux.value,
"-k",
label="Observed Spectrum",
linewidth=1,
)

# Plot photosphere
self.ax.plot(
self.plot_wavelength,
self.photosphere_luminosity,
self.plot_wavelength.value,
self.photosphere_luminosity.value,
"--r",
label="Blackbody Photosphere",
)
Expand Down Expand Up @@ -1243,7 +1243,7 @@ def _plot_emission_mpl(self):
)

self.ax.fill_between(
self.plot_wavelength,
self.plot_wavelength.value,
lower_level,
upper_level,
color="#4C4C4C",
Expand All @@ -1256,7 +1256,7 @@ def _plot_emission_mpl(self):
)

self.ax.fill_between(
self.plot_wavelength,
self.plot_wavelength.value,
lower_level,
upper_level,
color="#8F8F8F",
Expand All @@ -1271,7 +1271,7 @@ def _plot_emission_mpl(self):
)

self.ax.fill_between(
self.plot_wavelength,
self.plot_wavelength.value,
lower_level,
upper_level,
color="#C2C2C2",
Expand All @@ -1288,7 +1288,7 @@ def _plot_emission_mpl(self):
)

self.ax.fill_between(
self.plot_wavelength,
self.plot_wavelength.value,
lower_level,
upper_level,
color=self._color_list[species_counter],
Expand Down Expand Up @@ -1328,7 +1328,7 @@ def _plot_absorption_mpl(self):
)

self.ax.fill_between(
self.plot_wavelength,
self.plot_wavelength.value,
upper_level,
lower_level,
color="silver",
Expand All @@ -1343,7 +1343,7 @@ def _plot_absorption_mpl(self):
)

self.ax.fill_between(
self.plot_wavelength,
self.plot_wavelength.value,
upper_level,
lower_level,
color=self._color_list[species_counter],
Expand Down Expand Up @@ -1572,8 +1572,8 @@ def generate_plot_ply(
if show_modeled_spectrum:
self.fig.add_trace(
go.Scatter(
x=self.plot_wavelength,
y=self.modeled_spectrum_luminosity,
x=self.plot_wavelength.value,
y=self.modeled_spectrum_luminosity.value,
mode="lines",
line=dict(
color="blue",
Expand Down Expand Up @@ -1601,17 +1601,17 @@ def generate_plot_ply(
observed_spectrum_flux = observed_spectrum[1].to("erg/(s cm**2 AA)")

self.fig.add_scatter(
x=observed_spectrum_wavelength,
y=observed_spectrum_flux,
x=observed_spectrum_wavelength.value,
y=observed_spectrum_flux.value,
name="Observed Spectrum",
line={"color": "black", "width": 1.2},
)

# Plot photosphere
self.fig.add_trace(
go.Scatter(
x=self.plot_wavelength,
y=self.photosphere_luminosity,
x=self.plot_wavelength.value,
y=self.photosphere_luminosity.value,
mode="lines",
line=dict(width=1.5, color="red", dash="dash"),
name="Blackbody Photosphere",
Expand Down Expand Up @@ -1826,7 +1826,7 @@ def _show_colorbar_ply(self):
scatter_point_idx = pu.get_mid_point_idx(self.plot_wavelength)
self.fig.add_trace(
go.Scatter(
x=self.plot_wavelength[scatter_point_idx],
x=[self.plot_wavelength[scatter_point_idx].value],
y=[0],
mode="markers",
showlegend=False,
Expand Down