bmorris3 / aesop

ARC Echelle Spectroscopic Observation Pipeline (aesop)
http://arces.readthedocs.io
MIT License
3 stars 2 forks source link

WCS TypeError in EchelleSpectrum.from_fits #28

Open joshua-liberman opened 2 years ago

joshua-liberman commented 2 years ago

Hi, I'm receiving a TypeError: The wcs argument must implement either the high or low level WCS API when I attempt to initialize an aesop.EchelleSpectrum object for my target spectrum. How do I go about resolving this issue?

bmorris3 commented 2 years ago

Hi @jlibermann, what version of astropy are you using? Could you please post the full traceback?

joshua-liberman commented 2 years ago

I am running astropy version 5.0.1.


TypeError Traceback (most recent call last) Input In [7], in 1 from aesop import EchelleSpectrum ----> 3 target_spectrum = EchelleSpectrum.from_fits(target_path)

File ~/spectra_reduction/aesop/aesop/spectra.py:331, in EchelleSpectrum.from_fits(cls, path) 320 @classmethod 321 def from_fits(cls, path): 322 """ 323 Load an echelle spectrum from a FITS file. 324 (...) 328 Path to the FITS file 329 """ 330 spectrum_list = [Spectrum1D.from_specutils(s) --> 331 for s in read_fits_spectrum1d(path)] 332 header = fits.getheader(path) 334 name = header.get('OBJNAME', None)

File ~/spectra_reduction/aesop/aesop/legacy_specutils/readspec.py:555, in read_fits_spectrum1d(filename, dispersion_unit, flux_unit) 552 multispec = [] 553 for spectrum_data, spectrum_wcs in zip(data, multi_wcs.values()): 554 multispec.append( --> 555 Spectrum1D(spectrum_data, wcs=spectrum_wcs)) 556 return multispec 558 elif wcs_info.naxis == 3 and \ 559 wcs_info.affine_transform_dict['ctype'] == ["LINEAR","LINEAR","LINEAR"]:

File ~/spectra_reduction/aesop/aesop/legacy_specutils/spectrum1d.py:191, in Spectrum1D.init(self, flux, wcs, unit, uncertainty, mask, meta, indexer, *args, kwargs) 188 def init(self, flux, wcs, unit=None, uncertainty=None, mask=None, 189 meta=None, indexer=None, *args, *kwargs): --> 191 super(Spectrum1D, self).init(data=flux, unit=unit, wcs=wcs, uncertainty=uncertainty, 192 mask=mask, meta=meta, args, kwargs) 194 self._wcs_attributes = copy.deepcopy(self.class._wcs_attributes) 195 if indexer is None:

File /opt/conda/envs/py38/lib/python3.8/site-packages/astropy-5.0.1-py3.8-linux-x86_64.egg/astropy/nddata/nddata.py:231, in NDData.init(self, data, uncertainty, mask, wcs, meta, unit, copy) 228 self._wcs = None 229 if wcs is not None: 230 # Validate the wcs --> 231 self.wcs = wcs 232 self.meta = meta # TODO: Make this call the setter sometime 233 self._unit = unit

File ~/spectra_reduction/aesop/aesop/legacy_specutils/spectrum1d.py:248, in Spectrum1D.setattr(self, name, value) 246 self._wcs_attributes[name[:-5]]['unit'] = u.Unit(value) 247 else: --> 248 super(Spectrum1D, self).setattr(name, value)

File /opt/conda/envs/py38/lib/python3.8/site-packages/astropy-5.0.1-py3.8-linux-x86_64.egg/astropy/nddata/nddata.py:295, in NDData.wcs(self, wcs) 293 self._wcs = HighLevelWCSWrapper(wcs) 294 else: --> 295 raise TypeError("The wcs argument must implement either the high or" 296 " low level WCS API.")

TypeError: The wcs argument must implement either the high or low level WCS API.