【python】Card 'BSCALE' is not FITS standard

python2.7 でNobeyama CO Atlas のcubeデータを積分強度図にしてfitsに書き出そうとしたら出てきたエラー。
I found this error message when I wanted to save moment0 map as fits data.

error message
---------------------------------------
  File "moment_map.py", line 116, in <module>
    mom0_im.writeto(obj+'_mom0_CO.fits')
  File "/usr/lib64/python2.7/site-packages/astropy/utils/decorators.py", line 493, in wrapper
    return function(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 855, in writeto
    self.verify(option=output_verify)
  File "/usr/lib64/python2.7/site-packages/astropy/io/fits/verify.py", line 121, in verify
    raise VerifyError('\n' + '\n'.join(messages))
astropy.io.fits.verify.VerifyError:
Verification reported errors:
HDU 0:
    Card 13:
        Card 'BSCALE' is not FITS standard (invalid value string: '1.00000000000e+00 /REAL = TAPE * BSCALE + BZERO').
    Card 14:
        Card 'BZERO' is not FITS standard (invalid value string: '0.00000000000e+00 /').
Note: astropy.io.fits uses zero-based indexing.

---------------------------------------


Solution
If you found error message like this(こんなエラーメッセージのとき):
---------------------------------------
Verification reported errors:
HDU 0:
    Card 13:

        Card 'AAAAA' is not FITS standard (invalid value string: [value of AAAAA] / [note of AAAAA]).
---------------------------------------

I could save the data successfully with this operation(これでうまくいった):
---------------------------------------
aaaaa=float(head['AAAAA']) #いったん'AAAAA'の値をaaaaaに代入
head.remove('AAAAA') #'AAAAA'を消す
head['AAAAA']=aaaaa #新たに'AAAAA'を作って、そこにaaaaaを代入
---------------------------------------
NAXISのときはaaaaa=int(head['AAAAA'])にする。

コメント

このブログの人気の投稿

TypeError: ufunc 'bitwise_xor' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

overleafで画像が表示されない!

エラー: ""C:\U" で始まる文字列の中で 8 進文字なしに '\U' が使われています