[Tutor] spectutils

Rudolf Baer rbaer25 at gmail.com
Wed Apr 8 06:28:06 EDT 2020


I am working on a macbook pro OS X Yosemite 10.10.5, python 2.7 , jupyter notebook.
The first code given in the the manual

import numpy as np
import astropy.units as u
import matplotlib.pyplot as plt
from specutils import Spectrum1D
flux = np.random.randn(200)*u.Jy
wavelength = np.arange(5100, 5300)*u.AA
spec1d = Spectrum1D(spectral_axis=wavelength, flux=flux)
ax = plt.subplots()[1]
ax.plot(spec1d.spectral_axis, spec1d.flux)
ax.set_xlabel("Dispersion")
ax.set_ylabel("Flux”)

ends in 

TypeError                                 Traceback (most recent call last)
<ipython-input-1-2e15c1951be1> in <module>()
      5 flux = np.random.randn(200)*u.Jy
      6 wavelength = np.arange(5100, 5300)*u.AA
----> 7 spec1d = Spectrum1D(spectral_axis=wavelength, flux=flux)
      8 ax = plt.subplots()[1]
      9 ax.plot(spec1d.spectral_axis, spec1d.flux)

TypeError: __init__() takes at least 3 arguments (2 given)

How can this be fixed?
with kind regards
R. Baer



More information about the Tutor mailing list