Skip to content

Instantly share code, notes, and snippets.

@thespacedoctor
Created August 8, 2019 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thespacedoctor/f1d362b26f8e12a630c17b575928e429 to your computer and use it in GitHub Desktop.
Save thespacedoctor/f1d362b26f8e12a630c17b575928e429 to your computer and use it in GitHub Desktop.
[Good or Bad Astrometry] work through folder of FITS images and overlay astrometry than filter via good/bad #pessto #astrometry #image
#!/usr/bin/env python
import glob
import re
import string
import os
import ntt
imglist = glob.glob('*merge*fits')
imglist1 = glob.glob('*weight*fits')
imglist = glob.glob('*fits')
from pyraf import iraf
print '##############################'
print 'run trough all the images in this directory and move good astrometry (g) in a directory "good/"'
print 'bad (b) astrometry in a directory "bad/"'
print 'you need to have the subdirectory good/ and bad/ already there'
print 'you need to have ds9 open'
print '##############################\n'
for img in imglist:
if img not in imglist1:
hdr = ntt.util.readhdr(img)
wcs = ntt.util.readkey3(hdr, 'ASTROMET')
zzz = ntt.util.display_image(img, 1, '', '', False)
print wcs
catvec = ntt.efoscastrodef.querycatalogue('2mass', img, 'vizir')
vector = [str(k) + ' ' + str(v)
for k, v in zip(catvec['x'], catvec['y'])]
iraf.tvmark(1, 'STDIN', Stdin=list(vector), mark="circle", number='yes',
label='no', radii=10, nxoffse=5, nyoffse=5, color=204, txsize=2)
answ = raw_input('good/bad [g] ')
if not answ:
answ = 'g'
if answ in ['g', 'G', 'good', 'Good']:
os.system('mv ' + img + ' good/')
else:
os.system('mv ' + img + ' bad/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment