Package helpers :: Module CheckPhotometryHeaders
[hide private]

Source Code for Module helpers.CheckPhotometryHeaders

 1  #! /usr/bin/env python 
 2  #------------------------------------------------------------------------------ 
 3  #$Id: CheckPhotometryHeaders.py 7245 2010-07-20 12:52:03Z RossCollins $ 
 4  """ 
 5     Checks the photometry data to make sure everything has been marked up 
 6     correctly. 
 7   
 8     @author: N.J. Cross 
 9     @org:    WFAU, IfA, University of Edinburgh 
10  """ 
11  #------------------------------------------------------------------------------ 
12  from __future__ import division, print_function 
13   
14  import os 
15  import sys 
16   
17  import wsatools.FitsUtils as fits 
18  #------------------------------------------------------------------------------ 
19  # Entry point for script. 
20   
21  # Allow module to be imported as well as executed from the command line 
22  if __name__ == "__main__": 
23      dirPath = sys.argv[1] 
24      keys = ["MAGZPT", "MAGZRR", "EXTINCT", "EXP_TIME", 
25              "SKYNOISE", "SKYLEVEL", "FILTER"] 
26      for fileName in os.listdir(dirPath): 
27          if fileName.endswith((".fit", ".fits")): 
28              fitsFile = fits.open(os.path.join(dirPath, fileName)) 
29              print(fileName, fitsFile.info()) 
30              for extNum, hdu in enumerate(fitsFile): 
31                  print(extNum, [hdu.header.get(key) for key in keys]) 
32   
33  #------------------------------------------------------------------------------ 
34  # Change log: 
35  # 
36  # 18-Jul-2006,  NJC: Original version. 
37