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
|
# ECF_EVAL -- Evaluate wavelength at a given order and pixel position.
double procedure ecf_eval (ecf, order, x)
pointer ecf # GSURFIT pointer
int order # Order
double x # X point
int ecf_oeval()
double y, dgseval()
include "ecffit.com"
begin
y = ecf_oeval (ecf, order)
if (ecf == NULL)
return (x + shift / y)
else
return ((dgseval (ecf, x, y) + shift) / y)
end
# ECF_VECTOR -- Evaluate echelle dispersion function for a vector of points of
# the same order.
procedure ecf_vector (ecf, order, x, fit, npts)
pointer ecf # GSURFIT pointer
int order # Order
double x[npts] # X points
double fit[npts] # Fitted points
int npts # Number of points
double yval
pointer sp, y
int ecf_oeval()
include "ecffit.com"
begin
call smark (sp)
call salloc (y, npts, TY_DOUBLE)
yval = ecf_oeval (ecf, order)
if (ecf == NULL)
call amovd (x, fit, npts)
else {
call amovkd (yval, Memd[y], npts)
call dgsvector (ecf, x, Memd[y], fit, npts)
call adivkd (fit, yval, fit, npts)
}
if (shift != 0.)
call aaddkd (fit, shift / yval, fit, npts)
call sfree (sp)
end
# ECF_OEVAL -- Evaluate the fit order.
int procedure ecf_oeval (ecf, order)
pointer ecf # GSURFIT pointer
int order # User order
include "ecffit.com"
begin
return (slope * order + offset)
end
|