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
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include "icombine.h"
# IC_GSCALE -- Get scale values as directed by CL parameter.
# Only those values which are INDEF are changed.
# The values can be one of those in the dictionary, from a file specified
# with a @ prefix, or from an image header keyword specified by a ! prefix.
int procedure ic_gscale (param, name, dic, in, exptime, values, nimages)
char param[ARB] #I CL parameter name
char name[SZ_FNAME] #O Parameter value
char dic[ARB] #I Dictionary string
pointer in[nimages] #I IMIO pointers
real exptime[nimages] #I Exposure times
real values[nimages] #O Values
int nimages #I Number of images
int type #O Type of value
int fd, i, nowhite(), open(), fscan(), nscan(), strdic()
real rval, imgetr()
pointer errstr
errchk open, imgetr
include "icombine.com"
begin
call clgstr (param, name, SZ_FNAME)
if (nowhite (name, name, SZ_FNAME) == 0)
type = S_NONE
else if (name[1] == '@') {
type = S_FILE
do i = 1, nimages
if (IS_INDEFR(values[i]))
break
if (i <= nimages) {
fd = open (name[2], READ_ONLY, TEXT_FILE)
i = 0
while (fscan (fd) != EOF) {
call gargr (rval)
if (nscan() != 1)
next
if (i == nimages) {
call eprintf (
"Warning: Ignoring additional %s values in %s\n")
call pargstr (param)
call pargstr (name[2])
break
}
i = i + 1
if (IS_INDEFR(values[i]))
values[i] = rval
}
call close (fd)
if (i < nimages) {
call salloc (errstr, SZ_LINE, TY_CHAR)
call sprintf (errstr, SZ_FNAME,
"Insufficient %s values in %s")
call pargstr (param)
call pargstr (name[2])
call error (1, errstr)
}
}
} else if (name[1] == '!') {
type = S_KEYWORD
do i = 1, nimages {
if (IS_INDEFR(values[i]))
values[i] = imgetr (in[i], name[2])
if (project) {
call amovkr (values, values, nimages)
break
}
}
} else {
type = strdic (name, name, SZ_FNAME, dic)
if (type == 0)
call error (1, "Unknown scale, zero, or weight type")
if (type==S_EXPOSURE)
do i = 1, nimages
if (IS_INDEFR(values[i]))
values[i] = max (0.001, exptime[i])
}
return (type)
end
|