-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_astrometrynet.py
62 lines (53 loc) · 1.47 KB
/
example_astrometrynet.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
60
61
62
from astropy.io import fits
from astropy.coordinates import SkyCoord
from astropy import units as u
from reproject.mosaicking import find_optimal_celestial_wcs
from reproject.mosaicking import reproject_and_coadd
from reproject import reproject_to_healpix, reproject_from_healpix, reproject_interp
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
from astrometrynet.net.client import client
# frames = glob("./data/2015_HB10_H_alpha_*.fits")
frames = glob("./data/[R,V,B]/*.FTS")
# Add WCS to frames
"""
for frame in frames:
image = fits.open(frame)
ra = image[0].header['RA']
dec = image[0].header['DEC']
c = SkyCoord(ra, dec, unit=(u.hourangle, u.deg))
options = client.ClientRunnerOptions(
upload=frame,
apikey="", # Add api key
# scale_est=0.39,
# scale_err=10,
center_ra=c.ra.degree,
center_dec=c.dec.degree,
radius=0.5,
scale_units="degwidth",
newfits=frame,
)
client.run_client(options)
"""
hdus = []
for frame in frames:
hdus.append(fits.open(frame))
wcs_out, shape_out = find_optimal_celestial_wcs(hdus)
image, footprint = reproject_and_coadd(
hdus,
wcs_out,
shape_out=shape_out,
reproject_function=reproject_interp,
combine_function="sum",
)
plt.imshow(
image,
vmin=np.median(image) - np.std(image),
vmax=np.median(image) + np.std(image),
origin="lower",
cmap="gray",
)
plt.axis("off")
plt.tight_layout()
plt.show()