Created
February 23, 2011 20:55
-
-
Save astrofrog/841170 to your computer and use it in GitHub Desktop.
Command-line hselect utility (rename to hselect and place in $PATH)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # | |
| # Simple command-line IRAF-style hselect. To use: | |
| # | |
| # $ hselect CDELT1 *.fits | |
| import sys | |
| import pyfits | |
| keyword = sys.argv[1] | |
| for filename in sys.argv[2:]: | |
| header = pyfits.getheader(filename) | |
| try: | |
| value = str(header[keyword]) | |
| except KeyError: | |
| value = '-' | |
| print "%60s %s" % (filename, value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment