1
FITSファイルの座標系を元の赤道座標系から銀河座標(度)に変更して、これらの座標を使用して結果のFITS画像を操作しようとしています。FITSからWCS座標を抽出する
このためには、各ピクセルの赤道位置を含む配列を抽出して、目的の銀河座標に変換する必要があります。これは私の知識が限られているため、その配列をどのように抽出するのか分からないようです。
は最終的に、私は方法で、緯度に基づいて画像をスライスしたい:
あなたが最も可能性の高いデータを格子変えなく、位置のすべてを変換したいimport pyfits
f = pyfits.open("im1.fits")
h, data = f[0].header, f[0].data
#Here I would include the transformation from Equatorial to Galactic of
the position array doing something like:
coord = SkyCoord(ra, dec, frame=Galactic, unit='deg')
#This would do the slicing
from astropy.nddata import Cutout2D
from astropy import units as u
from astropy import coordinates
#Given a longitude and latitude
size = [mylon, mylat]
cut = Cutout2D(f, center, size, wcs=wcs)