-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.py
executable file
·59 lines (42 loc) · 1.64 KB
/
process.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
58
59
#!/usr/bin/env python
###############################################################
# #
# Copyright (c) 2016, Ralf Kotulla #
# kotulla@wisc.edu #
# #
###############################################################
import pyfits, os, sys, numpy
import scipy, scipy.ndimage
import astLib.astWCS
from optparse import OptionParser
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=DeprecationWarning)
warnings.filterwarnings("ignore",category=UserWarning)
import astropy
import astropy.units
import astropy.coordinates
import astropy.io.fits as fits
import astroquery
from astroquery.simbad import Simbad
import astroquery.sdss
from astropy.utils.exceptions import AstropyWarning
warnings.simplefilter('ignore', category=AstropyWarning)
def create_cutout(hdulist, ra, dec, fov):
for i, ext in enumerate(hdulist):
data = ext.data
if (type(data) != numpy.ndarray):
continue
if (data.ndim != 2):
continue
wcs = astWCS.WCS(ext.header, mode='pyfits')
xy = wcs.sky2pix(ra, dec)
print xy
if __name__ == "__main__":
print sys.argv[1]
objname = sys.argv[1]
results = Simbad.query_object(objname)
coords = astropy.coordinates.SkyCoord(results[0][1], results[0][2], frame='icrs',
unit=(astropy.units.hourangle, astropy.units.deg))
print(coords)
print float(coords.ra)