-
Notifications
You must be signed in to change notification settings - Fork 1
/
DIAPL_TrimImages.py
58 lines (38 loc) · 1.25 KB
/
DIAPL_TrimImages.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
# ----------------------------------------------------------------------------------
# Description
# ----------------------------------------------------------------------------------
#
# DIAPL_TrimImages.py - A program to trim images to 1024x1024 for DIAPL
#
# *Code to be appended to NITES_pipe.py*
#
# ----------------------------------------------------------------------------------
# Update History
# ----------------------------------------------------------------------------------
# 27/09/11 - code writen
# 27/09/11 - code tested
#
import commands
import os
def Cpl():
os.system('cp ~/login.cl .')
return 0
# trim images
def TrimImages():
print "\nTrimming images...\n"
templist=commands.getoutput('ls *.fit').split('\n')
for i in range(0,len(templist)):
image=str(templist[i]+"[2]")
image2="%s_t.fit" % (image.split('.fit')[0])
# trimming other images
#image=str(templist[i]+"[1][258:770,16:528]")
#image2="%s_t.fits" % (templist[i].split('.')[0])
iraf.imcopy(input=image,output=image2)
print image + "[" + str(i+1) + "/" + str(len(templist)) + "]"
return 0
f1=Cpl()
from pyraf import iraf
x=TrimImages()
if str(x) != "0":
print "Problem trimming images, exiting!"
exit()