-
Notifications
You must be signed in to change notification settings - Fork 4
/
alignment.py
35 lines (28 loc) · 985 Bytes
/
alignment.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
from do_photometry import view_image
import os
from glob import glob
from astropy.io import fits
import astroalign as aa
image_path='/mnt/eac99553-b108-449e-bf41-0716c975df8b/TRT-data/NGC 5947/band_wise/V_band/aligned/'
calibration_path='/mnt/eac99553-b108-449e-bf41-0716c975df8b/TRT-data/calibration/'
filename='*fits'
s=sorted(glob(os.path.join(image_path,filename)))
print(len(s))
#ref=s[19]
for i in range(0,len(s)): #42,43,44,45 do again
print(i)
view_image(s[i],1)
'''
# image no 3,46,50 and 69 have been used for B band.
# don't know what works for V band.
image=fits.open(ref)
reference_image=image[0].data
for i in range(2,len(s)):
image_data=fits.open(s[i])
source_image=image_data[0].data
header=image_data[0].header
image_aligned,footprint=aa.register(source_image,reference_image)
aligned_file=s[i].replace('.fits','')
fits.writeto(aligned_file+'_aligned'+'.fits',image_aligned,header,overwrite=True)
print('No. %i done'%i)
'''