[Tutor] spectutils

Alan Gauld alan.gauld at yahoo.co.uk
Wed Apr 8 09:46:36 EDT 2020


On 08/04/2020 11:28, Rudolf Baer wrote:
> I am working on a macbook pro OS X Yosemite 10.10.5, python 2.7 , jupyter notebook.

> 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)

> 
> TypeError                                 Traceback (most recent call last)
> <ipython-input-1-2e15c1951be1> in <module>()
>       6 wavelength = np.arange(5100, 5300)*u.AA
> ----> 7 spec1d = Spectrum1D(spectral_axis=wavelength, flux=flux)
> 
> TypeError: __init__() takes at least 3 arguments (2 given)

This isn't really a python issue but a specutils package issue.
If you are very lucky you will find a user of specutils on this
list who can help, but you may need to ask on a specutils forum
(or at least the SciPy forum where you are more likely to find
a fellow user).

The basic error is  self explanatory, your code doesn't provide
enough arguments. But unless we see the definition of the
SpectrumID __init__() method we can't guess what the missing
item is.

You might get a clue by using the built in help:

>>> import specutils
>>>  help(specutils.SpectrumID)

But that depends a lot on how diligent the author of the package
was in writing documentation.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list