Closed tammojan closed 7 years ago
Let me know if you need to know which versions (of which software) we have installed in Bologna. Thanks.
Could you report on your versions of wcslib
, cfitsio
and python-casacore
?
wcslib 5.15 cfitsio 3.0 python-casacore 2.1.0
While I'm preparing a machine with these versions, could you check if the following reproduces the problem:
import casacore.images as pim
# Import
img1 = pim.image('L230423_SB000_uv.dppp_1248F906Et_121MHz.pre-cal_chunk8_1248FDB71t_0g.wsclean_image11-image.fits')
print '==== img1.coordinates() ===', img1.coordinates()
# Export to FITS
img2 = pim.image('', shape=img1.shape(),coordsys=img1.coordinates())
print '==== img2.coordinates() ===', img2.coordinates()
img2.tofits('img2.fits')
# Re-read from disk
img3 = pim.image('img2.fits')
print '==== img3.coordinates() ===', img3.coordinates()
img2.fits has the coordinates, here the full output
>>> import casacore.images as pim
>>> img1 = pim.image('L230423_SB000_uv.dppp_1248F906Et_121MHz.pre-cal_chunk8_1248FDB71t_0g.wsclean_image11-image.fits')
>>>
>>>
>>> print '==== img1.coordinates() ===', img1.coordinates()
==== img1.coordinates() === Spectral Coordinate:
Reference Pixel : 0.0
Reference Value : 124119567.871 Hz
Increment : 7812500.0 Hz
Frame : TOPO
Rest Frequency : 0.0 Hz
Stokes Coordinate:
Reference Pixel : [ 0.]
Reference Value : [ 1.] []
Increment : [ 1.] []
Direction Coordinate:
Reference Pixel : [ 256. 256.]
Reference Value : [ 0.86857995 -2.68128158] ['rad', 'rad']
Increment : [ 7.27220522e-06 -7.27220522e-06] ['rad', 'rad']
Frame : J2000
Projection : SIN
>>> img2 = pim.image('', shape=img1.shape(),coordsys=img1.coordinates())
>>> print '==== img2.coordinates() ===', img2.coordinates()
==== img2.coordinates() === Spectral Coordinate:
Reference Pixel : 0.0
Reference Value : 124119567.871 Hz
Increment : 7812500.0 Hz
Frame : TOPO
Rest Frequency : 0.0 Hz
Stokes Coordinate:
Reference Pixel : [ 0.]
Reference Value : [ 1.] []
Increment : [ 1.] []
Direction Coordinate:
Reference Pixel : [ 256. 256.]
Reference Value : [ 0.86857995 -2.68128158] ['rad', 'rad']
Increment : [ 7.27220522e-06 -7.27220522e-06] ['rad', 'rad']
Frame : J2000
Projection : SIN
>>>
>>> img2.tofits('img2.fits')
>>> img3 = pim.image('img2.fits')
2017-04-12 09:56:17 INFO FITSCoordinateUtil::fromFITSHeader Neither SPECSYS nor VELREF keyword given, spectral reference frame not defined ...
>>> print '==== img3.coordinates() ===', img3.coordinates()
==== img3.coordinates() === Spectral Coordinate:
Reference Pixel : 0.0
Reference Value : 124119567.871 Hz
Increment : 7812500.0 Hz
Frame : Undefined
Rest Frequency : 0.0 Hz
Stokes Coordinate:
Reference Pixel : [ 0.]
Reference Value : [ 1.] []
Increment : [ 1.] []
Direction Coordinate:
Reference Pixel : [ 256. 256.]
Reference Value : [ 0.86857995 -2.68128158] ['rad', 'rad']
Increment : [ 7.27220522e-06 -7.27220522e-06] ['rad', 'rad']
Frame : J2000
Projection : SIN
Can you check that img2.fits
has coordinates?
Looking at the output above, it seems it does, which seems to say that tofits()
is fine, even on your system.
Can you provide exact commands that show your error? How do you check that there are no coordinates in the output fits?
I've tried the following, which does not reproduce the error for me (on a system with ubuntu 16.04, wcslib 5.15):
make_clean_mask.py -p 8 -a False -i 7 -r '(120,30)' -d float -b 0.4 -t True -o True -f fits L230423_SB000_uv.dppp_1248F906Et_121MHz.pre-cal_chunk8_1248FDB71t_0g.wsclean_image11-image.fits out.fits
python -c 'import pyfits; img=pyfits.open("out.fits"); print img[0].header' | fold -w80
This shows that there are coordinates in the output:
SIMPLE = T /Standard FITS
BITPIX = -32 /Floating point (32 bit)
NAXIS = 4
NAXIS1 = 512
NAXIS2 = 512
NAXIS3 = 1
NAXIS4 = 1
EXTEND = T
BSCALE = 1.000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
BZERO = 0.000000000000E+00
BTYPE = 'Intensity'
OBJECT = ' '
BUNIT = ' ' /Brightness (pixel) unit
EQUINOX = 2.000000000000E+03
RADESYS = 'FK5 '
LONPOLE = 1.800000000000E+02
LATPOLE = 4.976596536110E+01
PC01_01 = 1.000000000000E+00
PC02_01 = 0.000000000000E+00
PC03_01 = 0.000000000000E+00
PC04_01 = 0.000000000000E+00
PC01_02 = 0.000000000000E+00
PC02_02 = 1.000000000000E+00
PC03_02 = 0.000000000000E+00
PC04_02 = 0.000000000000E+00
PC01_03 = 0.000000000000E+00
PC02_03 = 0.000000000000E+00
PC03_03 = 1.000000000000E+00
PC04_03 = 0.000000000000E+00
PC01_04 = 0.000000000000E+00
PC02_04 = 0.000000000000E+00
PC03_04 = 0.000000000000E+00
PC04_04 = 1.000000000000E+00
CTYPE1 = 'RA---SIN'
CRVAL1 = -1.536261183330E+02
CDELT1 = -4.166666666670E-04
CRPIX1 = 2.570000000000E+02
CUNIT1 = 'deg '
CTYPE2 = 'DEC--SIN'
CRVAL2 = 4.976596536110E+01
CDELT2 = 4.166666666670E-04
CRPIX2 = 2.570000000000E+02
CUNIT2 = 'deg '
CTYPE3 = 'STOKES '
CRVAL3 = 1.000000000000E+00
CDELT3 = 1.000000000000E+00
CRPIX3 = 1.000000000000E+00
CUNIT3 = ' '
CTYPE4 = 'VOPT '
CRVAL4 = -0.000000000000E+00
CDELT4 = -2.120575050367E+08
CRPIX4 = 1.000000000000E+00
CUNIT4 = 'm/s '
PV2_1 = 0.000000000000E+00
PV2_2 = 0.000000000000E+00
RESTFRQ = 1.241195678711E+08 /Rest Frequency (Hz)
SPECSYS = 'TOPOCENT' /Spectral reference frame
ALTRVAL = 1.241195678711E+08 /Alternate frequency reference value
ALTRPIX = 1.000000000000E+00 /Alternate frequency reference pixel
VELREF = 3 /1 LSR, 2 HEL, 3 OBS, +256 Radio
COMMENT casacore non-standard usage: 4 LSD, 5 GEO, 6 SOU, 7 GAL
DATE = '2017-04-12T11:11:03.008000' /Date FITS file was written
TIMESYS = 'UTC ' /Time system for HDU
ORIGIN = 'casacore-trunk'
END
img2.fits has the coordinates.
I see that the outputs do not have the coordinates by opening the images with ds9 or casaviewer.
I tried to run
make_clean_mask.py -p 8 -a False -i 7 -r '(120,30)' -d float -b 0.4 -t True -o True -f fits L230423_SB000_uv.dppp_1248F906Et_121MHz.pre-cal_chunk8_1248FDB71t_0g.wsclean_image11-image.fits out.fits
and the output DOES NOT have coordinate. If I try to open it with casaviewer I get this long message
2017-04-12 11:35:51 INFO FITS card 9: BSCALE = 1,000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 10: BZERO = 0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 15: EQUINOX = 2,000000000000E+03
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 36: CRVAL1 = -1,536261183330E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 37: CDELT1 = -4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 38: CRPIX1 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 41: CRVAL2 = 4,976596536110E+01
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 42: CDELT2 = 4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 43: CRPIX2 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 46: CRVAL3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 47: CDELT3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 48: CRPIX3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 51: CRVAL4 = -0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 52: CDELT4 = -2,120575050367E+08
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 53: CRPIX4 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 9: BSCALE = 1,000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 10: BZERO = 0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 15: EQUINOX = 2,000000000000E+03
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 36: CRVAL1 = -1,536261183330E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 37: CDELT1 = -4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 38: CRPIX1 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 41: CRVAL2 = 4,976596536110E+01
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 42: CDELT2 = 4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 43: CRPIX2 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 46: CRVAL3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 47: CDELT3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 48: CRPIX3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 51: CRVAL4 = -0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 52: CDELT4 = -2,120575050367E+08
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 53: CRPIX4 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 9: BSCALE = 1,000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 10: BZERO = 0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 15: EQUINOX = 2,000000000000E+03
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 36: CRVAL1 = -1,536261183330E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 37: CDELT1 = -4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 38: CRPIX1 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 41: CRVAL2 = 4,976596536110E+01
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 42: CDELT2 = 4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 43: CRPIX2 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 46: CRVAL3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 47: CDELT3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 48: CRPIX3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 51: CRVAL4 = -0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 52: CDELT4 = -2,120575050367E+08
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 53: CRPIX4 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
EQUINOX = 2,000000000000E+03
Rejected (1), invalid keyvalue.
LONPOLE = 1,800000000000E+02
Rejected (2), invalid keyvalue.
LATPOLE = 4,976596536110E+01
Rejected (3), invalid keyvalue.
PC01_01 = 1,000000000000E+00
Rejected (4), invalid keyvalue.
PC02_01 = 0,000000000000E+00
Rejected (5), invalid keyvalue.
PC03_01 = 0,000000000000E+00
Rejected (6), invalid keyvalue.
PC04_01 = 0,000000000000E+00
Rejected (7), invalid keyvalue.
PC01_02 = 0,000000000000E+00
Rejected (8), invalid keyvalue.
PC02_02 = 1,000000000000E+00
Rejected (9), invalid keyvalue.
PC03_02 = 0,000000000000E+00
Rejected (10), invalid keyvalue.
PC04_02 = 0,000000000000E+00
Rejected (11), invalid keyvalue.
PC01_03 = 0,000000000000E+00
Rejected (12), invalid keyvalue.
PC02_03 = 0,000000000000E+00
Rejected (13), invalid keyvalue.
PC03_03 = 1,000000000000E+00
Rejected (14), invalid keyvalue.
PC04_03 = 0,000000000000E+00
Rejected (15), invalid keyvalue.
PC01_04 = 0,000000000000E+00
Rejected (16), invalid keyvalue.
PC02_04 = 0,000000000000E+00
Rejected (17), invalid keyvalue.
PC03_04 = 0,000000000000E+00
Rejected (18), invalid keyvalue.
PC04_04 = 1,000000000000E+00
Rejected (19), invalid keyvalue.
CRVAL1 = -1,536261183330E+02
Rejected (20), invalid keyvalue.
CDELT1 = -4,166666666670E-04
Rejected (21), invalid keyvalue.
CRPIX1 = 2,570000000000E+02
Rejected (22), invalid keyvalue.
CRVAL2 = 4,976596536110E+01
Rejected (23), invalid keyvalue.
CDELT2 = 4,166666666670E-04
Rejected (24), invalid keyvalue.
CRPIX2 = 2,570000000000E+02
Rejected (25), invalid keyvalue.
CRVAL3 = 1,000000000000E+00
Rejected (26), invalid keyvalue.
CDELT3 = 1,000000000000E+00
Rejected (27), invalid keyvalue.
CRPIX3 = 1,000000000000E+00
Rejected (28), invalid keyvalue.
CRVAL4 = -0,000000000000E+00
Rejected (29), invalid keyvalue.
CDELT4 = -2,120575050367E+08
Rejected (30), invalid keyvalue.
CRPIX4 = 1,000000000000E+00
Rejected (31), invalid keyvalue.
PV2_1 = 0,000000000000E+00
Rejected (32), invalid keyvalue.
PV2_2 = 0,000000000000E+00
Rejected (33), invalid keyvalue.
RESTFRQ = 1,241195678711E+08 /Rest Frequency (Hz)
Rejected (34), invalid keyvalue.
2017-04-12 11:35:51 WARN FITSCoordinateUtil::fromFITSHeader Zero or no rest frequency provided for velocity axis.
2017-04-12 11:35:51 WARN FITSImage::getImageAttributes (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/casacore/images/Images/FITSImage.cc, line 720) No proper coordinate system defined in FITS file. Using dummy linear system instead.
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 INFO FITS card 9: BSCALE = 1,000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 10: BZERO = 0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 15: EQUINOX = 2,000000000000E+03
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 36: CRVAL1 = -1,536261183330E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 37: CDELT1 = -4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 38: CRPIX1 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 41: CRVAL2 = 4,976596536110E+01
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 42: CDELT2 = 4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 43: CRPIX2 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 46: CRVAL3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 47: CDELT3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 48: CRPIX3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 51: CRVAL4 = -0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 52: CDELT4 = -2,120575050367E+08
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 53: CRPIX4 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 9: BSCALE = 1,000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 10: BZERO = 0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 15: EQUINOX = 2,000000000000E+03
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 36: CRVAL1 = -1,536261183330E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 37: CDELT1 = -4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 38: CRPIX1 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 41: CRVAL2 = 4,976596536110E+01
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 42: CDELT2 = 4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 43: CRPIX2 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 46: CRVAL3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 47: CDELT3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 48: CRPIX3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 51: CRVAL4 = -0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 52: CDELT4 = -2,120575050367E+08
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 53: CRPIX4 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 9: BSCALE = 1,000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 10: BZERO = 0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 15: EQUINOX = 2,000000000000E+03
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 36: CRVAL1 = -1,536261183330E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 37: CDELT1 = -4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 38: CRPIX1 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 41: CRVAL2 = 4,976596536110E+01
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 42: CDELT2 = 4,166666666670E-04
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 43: CRPIX2 = 2,570000000000E+02
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 46: CRVAL3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 47: CDELT3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 48: CRPIX3 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 51: CRVAL4 = -0,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 52: CDELT4 = -2,120575050367E+08
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
2017-04-12 11:35:51 INFO FITS card 53: CRPIX4 = 1,000000000000E+00
2017-04-12 11:35:51 INFO Keyword value has wrong data type.
2017-04-12 11:35:51 INFO ... converted to type double.
2017-04-12 11:35:51 INFO Numeric value does not conform to FITS fixed format.
EQUINOX = 2,000000000000E+03
Rejected (1), invalid keyvalue.
LONPOLE = 1,800000000000E+02
Rejected (2), invalid keyvalue.
LATPOLE = 4,976596536110E+01
Rejected (3), invalid keyvalue.
PC01_01 = 1,000000000000E+00
Rejected (4), invalid keyvalue.
PC02_01 = 0,000000000000E+00
Rejected (5), invalid keyvalue.
PC03_01 = 0,000000000000E+00
Rejected (6), invalid keyvalue.
PC04_01 = 0,000000000000E+00
Rejected (7), invalid keyvalue.
PC01_02 = 0,000000000000E+00
Rejected (8), invalid keyvalue.
PC02_02 = 1,000000000000E+00
Rejected (9), invalid keyvalue.
PC03_02 = 0,000000000000E+00
Rejected (10), invalid keyvalue.
PC04_02 = 0,000000000000E+00
Rejected (11), invalid keyvalue.
PC01_03 = 0,000000000000E+00
Rejected (12), invalid keyvalue.
PC02_03 = 0,000000000000E+00
Rejected (13), invalid keyvalue.
PC03_03 = 1,000000000000E+00
Rejected (14), invalid keyvalue.
PC04_03 = 0,000000000000E+00
Rejected (15), invalid keyvalue.
PC01_04 = 0,000000000000E+00
Rejected (16), invalid keyvalue.
PC02_04 = 0,000000000000E+00
Rejected (17), invalid keyvalue.
PC03_04 = 0,000000000000E+00
Rejected (18), invalid keyvalue.
PC04_04 = 1,000000000000E+00
Rejected (19), invalid keyvalue.
CRVAL1 = -1,536261183330E+02
Rejected (20), invalid keyvalue.
CDELT1 = -4,166666666670E-04
Rejected (21), invalid keyvalue.
CRPIX1 = 2,570000000000E+02
Rejected (22), invalid keyvalue.
CRVAL2 = 4,976596536110E+01
Rejected (23), invalid keyvalue.
CDELT2 = 4,166666666670E-04
Rejected (24), invalid keyvalue.
CRPIX2 = 2,570000000000E+02
Rejected (25), invalid keyvalue.
CRVAL3 = 1,000000000000E+00
Rejected (26), invalid keyvalue.
CDELT3 = 1,000000000000E+00
Rejected (27), invalid keyvalue.
CRPIX3 = 1,000000000000E+00
Rejected (28), invalid keyvalue.
CRVAL4 = -0,000000000000E+00
Rejected (29), invalid keyvalue.
CDELT4 = -2,120575050367E+08
Rejected (30), invalid keyvalue.
CRPIX4 = 1,000000000000E+00
Rejected (31), invalid keyvalue.
PV2_1 = 0,000000000000E+00
Rejected (32), invalid keyvalue.
PV2_2 = 0,000000000000E+00
Rejected (33), invalid keyvalue.
RESTFRQ = 1,241195678711E+08 /Rest Frequency (Hz)
Rejected (34), invalid keyvalue.
2017-04-12 11:35:51 WARN FITSCoordinateUtil::fromFITSHeader Zero or no rest frequency provided for velocity axis.
2017-04-12 11:35:51 WARN FITSImage::getImageAttributes (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/casacore/images/Images/FITSImage.cc, line 720) No proper coordinate system defined in FITS file. Using dummy linear system instead.
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
2017-04-12 11:35:51 WARN WCCSAxisLabeller::setSpectralState (file /var/rpmbuild/BUILD/casa-prerelease/casa-prerelease-4.7.0/code/display/DisplayCanvas/WCCSAxisLabeller.cc, line 658) Illegal spectral unit
and in the viewer the image has fake coordinates (axis in km!):
When I run python -c 'import pyfits; img=pyfits.open("out.fits"); print img[0].header' | fold -w80
I obtain the corrupt FITS file error, as stated below:
/usr/local/lib/python2.7/dist-packages/pyfits/hdu/hdulist.py:848: VerifyWarning: Error validating header for HDU #0 (note: PyFITS uses zero-based indexing).
Unparsable card (BZERO), fix it first with .verify('fix').
There may be extra bytes after the last HDU or the file is corrupted.
(len(hdulist), indent(str(exc))), VerifyWarning)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pyfits/hdu/hdulist.py", line 124, in fitsopen
return HDUList.fromfile(name, mode, memmap, save_backup, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyfits/hdu/hdulist.py", line 266, in fromfile
save_backup=save_backup, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyfits/hdu/hdulist.py", line 855, in _readfrom
raise IOError('Empty or corrupt FITS file')
IOError: Empty or corrupt FITS file
I must say I'm confused now. On your system:
make_clean_mask.py
, just before line 608, the coordinates are there, when you call .tofits
, the coordinates are gone. This points to a bug in .tofits
..tofits
in isolation, everything is fine.Since I can not reproduce the error, I'm at a loss. Could you try to make an isolated example of what goes wrong? For example by stripping all lines of make_clean_mask.py
that do not involve reading or writing fits files. In particular, I still suspect pybdsf, so removing all calls to that would help.
We understood the problem and why you can't reproduce it.
The fits file can be produced with via tofits
(of python-casacore) or via export_fits
(of pyBDSM) depending if the there is or there is not the -b
. We compared the headers produced by the two and the are quite different. Especially the fits produced via tofits
has the comma as separator of the decimals while the one produce by export_fits
has the dot. The former causes the issue. Comma separated values are illegal in the header.
The comma separation comes from the locale
our machine, Italian. Probably you are using a machine with English language and the dot as decimal separation, for this reason you can't reproduce the problem.
If we change the locale
in the script and add in make_clean_mask.py these two lines
import locale
locale.setlocale(locale.LC_ALL, 'en_US.utf8')
the fits is not corrupted anymore as the decimal separator is the dot.
In order to solve the problem you should specify the format that tofits
uses to write the header. In this way it will work independently on the locale
of the machine.
The issue doesn't exist with export_fits
because the dot-decimal separator format is probably already defined in the module.
Well found. I can reproduce the error now on a clean ubuntu 16.04 by installing Italian locale (apt-get install language-pack-it
) and the following snippet:
import locale
locale.setlocale(locale.LC_ALL, 'it_IT.UTF-8')
import casacore.images as pim
# Import
img1 = pim.image('L230423_SB000_uv.dppp_1248F906Et_121MHz.pre-cal_chunk8_1248FDB71t_0g.wsclean_image11-image.fits')
# Export to FITS
img2 = pim.image('', shape=img1.shape(),coordsys=img1.coordinates())
img2.tofits('img2.fits')
# Re-read from disk: throws error when italian locale is used
import pyfits
img3 = pyfits.open('img2.fits')
Having a brief look at the code, the error seems to be somewhere in https://github.com/casacore/casacore/blob/master/images/Images/ImageFITSConverter.tcc . So it seems this ticket should move again, now to casacore.
Continued in casacore/casacore#586
Continued from lofar-astron/factor#191
On some systems, calling
.tofits()
seems to lose the coordinates, as reported by @botteon