Throughout Spectrum (and probably other classes) there are many points where a Spectrum method returns a new Spectrum object by doing return Spectrum(...). However this is kind of bad practice as downstream users may derive their own classes from Spectrum, in which case Spectrum methods will return a Spectrum rather than the subclass.
The fix is simple: replace calls to Spectrum() (etc.) with self.__class__()
Throughout
Spectrum
(and probably other classes) there are many points where aSpectrum
method returns a newSpectrum
object by doingreturn Spectrum(...)
. However this is kind of bad practice as downstream users may derive their own classes fromSpectrum
, in which caseSpectrum
methods will return aSpectrum
rather than the subclass.The fix is simple: replace calls to
Spectrum()
(etc.) withself.__class__()