2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

FITSファイルのプロット

Last updated at Posted at 2020-08-05

FITSとは

FITSはFlexible Image Transport Systemの略で,天文データを扱う際に良く用いられるかなり自由度の高いファイル形式である(拡張子は.fits).

FITSのプロットについて

FITSを開いてみる主な方法としては,

  1. NRAOが提供するCASA( https://casa.nrao.edu )や,Harvard大学のSAOImage DS9( https://sites.google.com/cfa.harvard.edu/saoimageds9 )などのソフトを用いる方法
  2. FITSを開くためのPythonのモジュールを用いる方法

の2種類がある.このうち2の方が見た目を整える方法が豊富で自由度が高いので,この方法を取り上げる.

以下にソースコードを示す.

import matplotlib.pyplot as plt
import astropy.io.fits as ap
import aplpy

#=====================FITSファイルの読み込み=========================
fits = ap.open('/PATH/to/FITS/file')

#=====================書き出す図のフォントサイズの指定=================
plt.rcParams['font.size'] = 20

#=====================APLpyによる読み込み===========================
fig = aplpy.FITSFigure(fits)

#=====================値ごとに画像を色付け==============================
fig.show_colorscale(vmin=0, vmax=500, cmap='jet')

#=====================beam sizeを図示==============================
fig.add_beam()
fig.beam.set_color('black')
fig.beam.set_hatch('+')

#=====================Gridの表示==================================
fig.add_grid()
fig.grid.set_color('grey')

#=====================Color barの追加==================================
fig.add_colorbar()
fig.colorbar.set_axis_label_text('colorbar label')

#=====================画像の保存===================================
fig.save('fig/example.png')

#=====================plot=====================================
plt.show()

ここで取り上げた以外にも,多くのオプションが存在する.

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?