Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. from astropy.io import fits
  2. #This is what the file is called
  3. hdulist = fits.open('acisf02149N003_evt2.fits.gz')
  4. hdulist.info()
  5. tbdata = hdulist[1].data
  6.  
  7. #This prints it out into a text file
  8. f=open('ChandraXraysources.txt','w+')
  9.  
  10. #This chooses only the detx, dety, and energy columns I was talking about
  11. detxvect=tbdata.field('detx')
  12. detyvect=tbdata.field('dety')
  13. detzvect=tbdata.field('energy')
  14.  
  15. #This lists at the top of the text file the names of each column
  16. f.write('Chandra X-ray source, RA(x),dec(y),energy rn')
  17.  
  18. for i in range(len(detxvect)):
  19. f.write('%e %e %ern' %(detxvect[i],detyvect[i],detzvect[i]))
  20.  
  21. print(detxvect[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement