-
Notifications
You must be signed in to change notification settings - Fork 0
/
pairitel_astropy_1.py
executable file
·60 lines (46 loc) · 1.77 KB
/
pairitel_astropy_1.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import aplpy
import astropy.io.fits as pyfits
import astropy
import astropy.io.ascii as asciitable
from copy import deepcopy
import glob
import os
from scipy import optimize
from astropy.table import Table, Column
from astropy.wcs import WCS
from astropy.io import fits
import input_info
reload(input_info)
import photometry_wcs
reload(photometry_wcs)
import photometry_both
reload(photometry_both)
datapath = input_info.resultfolder + '*YSO*/*_wcs.fits'
imlist = glob.glob(datapath)
imlist.sort()
# this finds the observations which are not actually centered on the cluster.
badlist = photometry_both.make_badlist(imlist)
# this should be empty because only the good nights should have been copied to the resultfolder.
print badlist
if input_info.bad_files_exist == "yes":
for b in input_info.bad_exposures: badlist.append(b)
imlist = photometry_both.sanitycheck(imlist, badlist)
# create the filenames for the individual PSF star files
outlist = deepcopy(imlist)
for i in np.arange(0,len(outlist)):
outlist[i] = outlist[i] + '.pstbyhand'
# get a list of the results of the aperture photometry (.mag.1 files):
maglist = deepcopy(imlist)
for i in np.arange(0, len(maglist)): maglist[i] = imlist[i].replace('_wcs.fits', '_wcs.fits'+input_info.photfilesuffix)
n_matched = np.ones(len(imlist),int)*-99999.
# now do the actual conversion of the psf star list to image coordinates for each observation.
for i in np.arange(0, len(imlist)):
#for i in np.arange(0, 1):
n_matched[i] = photometry_wcs.make_pst_file_from_ds9reg(input_info.psfstarfile, maglist[i], imlist[i], outlist[i])
plt.close()
print('Include these files in your "bad_exposures": ')
for n in np.where(n_matched == 0)[0]:
print(str(imlist[n]))