Skip to content

Commit

Permalink
Raise error if distance > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaladh-singhal committed Feb 1, 2021
1 parent 71b10a3 commit 5e73fd6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tardis/widgets/sdec_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,10 @@ def _calculate_plotting_data(
if distance is None:
self.lum_to_flux = 1 # so that this term will have no effect
else:
self.lum_to_flux = 4.0 * np.pi * (distance.to("cm")) ** 2
if distance <= 0:
raise ValueError("distance passed must be greater than 0")
else:
self.lum_to_flux = 4.0 * np.pi * (distance.to("cm")) ** 2

# Calculate luminosities to be shown in plot
(
Expand Down

0 comments on commit 5e73fd6

Please sign in to comment.