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
|
# SARCREFS -- Determine dispersion relation for reference arcs.
procedure sarcrefs (arcref1, crval, cdelt, done, log1, log2)
file arcref1
string crval = "INDEF"
string cdelt = "INDEF"
file done
file log1
file log2
bool newdisp = no
struct *fd
begin
string arcref, arcrefms, arc, arcms, temp, str1, str2
int i, dc, nspec
bool log
struct str3
temp = mktemp ("tmp$iraf")
# Extract the primary arc reference spectrum. Determine the
# dispersion function with IDENTIFY/REIDENTIFY. Set the wavelength
# parameters with MSDISPCOR.
newdisp = no
arcref = arcref1
arcrefms = arcref1 // ".ms." // envget ("imtype")
i = stridx (",", arcrefms)
if (i > 0)
arcrefms = substr (arcrefms, 1, i-1)
if (!access (arcrefms)) {
print ("Extract arc reference image ", arcref) | tee (log1)
if (apslitproc.reference == "") {
delete (database//"/ap"//arcref, verify=no, >& "dev$null")
apslitproc (arcref, nfind=-1, ansfind="YES",
background="none", clean=no, weights="none")
} else
apslitproc (arcref, background="none", clean=no, weights="none")
nspec = 1
hselect (arcrefms, "naxis2", yes) | scan (nspec)
if (nspec > 1)
scopy (arcrefms//"[*,1]", arcrefms, w1=INDEF, w2=INDEF,
apertures="", bands="", beams="", apmodulus=0,
format="multispec", renumber=no, offset=0, clobber=yes,
merge=no, rebin=yes, verbose=no)
}
# Check for dispersion correction. If missing determine the
# dispersion function and dispersion correct. Dispersion
# correction is required to define the dispersion parameters
# for the objects.
hselect (arcrefms, "dispcor", yes, > temp)
fd = temp
dc = -1
i = fscan (fd, dc)
fd = ""; delete (temp, verify=no)
if (i < 1 || dc == -1) {
print ("Determine dispersion solution for ", arcref) | tee (log1)
#delete (database//"/id"//arcref//".ms*", verify=no)
printf ("%s %s\n", crval, cdelt) | scan (str3)
if (str3 == "INDEF INDEF")
identify (arcrefms, section="middle line", database=database,
coordlist=sparams.coordlist, nsum=1, match=sparams.match,
maxfeatures=50, zwidth=100., ftype="emission",
fwidth=sparams.fwidth, cradius=sparams.cradius,
threshold=sparams.threshold, minsep=2.,
function=sparams.i_function, order=sparams.i_order,
sample="*", niterate=sparams.i_niterate,
low_reject=sparams.i_low, high_reject=sparams.i_high,
grow=0., autowrite=yes)
else
autoidentify (arcrefms, crval, cdelt,
coordlist=sparams.coordlist,
interactive="YES", section="middle line", nsum="1",
ftype="emission", fwidth=sparams.fwidth,
cradius=sparams.cradius, threshold=sparams.threshold,
minsep=2., match=sparams.match, function=sparams.i_function,
order=sparams.i_order, sample="*",
niterate=sparams.i_niterate, low_reject=sparams.i_low,
high_reject=sparams.i_high, grow=0., dbwrite="YES",
overwrite=yes, database="database", verbose=yes,
logfile=logfile, plotfile=plotfile,
reflist="", refspec="", crpix="INDEF", cddir="unknown",
crsearch="-0.5", cdsearch="INDEF", aidpars="")
hedit (arcrefms, "refspec1", arcref // ".ms", add=yes,
show=no, verify=no)
dispcor (arcrefms, "", linearize=sparams.linearize,
database=database, table="", w1=INDEF, w2=INDEF, dw=INDEF,
nw=INDEF, log=sparams.log, flux=sparams.flux, samedisp=yes,
global=no, ignoreaps=yes, confirm=yes, verbose=no, listonly=no,
logfile=logfile)
flpr
hedit (arcrefms, "dispcor", 0, add=yes, verify=no,
show=no, update=yes)
newdisp = yes
# if (sproc.splot1) {
# print (arcrefms, ":")
# str1 = sproc.anssplot
# if (str1 == "NO" || str1 == "YES")
# sproc.splot1 = no
# if (str1 == "no" || str1 == "NO")
# sproc.splot2 = no
# else
# sproc.splot2 = yes
# }
# if (sproc.splot2)
# splot (arcrefms)
}
print (arcref, >> done)
end
|