specutils icon indicating copy to clipboard operation
specutils copied to clipboard

Can't print Spectrum1D object created by default loader for JWST s3d data cube

Open PatrickOgle opened this issue 3 years ago • 0 comments

Spectrum1D.read of JWST s3d file uses default loader rather than JWST s3d loader. A Spectrum1D object loaded this way can't be printed:


TypeError Traceback (most recent call last) in 1 #Try printing Spectrum1D obect ----> 2 print(spec1d_untrimmed) 3 #print(spec1d_untrimmed.spectral_axis) 4 #print(spec1d_untrimmed.uncertainty)

~/miniconda3/envs/jdaviz1.1/lib/python3.9/site-packages/specutils/spectra/spectrum1d.py in str(self) 457 for i, flux in enumerate(self.flux): 458 label = 'flux{:2}'.format(i) --> 459 result += self._format_array_summary(label, flux) + '\n' 460 else: 461 result += self._format_array_summary('flux', self.flux) + '\n'

~/miniconda3/envs/jdaviz1.1/lib/python3.9/site-packages/specutils/spectra/spectrum1d.py in _format_array_summary(self, label, array) 441 mean = np.mean(array) 442 s = "{:17} [ {:.5}, ..., {:.5} ], mean={:.5}" --> 443 return s.format(label+':', array[0], array[-1], mean) 444 else: 445 return "{:17} [ ], mean= n/a".format(label+':')

~/miniconda3/envs/jdaviz1.1/lib/python3.9/site-packages/astropy/units/quantity.py in format(self, format_spec) 1255 """ 1256 try: -> 1257 value = format(self.value, format_spec) 1258 full_format_spec = "s" 1259 except ValueError:

TypeError: unsupported format string passed to numpy.ndarray.format

PatrickOgle avatar Apr 01 '21 13:04 PatrickOgle