Guest User

Untitled

a guest
Feb 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. from astropy.io import fits
  2. import glob
  3. import numpy as np
  4. from astropy import units as u
  5. from astropy.time import Time
  6. from astropy.coordinates import SkyCoord, EarthLocation, AltAz
  7.  
  8. data_files = glob.glob('/home/dokeeffe/Pictures/xo-2b/*.fits')
  9.  
  10. for file in data_files:
  11. data, header = fits.getdata(file, header=True)
  12. ra_dec = '{} {}'.format(header['OBJCTRA'],header['OBJCTDEC'])
  13. coord = SkyCoord(ra_dec, unit=(u.hourangle, u.deg))
  14. bobs_location = EarthLocation(lat=52.253494*u.deg, lon=-8.360614*u.deg, height=75*u.m)
  15. time = Time(header['DATE-OBS'])
  16. altaz = coord.transform_to(AltAz(obstime=time,location=bobs_location))
  17. print(altaz.secz)
  18.  
  19. header['AIRMASS'] = float(altaz.secz)
  20. header['GAIN'] = 0.4
  21.  
  22. fits.writeto(file, data, header, clobber=True)
Add Comment
Please, Sign In to add comment