Issue with isinstance check of Spectrum class
jason-neal opened this issue · comments
Occuring when trying to subtract to spectra using the overloaded operators.
Occurs for all + - * / .
The incorrect isinstance call is causing it to skip to the end and not create a new_flux variable to assign in the new spectrum.
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-85-4c9c29792431> in <module>()
11 print("instance", isinstance(moving_spec, sp))
12
---> 13 diff_spec = stationary_spec - moving_spec
14
15 plt.plot(diff_spec.xaxis, diff_spec.flux)
/home/jneal/anaconda2/envs/py35/lib/python3.5/site-packages/spectrum_overload-0.1-py3.5.egg spectrum_overload/Spectrum.py in __sub__(self, other)
235 new_flux = self.flux - other
236
--> 237 return Spectrum(flux=new_flux, xaxis=self.xaxis, header=self.header, calibrated=self.calibrated)
238
239
UnboundLocalError: local variable 'new_flux' referenced before assignment
Need to see if this fixes the error where it was occuring still.