python - Can not plot .fit file with PYFITS -
in fits file have 3 columns called j, h, , k , plot relation between j-h , h-k in x , y axes pyfits, respectively. how can make this?
this general , basic question.
first need open fits file , plot, here example program:
import pyfits import matplotlib.pyplot plt # load fits file program hdulist = pyfits.open('your fits file name here') # load table data tbdata tbdata = hdulist[1].data fields = ['j','h','k'] #this contains column names var = dict((f, tbdata.field(f)) f in fields) #creating dictionary contains #variable names j,h,k #now call column j,h , k use j = var['j'] h = var['h'] k = var['k'] #to plot j vs h , h vs k , on plt.plot(j,h,'r') plt.title('your plot title here') plt.show()
Comments
Post a Comment