-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphotometry_both.py
executable file
·33 lines (28 loc) · 1.06 KB
/
photometry_both.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
# this containes routines that are used by both the pyraf and the astropy scripts.
import glob
import astropy.io.fits as pyfits
import numpy as np
import input_info
def make_badlist(imlist):
badlist = []
for n in imlist:
hdulist = pyfits.open(n)
ra = hdulist[0].header['CRVAL1']
dec = hdulist[0].header['CRVAL2']
if ( (np.abs(float(ra) - input_info.ra_cluster) > input_info.width_images) | (np.abs(float(dec) - input_info.dec_cluster) > input_info.width_images) ):
# check if it is already included in badlist:
if not(n.replace('_coadd.fits', '').replace('_coadd.weight.fits','') in badlist):
# save only beginning of filename in badlist (suffix may change for other file types.)
badlist.append(n.replace('_coadd.fits', '').replace('_coadd.weight.fits',''))
return badlist
def sanitycheck(filelist, badlist):
newlist = []
for f in filelist:
test=0
for b in badlist:
if (b in f):
test=1
if test==0:
newlist.append(f)
return newlist