2013-10-06 5 views

답변

1

이것은 매우 일반적이며 기본적인 질문입니다.

import pyfits 
import matplotlib.pyplot as plt 

# Load the FITS file into the program 
hdulist = pyfits.open('Your FITS file name here') 

# Load table data as tbdata 
tbdata = hdulist[1].data 

fields = ['J','H','K'] #This contains your column names 
var = dict((f, tbdata.field(f)) for f in fields) #Creating a dictionary that contains 
               #variable names J,H,K 

#Now to call column J,H and K just use 
J = var['J'] 
H = var['H'] 
K = var['K'] 

#To plot J Vs H and H Vs K and so on 
plt.plot(J,H,'r') 
plt.title('Your plot title here') 
plt.show() 
+0

FWIW은'var'의 DICT 정말 필요가 없습니다 :

먼저 당신이 당신의 FITS 파일 및 플롯 열 필요가 여기에 예제 프로그램입니다. 그들은 단지'tbdata [ 'J']','tbdata [ 'H']'등을 할 수 있습니다. – Iguananaut

+0

@Iguananaut : 정보를 제공해 주셔서 감사합니다! – ThePredator