Last active
January 23, 2020 15:38
-
-
Save tomr-stargazer/7a4efed0f8a1f5d410066ca87515f692 to your computer and use it in GitHub Desktop.
Output of attempting to load CLASS-generated FITS spectrum into specutils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipython --pylab | |
Python 3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 5.1.0 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object', use 'object??' for extra details. | |
Using matplotlib backend: MacOSX | |
In [1]: import specutils | |
INFO:root:Successfully loaded reader "cubetest1". | |
INFO:root:Successfully loaded reader "tabular-fits". | |
INFO:root:Successfully loaded reader "wcs1d-fits". | |
In [3]: s1d = specutils.wcs_fits_reader.wcs1d_fits('test_L1455IRS1_DCN2-1.fits') | |
INFO:root:Spectrum file looks like wcs1d-fits | |
WARNING: Header block contains null bytes instead of spaces for padding, and is not FITS-compliant. Nulls may be replaced with spaces upon writing. [astropy.io.fits.header] | |
WARNING:astropy:Header block contains null bytes instead of spaces for padding, and is not FITS-compliant. Nulls may be replaced with spaces upon writing. | |
WARNING: FITSFixedWarning: 'celfix' made the change 'Linear transformation matrix is singular'. [astropy.wcs.wcs] | |
WARNING:astropy:FITSFixedWarning: 'celfix' made the change 'Linear transformation matrix is singular'. | |
--------------------------------------------------------------------------- | |
SingularMatrixError Traceback (most recent call last) | |
<ipython-input-3-165e2b31c6c4> in <module>() | |
----> 1 s1d = specutils.wcs_fits_reader.wcs1d_fits('test_L1455IRS1_DCN2-1.fits') | |
2 | |
/Users/tsrice/anaconda3/lib/python3.6/site-packages/specutils-0.1.dev727-py3.6.egg/specutils/io/registers.py in wrapper(*args, **kwargs) | |
32 @wraps(func) | |
33 def wrapper(*args, **kwargs): | |
---> 34 return func(*args, **kwargs) | |
35 return wrapper | |
36 return decorator | |
/Users/tsrice/anaconda3/lib/python3.6/site-packages/specutils-0.1.dev727-py3.6.egg/specutils/io/default_loaders/wcs_fits_reader.py in wcs1d_fits(file_name, spectral_axis_unit, **kwargs) | |
37 with fits.open(file_name, **kwargs) as hdulist: | |
38 header = hdulist[0].header | |
---> 39 wcs = WCS(header) | |
40 | |
41 if 'BUNIT' in header: | |
/Users/tsrice/anaconda3/lib/python3.6/site-packages/astropy/wcs/wcs.py in __init__(self, header, fobj, key, minerr, relax, naxis, keysel, colsel, fix, translate_units, _do_set) | |
501 | |
502 if _do_set: | |
--> 503 self.wcs.set() | |
504 | |
505 for fd in close_fds: | |
SingularMatrixError: ERROR 3 in wcsset() at line 2213 of file cextern/wcslib/C/wcs.c: | |
Linear transformation matrix is singular. | |
ERROR 3 in linset() at line 607 of file cextern/wcslib/C/lin.c: | |
PCi_ja matrix is singular. | |
In [5]: from astropy.io.fits import getdata | |
In [6]: data, header = getdata("test_L1455IRS1_DCN2-1.fits", header=True) | |
WARNING: Header block contains null bytes instead of spaces for padding, and is not FITS-compliant. Nulls may be replaced with spaces upon writing. [astropy.io.fits.header] | |
WARNING:astropy:Header block contains null bytes instead of spaces for padding, and is not FITS-compliant. Nulls may be replaced with spaces upon writing. | |
In [10]: data | |
Out[10]: | |
array([[[[-0.00654329, 0.01778164, -0.01153884, ..., -0.01729367, | |
0.01069437, -0.01851475]]]]) | |
In [11]: data.shape | |
Out[11]: (1, 1, 1, 37275) | |
In [7]: header | |
Out[7]: | |
SIMPLE = T / | |
BITPIX = -64 | |
NAXIS = 4 / | |
NAXIS1 = 37275 / | |
NAXIS2 = 1 / | |
NAXIS3 = 1 / | |
NAXIS4 = 1 / | |
BLOCKED = T / | |
DATAMIN = -0.146224617958E+000 / | |
DATAMAX = 0.140489089489E+001 / | |
BUNIT = 'K ' / | |
CTYPE1 = 'FREQ ' / | |
CRVAL1 = 0.000000000000E+000 / Offset frequency | |
CDELT1 = 0.488281250000E+005 / Frequency resolution | |
CRPIX1 = 0.176140019531E+005 / | |
CTYPE2 = 'RA---GLS' / | |
EQUINOX = 0.200000000000E+004 / | |
CRVAL2 = 0.519129166667E+002 / | |
CDELT2 = 0.000000000000E+000 / | |
CRPIX2 = 0.000000000000E+000 / | |
CTYPE3 = 'DEC--GLS' / | |
CRVAL3 = 0.302175000000E+002 / | |
CDELT3 = 0.000000000000E+000 / | |
CRPIX3 = 0.000000000000E+000 / | |
CTYPE4 = 'STOKES ' / | |
CRVAL4 = 1.0000000000000 / | |
CDELT4 = 0.0000000000000 / | |
CRPIX4 = 0.0000000000000 / | |
TELESCOP= '30ME1-LI-F0-' / | |
OBJECT = 'L1455IRS1 ' / | |
LINE = 'DCN(2-1) ' / Line name | |
RESTFREQ= 0.144828001000E+012 / Rest frequency | |
VELO-LSR= 0.500000000000E+004 / Velocity of reference channel | |
DELTAV = -0.101073712111E+003 / Velocity spacing of channels | |
IMAGFREQ= 0.157326768103E+012 / Image frequency | |
TSYS = 0.845444717407E+002 / System temperature | |
OBSTIME = 0.165860595703E+004 / Integration time | |
SCAN-NUM= 0.100000000000E+001 / Scan number | |
TAU-ATM = 0.288365986198E-001 / Atmospheric opacity | |
NPHASE = 1 / Number of frequency phases | |
DELTAF1 = 0.000000000000E+000 / Frequency offset Phase 1 | |
PTIME1 = 0.498978763819E+000 / Duration of Phase 1 | |
WEIGHT1 = 0.000000000000E+000 / Weight of Phase 1 | |
GAINIMAG= 0.501190014184E-001 / Image sideband gain ratio | |
BEAMEFF = 0.930000007153E+000 / Beam efficiency | |
FORWEFF = 0.930000007153E+000 / Image sideband gain ratio | |
ORIGIN = 'CLASS-Grenoble ' / | |
DATE = '2017-09-21T00:00:00.000' / Date written | |
TIMESYS = 'UTC ' / | |
DATE-OBS= '2014-12-26T18:48:39.588' / Date observed | |
DATE-RED= '2017-09-21T00:00:00.000' / Date reduced | |
ELEVATIO= 0.592332514636E+002 / Telescope elevation | |
AZIMUTH = 0.000000000000E+000 / Telescope azimuth | |
UT = ' 18:48:39.588' / Universal time at start | |
LST = ' 00:55:48.714' / Sideral time at start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, setting
CDELT2
,CDELT3
, andCDELT4
to 1 allows the WCS object to be created.