astropy / specutils

An Astropy coordinated package for astronomical spectroscopy. Maintainers: @rosteen @keflavich @eteq
http://specutils.readthedocs.io/en/latest/
166 stars 127 forks source link

TypeError in specutils/wcs/specwcs.py #124

Closed olebole closed 8 years ago

olebole commented 8 years ago

Hi,

I am currently packaging the specutils affiliated package for Debian. When running the tests (with astropy-1.0.5) with python-2.7.10, I get a number of failures which are caused by the following TypeError:

specutils/spectrum1d.py:268: in dispersion
    return self.wcs(self.indexer(pixel_indices))
specutils/wcs/specwcs.py:187: in __call__
    self.param_sets))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'specutils.wcs.specwcs.Spectrum1DPolynomialWCS'>
Name: Spectrum1DPolyno...le parameters: <astropy.utils.decorators.lazyproperty object at 0x7f76b6bad990>
pixel_indices = array([  0.00000000e+00,   1.00000000e+00,   2.00000000e+00, ...,
         4.09300000e+03,   4.09400000e+03,   4.09500000e+03])
unit = Unit("km / s"), coeffs = (array([ 524.88543398]), array([-0.25258831]))

@classmethod
    def evaluate(cls, pixel_indices, unit=None, *coeffs):
        return super(Spectrum1DPolynomialWCS, cls).evaluate(pixel_indices,
>                                                           *coeffs) * unit
E       TypeError: unbound method evaluate() must be called with Spectrum1DPolynomialWCS 
                   instance as first argument (got ndarray instance instead)

This happens on test_multispec_linear, test_multispec_log_linear, test_1dspec_UVES, test_1dspec_vrad, test_linear_write1, test_linear_write2, test_multispec_linear, and test_spectrum_slicing. Also the first test test_multispec_linear has the additional output

----------------------------- Captured stderr call -----------------------------
WARNING: File may have been truncated: actual file length (895664) is smaller than the expected size (895680) [astropy.io.fits.file]
specutils/wcs/specwcs.py:75: UserWarning: Initializing a Spectrum1D WCS with units set to `None` is not recommended
  'Initializing a Spectrum1D WCS with units set to `None` is not recommended')

which may or may not be connected with this issue.

wkerzendorf commented 8 years ago

@olebole as discussed this might well be an error that arises from an incorrect use of models. The current version fixes that issue. @embray could I get your help with doing a quick 0.2 release of this?

olebole commented 8 years ago

Could I just send a ping out here for a new release?

wkerzendorf commented 8 years ago

@olebole yes you definitely can. We just need to do it ;-) @nhmc maybe we can do the release together.

nhmc commented 8 years ago

Yes, I'd be happy to help out.

wkerzendorf commented 8 years ago

@nhmc @olebole @keflavich has done a new release. This one should work now with the new astropy

olebole commented 8 years ago

Thanks to all for the efforts. Package is built and uploaded to Debian. Until it is accepted, you'll find it in the NEW queue. After approval, it will appear in our package tracker.