-
Notifications
You must be signed in to change notification settings - Fork 1
/
calib_spec.cl
executable file
·149 lines (119 loc) · 4.43 KB
/
calib_spec.cl
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#
#Version: 0.2 11jun08
#Version: 0.3 11jul13 - Debuged some errors...
#
procedure calib_spec
bool biascomb = yes {prompt="Combine bias (filenames '*bias*.fits')?"}
string flatpfx1 = "flat_a1" {prompt="Prefix 1 of flat filenames to be combined (WITHOUT '_')"}
string flatpfx2 = "flat_v1" {prompt="Prefix 2 of flat filenames to be combined (WITHOUT '_')"}
string flatpfx3 = "flat_a2" {prompt="Prefix 3 of flat filenames to be combined (WITHOUT '_')"}
string flatpfx4 = "flat_v2" {prompt="Prefix 4 of flat filenames to be combined (WITHOUT '_')"}
real rdnoise = 2.5 {prompt="ReadNoise (e-) to be used"}
real gain = 2.5 {prompt="Gain to be used"}
bool verify = yes {prompt="* Stop script if no bias images are found?",mode="q"}
struct *fstruct
begin
#CCD 105 at OPD
#rdnoise = 2.5
#gain = 2.5
#real rdnoise, gain
string ftemp, fname, lixo
if(flatpfx1==" " || flatpfx1==" ")
flatpfx1=""
if(flatpfx2==" " || flatpfx2==" ")
flatpfx2=""
if(flatpfx3==" " || flatpfx3==" ")
flatpfx3=""
if(flatpfx4==" " || flatpfx4==" ")
flatpfx4=""
#Clean the routines parameters
unlearn flatcombine
unlearn ccdproc
ccdproc.ccdtype = ""
ccdproc.fixpix = no
ccdproc.overscan = no
ccdproc.trim = no
ccdproc.flatcor = no
ccdproc.darkcor = no
ccdproc.zero = "avg_bias.fits"
#Combine bias images
if (biascomb) {
print("# Combining bias images...")
ftemp = mktemp("ftemp")
files("*bias*.fits", > ftemp)
unlearn zerocombine
# if (access ("avg_bias.fits"))
# imdel ("avg_bias.fits", verify=no)
zerocombine ("@"//ftemp, output="avg_bias", ccdtype="")
delete (ftemp, ver-, >& "dev$null")
}
else {
ccdproc.zerocor = no
print ("# NO BIAS IMAGES FOUND!")
if (verify) {
delete (ftemp, ver-, >& "dev$null")
fstruct = ""
}
}
#Combine flat 1 images
if (flatpfx1 != "") {
ftemp = mktemp("ftemp")
files(flatpfx1//"_*.fits", > ftemp)
fstruct = ftemp
if (fscan(fstruct, fname) != EOF) {
print("# Combining "//flatpfx1//" images...")
# if (access ("combflatobj.fits"))
# imdel ("combflatobj.fits", verify=no)
flatcombine ("@"//ftemp, output="avg_"//flatpfx1, ccdtype="", subsets = no, scale="mean")
delete (ftemp, ver-, >& "dev$null")
boxcar ("avg_"//flatpfx1, "norm_"//flatpfx1, 10, 10, boundary="nearest", constant=0.)
imarith ("avg_"//flatpfx1,"/","norm_"//flatpfx1, "norm_"//flatpfx1, title="", divzero=0.,hparams="",pixtype="", calctype="", verbose=no, noact=no)
}
}
#Combine flat 2 images
if (flatpfx2 != "") {
ftemp = mktemp("ftemp")
files(flatpfx2//"_*.fits", > ftemp)
fstruct = ftemp
if (fscan(fstruct, fname) != EOF) {
print("# Combining "//flatpfx2//" images...")
# if (access ("combflatobj.fits"))
# imdel ("combflatobj.fits", verify=no)
flatcombine ("@"//ftemp, output="avg_"//flatpfx2, ccdtype="", subsets = no, scale="mean")
delete (ftemp, ver-, >& "dev$null")
boxcar ("avg_"//flatpfx2, "norm_"//flatpfx2, 10, 10, boundary="nearest", constant=0.)
imarith ("avg_"//flatpfx2,"/","norm_"//flatpfx2, "norm_"//flatpfx2, title="", divzero=0.,hparams="",pixtype="", calctype="", verbose=no, noact=no)
}
}
#Combine flat 3 images
if (flatpfx3 != "") {
ftemp = mktemp("ftemp")
files(flatpfx3//"_*.fits", > ftemp)
fstruct = ftemp
if (fscan(fstruct, fname) != EOF) {
print("# Combining "//flatpfx3//" images...")
# if (access ("combflatobj.fits"))
# imdel ("combflatobj.fits", verify=no)
flatcombine ("@"//ftemp, output="avg_"//flatpfx3, ccdtype="", subsets = no, scale="mean")
delete (ftemp, ver-, >& "dev$null")
boxcar ("avg_"//flatpfx3, "norm_"//flatpfx3, 10, 10, boundary="nearest", constant=0.)
imarith ("avg_"//flatpfx3,"/","norm_"//flatpfx3, "norm_"//flatpfx3, title="", divzero=0.,hparams="",pixtype="", calctype="", verbose=no, noact=no)
}
}
#Combine flat 4 images
if (flatpfx4 != "") {
ftemp = mktemp("ftemp")
files(flatpfx4//"_*.fits", > ftemp)
fstruct = ftemp
if (fscan(fstruct, fname) != EOF) {
print("# Combining "//flatpfx4//" images...")
# if (access ("combflatobj.fits"))
# imdel ("combflatobj.fits", verify=no)
flatcombine ("@"//ftemp, output="avg_"//flatpfx4, ccdtype="", subsets = no, scale="mean")
delete (ftemp, ver-, >& "dev$null")
boxcar ("avg_"//flatpfx4, "norm_"//flatpfx4, 10, 10, boundary="nearest", constant=0.)
imarith ("avg_"//flatpfx4,"/","norm_"//flatpfx4, "norm_"//flatpfx4, title="", divzero=0.,hparams="",pixtype="", calctype="", verbose=no, noact=no)
}
}
fstruct = ""
end