Skip to content

Commit

Permalink
Fix up __mul__ logic in SpectralElement
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Oct 12, 2017
1 parent 600b4d8 commit 79e4c61
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pysynphot/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,17 +1750,17 @@ def __mul__(self, other):
if isinstance(other, SpectralElement):
return CompositeSpectralElement(self, other)

if isinstance(other, SourceSpectrum):
return CompositeSourceSpectrum(self, other, 'multiply')
elif isinstance(other, SourceSpectrum):
return other.__mul__(self)

# Multiplying by a constant is the same as multiplying by a
# UniformTransmission object
if isinstance(other, (int, float)):
elif isinstance(other, (int, float)):
return CompositeSpectralElement(self, UniformTransmission(other))

else:
print("SpectralElements can only be multiplied by other " +
"SpectralElements or SourceSpectrum objects")
raise TypeError("SpectralElements can only be multiplied by other "
"SpectralElements or SourceSpectrum objects")

def __rmul__(self, other):
return self.__mul__(other)
Expand Down

0 comments on commit 79e4c61

Please sign in to comment.